[PR #6809] [MERGED] fix(link): read fm and the mKCP fields from vmess links #6462

Closed
opened 2026-11-02 04:08:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 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)

  • a40e92c fix(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 parseVmess and TS parseVmessLink) ignore the fm field 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 as type, the seed as path, plus mtu/tti (applyToObj, internal/sub/service.go:2737). Neither importer reads them, so the imported outbound is plain mKCP with default kcpSettings. 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:

  • kcp: mtu/tti go through applyTransport / applyTransportParams, so the bounds from #6480 apply.
  • fm goes through applyFinalMask / applyFinalMaskParam. For kcp, type and path are passed as headerType and seed, so applyMkcpLegacyFromShare rebuilds the masks the same way it does for vless. An fm mkcp-legacy mask still wins, so the seed is not added twice: the emitter writes both fm and path.

Type of change

  • Bug fix

Areas affected

  • Frontend (UI / panel pages)
  • Subscription (share links / Clash / JSON)
  • Xray config generation

How was this tested?

  • Go: two vmess rows added to TestParse_KcpShareParams (header + seed from type/path; the emitter's real fm + path output gives a single seed mask), plus TestParse_VmessFinalMask (salamander mask from fm). 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.
  • TS: the same cases in 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 typecheck and npm run build pass.
  • Manual check on v3.10.0 with Xray-core 26.10.10, all local: I added vmess mKCP inbounds with a seed, with a wechat-video header, 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 fm or kcp fields import the same as before.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed. (not needed)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6809 **Author:** [@jayhemnani9910](https://github.com/jayhemnani9910) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/link-vmess-finalmask` --- ### 📝 Commits (1) - [`a40e92c`](https://github.com/MHSanaei/3x-ui/commit/a40e92c26072c69826065e4769f0a51d9011a469) fix(link): read fm and the mKCP fields from vmess links ### 📊 Changes **4 files changed** (+105 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description ## Summary The vmess importers (Go `parseVmess` and TS `parseVmessLink`) ignore the `fm` field 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 as `type`, the seed as `path`, plus `mtu`/`tti` (`applyToObj`, `internal/sub/service.go:2737`). Neither importer reads them, so the imported outbound is plain mKCP with default `kcpSettings`. 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: - kcp: `mtu`/`tti` go through `applyTransport` / `applyTransportParams`, so the bounds from #6480 apply. - `fm` goes through `applyFinalMask` / `applyFinalMaskParam`. For kcp, `type` and `path` are passed as `headerType` and `seed`, so `applyMkcpLegacyFromShare` rebuilds the masks the same way it does for vless. An `fm` mkcp-legacy mask still wins, so the seed is not added twice: the emitter writes both `fm` and `path`. ## Type of change - [x] Bug fix ## Areas affected - [x] Frontend (UI / panel pages) - [x] Subscription (share links / Clash / JSON) - [x] Xray config generation ## How was this tested? - Go: two vmess rows added to `TestParse_KcpShareParams` (header + seed from `type`/`path`; the emitter's real `fm` + `path` output gives a single seed mask), plus `TestParse_VmessFinalMask` (salamander mask from `fm`). 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. - TS: the same cases in `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 typecheck` and `npm run build` pass. - Manual check on v3.10.0 with Xray-core 26.10.10, all local: I added vmess mKCP inbounds with a seed, with a `wechat-video` header, 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 `fm` or kcp fields import the same as before. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. (not needed) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:57 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6462
No description provided.