mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6480] [MERGED] fix(link): restore mKCP seed and headerType on share-link import #6296
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#6296
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/6480
Author: @mrchatam
Created: 9/11/2026
Status: ✅ Merged
Merged: 9/13/2026
Merged by: @MHSanaei
Base:
main← Head:fix/mkcp-link-import-seed-header📝 Commits (3)
284b578fix(link): restore mKCP seed and headerType on share-link importc8065a8fix(link): restore mKCP header/seed via finalmask mkcp-legacy2ac536dfix(link): split mKCP header and seed into separate masks on import📊 Changes
4 files changed (+299 additions, -8 deletions)
View changed files
📝
frontend/src/lib/xray/outbound-link-parser.ts(+74 -8)📝
frontend/src/test/outbound-link-parser.test.ts(+61 -0)📝
internal/util/link/outbound.go(+90 -0)📝
internal/util/link/outbound_helpers_test.go(+74 -0)📄 Description
Summary
type=kcp&headerType=…&seed=…(plusmtu/tti), but both importers — Gointernal/util/link/outbound.goand TSfrontend/src/lib/xray/outbound-link-parser.ts— ignored them and kept the cannedkcpSettingsdefaults.kcpSettings.header/seedare parsed but never used (KCPConfig.Buildreads only mtu/tti/capacities). The live obfuscation is the finalmaskmkcp-legacyUDP mask, so import now rebuilds those masks fromheaderType/seedwhen the link carries nofm=mkcp-legacy mask (anfm=mask wins).MkcpLegacy.Buildignoresvalueonceheaderis set (and reads it as the DNS domain fordns), and the finalmask array's first item is the innermost layer.[{header:"", value:<seed>}, {header:"wechat", value:""}]therefore puts the header around the cipher as legacy mKCP did, and matches what the panel's inbound form and the sub emitter model (one mask per field).mtu/ttiare copied ontokcpSettingsonly insideKCPConfig.Build's accepted ranges (mtu ≥ 21, tti 10..1000, decimal digits only on both importers). An out-of-range value would fail the whole Xray config load, so it keeps thebuildStreamdefault instead.constructoris not mapped.mtu/tti, prototype key.Not covered here (pre-existing): the vmess importers still have no kcp branch and ignore
fm(the vmess emitter writes the header astypeand the seed aspath), and the TS share-link emitter emits onlymtu/ttifor kcp while the Go sub emitter also emitsheaderType/seed.Fixes #6476
Test plan
go test ./internal/util/link/ -run TestParse_KcpShareParamscd frontend && npx vitest run src/test/outbound-link-parser.test.tsmake verifykcpand two mkcp-legacy masks (header: ""with a seed as value, andheader: wechat); copy the client share link and confirm the query hastype=kcp&headerType=wechat-video&seed=…fm=param removed (the panel's own link carriesfm, which already round-trips);streamSettings.finalmask.udpmust list{header:"", value:<seed>}then{header:"wechat", value:""}, and the outbound must connect to the inbound🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.