mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6476] [Bug]: Share-link import drops mKCP seed and headerType #4369
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#4369
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?
Originally created by @mrchatam on GitHub (Sep 11, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6476
Describe the bug
Share links generated for mKCP inbounds include
type=kcp,headerType, andseed(viaapplyKcpShareParams), but both importers ignore those query params. Re-importing the link yields an outbound with the cannedkcpSettingsdefaults (no seed, no header), so xray-core silently drops every packet from that outbound.Affected paths (same gap in both twins):
internal/util/link/outbound.go—applyTransportswitch coversws/grpc/httpupgrade/xhttp/tcponly; nokcpbranchfrontend/src/lib/xray/outbound-link-parser.ts—applyTransportParamshas the same setbuildStreamdoes seed a defaultkcpSettingsblock whennetwork=kcp, but nothing copiesheaderType/seed/mtu/ttifrom the query into it.Generator side (what the link contains):
internal/sub/service.go→applyKcpShareParams→kcpShareFields.applyToParamswritesheaderTypeandseed(and related fields).How to reproduce the problem
kcp, a non-emptyseed, and header typewechat-video(or any non-noneheader)./panel/api/inbounds/allLinks). Confirm the query containstype=kcp&headerType=wechat-video&seed=....internal/util/link/outbound-link-parser).streamSettings.kcpSettings: seed is empty / absent and header is missing ornone.Expected behavior
Importing an mKCP share link restores the same
seed,headerType(and other emitted kcp fields) that the panel put on the link, so the outbound can talk to the inbound that emitted it.Actual behavior
Import keeps only the canned
kcpSettingsdefaults frombuildStream. The connection fails silently (no useful error; packets discarded).3x-ui version
main (checked against current default branch)
Suggested fix size
Small: add a
kcpbranch toapplyTransport/applyTransportParamsin both Go and TS importers (mirror whatapplyKcpShareParamsemits).Related
Adjacent to the SS TLS import work in #6094 / #6467 (same helpers). Not a duplicate of #6094.
@github-actions[bot] commented on GitHub (Sep 11, 2026):
This is a duplicate of #6473 — same two functions, same proposed fix, opened the same day — so I'm closing this one and leaving #6473 as the tracking issue. Worth reading before that one gets fixed, though: the code gap you describe is real, but the consequence isn't, and that changes what the fix should be.
The gap is real
Neither importer has a
kcpbranch:But
seed/headerTypeno longer carry mKCP obfuscationCommit
32f96298("feat(finalmask): sync transport with upstream Xray core changes") consolidated the legacy mKCP header masks into a single FinalMaskmkcp-legacyUDP mask, "matching the updated Xray-core wire format". The panel's mKCP model has noseedand noheaderleft:The inbound form (
frontend/src/pages/inbounds/form/transport/kcp.tsx:10-44) and the outbound form (frontend/src/pages/xray/outbounds/transport/kcp.tsx:10-44) both show exactly those six fields.docs/content/docs/en/config/transports.mdx:53-57says it outright:So step 1 of your repro — an inbound with "a non-empty
seedand header typewechat-video" — is not reachable on currentmain. You setHeader: WeChat Video+Value:on anmkcp-legacyFinalMask UDP mask instead (FinalMaskForm.tsx:938-957), whichInboundFormModal.tsx:857-869seeds automatically when you switch a transport to mKCP.And that mask does round-trip on import
The same link carries
fm=<finalmask json>(internal/sub/service.go:1058and:2636-2639; TSinbound-link.ts:326), and both importers restore it right afterapplyTransport:mkcp-legacyis invalidFinalMaskUDPTypes(internal/sub/service.go:2486), so the mask survivesmarshalFinalMaskand lands back on the imported outbound.The
headerType=/seed=params the Go generator writes are legacy-compat exports for third-party clients, derived from that same mask:extractKcpShareFieldsmapsheader:"wechat"→headerType=wechat-videoandheader:""→seed=<value>(internal/sub/service.go:2559-2578, pinned byTestExtractKcpShareFields_FinalMaskLegacyHeaderandTestExtractKcpShareFields_FinalMaskLegacySeed). Copying them back intokcpSettingson import would write fields the current model no longer has, on top of whatfmalready restored.What is genuinely dropped:
mtuandttiBoth generators emit them —
kcpShareFields.applyToParams(internal/sub/service.go:2526-2527, viasetIntParam, only when> 0) andinbound-link.ts:417-418/:522-523— and both importers hardcode the defaults instead:An inbound at
mtu=1200, tti=50therefore imports as1350/20. That is the part of #6473 that is a real defect. I could not determine from this repo whether a mismatched mKCPmtu/ttiactually breaks a connection or only changes pacing — that behaviour lives in xray-core, not here — so the "packets discarded, silent failure" description is not something I can confirm.Verdict: Duplicate
Severity: Low
Confidence: High
Root cause:
applyTransport(internal/util/link/outbound.go:606-656) andapplyTransportParams(frontend/src/lib/xray/outbound-link-parser.ts:193-237) have nokcpcase, so themtu/ttiquery params are discarded andbuildStream's hardcodedmtu:1350, tti:20(outbound.go:559-562,outbound-link-parser.ts:141-148) stand. TheheaderType/seedhalf of the report has no root cause: those params are legacy exports and the live obfuscation round-trips viafm.Already fixed: Still present on the default branch (
0a2cd789) formtu/tti.Duplicate of: #6473 — same missing
kcpbranch inapplyTransport/applyTransportParams, same generator (applyKcpShareParams), same proposed fix.Evidence:
internal/util/link/outbound.go:610andfrontend/src/lib/xray/outbound-link-parser.ts:197(nokcpcase);outbound.go:275/:681-688andoutbound-link-parser.ts:507/:242-253(fmrestoresfinalmaskafterapplyTransport);frontend/src/schemas/protocols/stream/kcp.ts:6-13(noseed/headerin the model);docs/content/docs/en/config/transports.mdx:53-57("those fields no longer exist here"); commit32f96298;internal/sub/service.go:2559-2578+TestExtractKcpShareFields_FinalMaskLegacyHeader(service_test.go:966-984).Not determined: Whether a link carrying
headerType/seedwith nofm— a third-party generator, or an inbound row still holding the pre-32f96298kcpSettings.header/seedshape, which nothing ininternal/database/db.gomigrates — describes a working inbound at all. That depends on whether the pinnedgithub.com/xtls/xray-core v1.260327.1-0.20260908222543-52a412d9e2f5(go.mod:28) still honourskcpSettings.header/seed; I cannot inspect that module from this checkout. Reading itstransport/internet/kcpconfig would settle it.This reply was generated automatically; a maintainer may follow up.