mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6809] [MERGED] fix(link): read fm and the mKCP fields from vmess links #6462
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#6462
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/6809
Author: @jayhemnani9910
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/link-vmess-finalmask📝 Commits (1)
a40e92cfix(link): read fm and the mKCP fields from vmess links📊 Changes
4 files changed (+105 additions, -1 deletions)
View changed files
📝
frontend/src/lib/xray/outbound-link-parser.ts(+13 -0)📝
frontend/src/test/outbound-link-parser.test.ts(+51 -1)📝
internal/util/link/outbound.go(+10 -0)📝
internal/util/link/outbound_helpers_test.go(+31 -0)📄 Description
Summary
The vmess importers (Go
parseVmessand TSparseVmessLink) ignore thefmfield and the mKCP fields in a vmess link. This change runs them through the same finalmask and kcp helpers the vless/trojan importers already use, in Go and in TS.Why
#6480 fixed mKCP header and seed import for vless and trojan links. Its description lists what was left: "the vmess importers still have no kcp branch and ignore
fm".The vmess emitter writes the finalmask as
fm(applyFinalMaskObj,internal/sub/service.go:2849), and writes the mKCP header astype, the seed aspath, plusmtu/tti(applyToObj,internal/sub/service.go:2737). Neither importer reads them, so the imported outbound is plain mKCP with defaultkcpSettings. If the inbound has a seed, a header, or a finalmask UDP mask such as salamander, the outbound can't connect.The Go importer is used by outbound subscriptions and by client external links in the JSON subscription. The TS importer is used by link import in the outbound form.
What the fix does:
mtu/ttigo throughapplyTransport/applyTransportParams, so the bounds from #6480 apply.fmgoes throughapplyFinalMask/applyFinalMaskParam. For kcp,typeandpathare passed asheaderTypeandseed, soapplyMkcpLegacyFromSharerebuilds the masks the same way it does for vless. Anfmmkcp-legacy mask still wins, so the seed is not added twice: the emitter writes bothfmandpath.Type of change
Areas affected
How was this tested?
TestParse_KcpShareParams(header + seed fromtype/path; the emitter's realfm+pathoutput gives a single seed mask), plusTestParse_VmessFinalMask(salamander mask fromfm). Without the fix they fail (kcpSettings mtu/tti = 1350/20, want 1400/50,mkcp-legacy masks = [], want [{ s3cr3tSeed}],finalmask.udp = nil). With the fix they pass.outbound-link-parser.test.ts(mKCP share params). Without the fix 3 fail; with the fix all 70 tests in the file pass.go test -shuffle=on -count=1 ./...: 50 packages ok, same as on main. Frontend:npx vitest run --project unit,npm run lint,npm run typecheckandnpm run buildpass.wechat-videoheader, and with a salamander UDP mask, plus the same three as vless for comparison. I imported each client's own subscription URL through outbound subscription preview (/panel/api/xray/outbound-subs/parse) and tested the outbounds with/panel/api/xray/testOutbounds. On v3.10.0 the vless imports and the JSON-subscription outbounds connected, and all three vmess imports timed out. With the fix all three vmess imports connect.Breaking changes
None. Links without
fmor kcp fields import the same as before.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.