mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6808] [MERGED] fix(link): read the XHTTP fields a vmess link carries inline #6460
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6460
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6808
Author: @jayhemnani9910
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/link-vmess-xhttp-extra📝 Commits (1)
b1bfb3efix(link): read the XHTTP fields a vmess link carries inline📊 Changes
2 files changed (+69 additions, -2 deletions)
View changed files
📝
internal/util/link/outbound.go(+23 -2)📝
internal/util/link/outbound_helpers_test.go(+46 -0)📄 Description
Summary
The Go share-link importer reads only three XHTTP fields from a vmess link:
xPaddingBytes,scMaxEachPostBytesandscMinPostsIntervalMs. The panel's vmess links carry more, and some of them have to match the server. This makes the importer read the same XHTTP keys from vmess JSON that the TS importer already reads.Why
A vless or trojan link puts the XHTTP extra fields in the
extraparam, and the Go importer copies all of them. A vmess link has noextra. The sub emitter writes the same fields at the top level of the vmess JSON (maps.Copy(obj, buildXhttpExtra(xhttp)),internal/sub/service.go:1777).parseVmessonly picks up three of them (internal/util/link/outbound.go:189).So a vmess XHTTP inbound that sets, for example,
sessionIDPlacement: headerorxPaddingObfsModegets imported without those settings, and the outbound can't connect. The Go importer is used by outbound subscriptions (internal/web/service/outbound_subscription.go:398) and by client external links in the JSON subscription (internal/sub/external_config.go:216).The TS importer already reads these keys from vmess JSON (
applyXhttpStringFromJson,frontend/src/lib/xray/outbound-link-parser.ts:116), so only the Go side changes. The legacysessionPlacement/sessionKeynames are mapped as well, the same way the TS importer maps them.Type of change
Areas affected
How was this tested?
TestParse_VmessXhttpInlineFields(internal/util/link/outbound_helpers_test.go) covers session placement + padding obfs, uplink placement/method + xmux, and the legacy session keys. Without the fix every case fails (for examplexhttpSettings.sessionIDPlacement = <nil>, want "header"). With the fix it passes.go test -shuffle=on -count=1 ./...: 50 packages ok, same as on main.sessionIDPlacement: headerand withxPaddingObfsModeon, and the same inbounds as vless for comparison. I imported each client's own subscription URL through outbound subscription preview (/panel/api/xray/outbound-subs/parse) and tested each outbound with/panel/api/xray/testOutbounds. On v3.10.0 the JSON-subscription outbound and the vless import connected, and the vmess import failed (EOF). With the fix the vmess imports also connect.Breaking changes
None.
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass. (no frontend changes)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.