[PR #6702] [MERGED] Fix fragment exports for older Xray clients #6419

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6702
Author: @artemk1337
Created: 10/1/2026
Status: ✅ Merged
Merged: 10/2/2026
Merged by: @MHSanaei

Base: main ← Head: artemk1337/fix-fragment-legacy-compat


📝 Commits (3)

  • 451bea6 Fix fragment exports for older Xray clients
  • 0ad2885 Merge branch 'main' into artemk1337/fix-fragment-legacy-compat
  • b5e5aaf fix(link): tolerate a finalmask without tcp in panel share links

📊 Changes

6 files changed (+413 additions, -7 deletions)

View changed files

📝 frontend/src/lib/xray/inbound-link.ts (+28 -1)
📝 frontend/src/test/inbound-link.test.ts (+125 -0)
📝 internal/sub/host_sub_test.go (+94 -5)
📝 internal/sub/json_service.go (+3 -0)
📝 internal/sub/service.go (+66 -1)
📝 internal/sub/service_test.go (+97 -0)

📄 Description

Older Xray clients cannot parse a TCP Fragment mask exported with only lengths and delays: xray-core v1.260327.0 reproduces infra/conf: LengthMin can't be 0 for the five-range example.

Add missing legacy length and delay fields from the last array entries when exporting panel links, URI subscriptions, and JSON subscriptions after host/global mask merging. Preserve the complete arrays and explicit singular fields, and transform copies so stored settings and server Xray configuration remain unchanged. Empty arrays do not generate fallback values; other mask types are unchanged.

For the reported example, exports retain all five ranges and additionally include length: "25-30" and delay: "10-30". Older cores use this single final range; they cannot reproduce the five per-segment ranges. Newer cores continue to prefer the arrays.

Validation:

  • Go 1.27.1: go test ./..., go vet ./..., golangci-lint v2.14.0 (0 issues), build, focused subscription race tests, and gofmt passed. Initial MTProto timeouts passed on rerun; the upstream baseline package also passed.
  • Node 26.10.0: the complete frontend suite (176 files, 1759 tests, including Storybook browser tests), typecheck, lint, formatting, frontend build, and Storybook build passed. API/schema generation left the working tree unchanged.
  • Actual FragmentMask parsers: v1.260327.0 rejects arrays-only input and accepts the added singular fields; upstream-pinned v1.260327.1-0.20260908222543-52a412d9e2f5 retains all five length/delay ranges.
  • Independent review completed.

The user reported this error in application 4.13.0. Its embedded Xray version is unknown and phone behavior has not been retested; the core incompatibility above is independently confirmed. No server deployment is included.

Original user-reported error (application 4.13.0):

IMG_8545

🔄 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/6702 **Author:** [@artemk1337](https://github.com/artemk1337) **Created:** 10/1/2026 **Status:** ✅ Merged **Merged:** 10/2/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `artemk1337/fix-fragment-legacy-compat` --- ### 📝 Commits (3) - [`451bea6`](https://github.com/MHSanaei/3x-ui/commit/451bea62f60db23c4ff0461580319ae74a73bf26) Fix fragment exports for older Xray clients - [`0ad2885`](https://github.com/MHSanaei/3x-ui/commit/0ad2885e36fddd18124f5226cbc052a35ffa004d) Merge branch 'main' into artemk1337/fix-fragment-legacy-compat - [`b5e5aaf`](https://github.com/MHSanaei/3x-ui/commit/b5e5aafa72cfad52961a80f6021d19fb76499d26) fix(link): tolerate a finalmask without tcp in panel share links ### 📊 Changes **6 files changed** (+413 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/xray/inbound-link.ts` (+28 -1) 📝 `frontend/src/test/inbound-link.test.ts` (+125 -0) 📝 `internal/sub/host_sub_test.go` (+94 -5) 📝 `internal/sub/json_service.go` (+3 -0) 📝 `internal/sub/service.go` (+66 -1) 📝 `internal/sub/service_test.go` (+97 -0) </details> ### 📄 Description Older Xray clients cannot parse a TCP Fragment mask exported with only `lengths` and `delays`: xray-core v1.260327.0 reproduces `infra/conf: LengthMin can't be 0` for the five-range example. Add missing legacy `length` and `delay` fields from the last array entries when exporting panel links, URI subscriptions, and JSON subscriptions after host/global mask merging. Preserve the complete arrays and explicit singular fields, and transform copies so stored settings and server Xray configuration remain unchanged. Empty arrays do not generate fallback values; other mask types are unchanged. For the reported example, exports retain all five ranges and additionally include `length: "25-30"` and `delay: "10-30"`. Older cores use this single final range; they cannot reproduce the five per-segment ranges. Newer cores continue to prefer the arrays. Validation: - Go 1.27.1: `go test ./...`, `go vet ./...`, golangci-lint v2.14.0 (0 issues), build, focused subscription race tests, and gofmt passed. Initial MTProto timeouts passed on rerun; the upstream baseline package also passed. - Node 26.10.0: the complete frontend suite (176 files, 1759 tests, including Storybook browser tests), typecheck, lint, formatting, frontend build, and Storybook build passed. API/schema generation left the working tree unchanged. - Actual FragmentMask parsers: v1.260327.0 rejects arrays-only input and accepts the added singular fields; upstream-pinned v1.260327.1-0.20260908222543-52a412d9e2f5 retains all five length/delay ranges. - Independent review completed. The user reported this error in application 4.13.0. Its embedded Xray version is unknown and phone behavior has not been retested; the core incompatibility above is independently confirmed. No server deployment is included. Original user-reported error (application 4.13.0): <img width="645" height="1398" alt="IMG_8545" src="https://github.com/user-attachments/assets/2b825aea-e999-4d46-9e53-736602144a75" /> --- <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:38 +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#6419
No description provided.