[PR #5506] [MERGED] feat(xhttp): support sessionID* rename + sessionIDTable/Length (xray v26.6.22) #5906

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5506
Author: @rqzbeh
Created: 6/23/2026
Status: ✅ Merged
Merged: 6/23/2026
Merged by: @MHSanaei

Base: main ← Head: feat/xhttp-sessionid-v26.6.22


📝 Commits (4)

  • 71a6844 feat(xhttp): support sessionID* rename + sessionIDTable/Length (xray v26.6.22)
  • 13a446e test(xhttp): add Session ID Table to inbound form-blocks snapshot
  • 1fdafa2 fix(xhttp): migrate legacy session keys in the running xray config
  • 3ef6171 fix(xray): avoid summed-capacity allocation in mergeSubscriptionOutbounds

📊 Changes

31 files changed (+498 additions, -45 deletions)

View changed files

📝 frontend/src/lib/xray/inbound-link.ts (+4 -2)
📝 frontend/src/lib/xray/outbound-link-parser.ts (+23 -3)
📝 frontend/src/lib/xray/stream-wire-normalize.ts (+4 -2)
➕ frontend/src/lib/xray/xhttp-session-id.ts (+34 -0)
📝 frontend/src/pages/inbounds/form/InboundFormModal.tsx (+1 -1)
📝 frontend/src/pages/inbounds/form/transport/xhttp.tsx (+30 -6)
📝 frontend/src/pages/xray/outbounds/transport/xhttp.tsx (+36 -4)
📝 frontend/src/schemas/protocols/stream/xhttp.ts (+36 -4)
📝 frontend/src/test/__snapshots__/inbound-form-blocks.test.tsx.snap (+1 -0)
📝 frontend/src/test/__snapshots__/stream.test.ts.snap (+16 -8)
📝 frontend/src/test/golden/fixtures/stream/xhttp-extra-placement.json (+2 -2)
📝 frontend/src/test/outbound-link-parser.test.ts (+8 -3)
➕ frontend/src/test/xhttp-session-id.test.ts (+54 -0)
📝 internal/sub/clash_service.go (+19 -2)
📝 internal/sub/clash_service_test.go (+14 -6)
📝 internal/sub/service.go (+15 -1)
📝 internal/web/service/xray.go (+68 -1)
➕ internal/web/service/xray_xhttp_session_test.go (+81 -0)
📝 internal/web/translation/ar-EG.json (+4 -0)
📝 internal/web/translation/en-US.json (+4 -0)

...and 11 more files

📄 Description

Summary

Bring the panel's XHTTP transport in line with xray-core v26.6.22 (PR #6258): rename the session config keys and add the two new session-ID fields.

Why

xray-core v26.6.22 renamed sessionPlacement/sessionKey to sessionIDPlacement/sessionIDKey (the engine keeps no fallback for the old names) and added:

  • sessionIDTable — encoding charset: a predefined name (ALPHABET, Alphabet, BASE36, Base62, HEX, alphabet, base36, hex, number) or a literal ASCII string.
  • sessionIDLength — session-ID length range (e.g. 16-32); lower bound must be > 0. xray validates that the resulting ID space exceeds ~2.1 billion possibilities.

Until this change, any inbound configured with a non-default sessionPlacement is silently ignored by the bundled engine.

Two sibling v26.6.22 XHTTP commits need no panel change and are covered by the core bump alone: #6332 (XHTTP/3 closes QUIC/UDP) and #6320 (udpHop honors the existing dialerProxy).

Type of change

  • New feature
  • Bug fix (non-default session placement was being dropped by the engine)

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)

How was this tested?

  • Schema migration, defaults, new-key precedence, and the table/length validators verified directly (legacy sessionPlacement/sessionKey lift onto the renamed keys and the legacy keys are dropped).
  • Frontend typecheck + lint pass; snapshot and golden fixtures updated; added xhttp-session-id.test.ts (migration + validators) and legacy-alias coverage in outbound-link-parser.test.ts.
  • go build ./... and the full go test -shuffle=on -count=1 ./... suite pass; updated clash_service_test.go for the renamed/new keys.
  • Codegen staleness gate clean (frontend/src/generated + openapi.json unchanged — XHTTP settings are not modeled there).

Manual: create an XHTTP inbound, set Session Placement = cookie, Session ID Table = Base62, Session ID Length = 16-32, save → generated config emits sessionIDPlacement/sessionIDKey/sessionIDTable/sessionIDLength and no legacy session* keys. A pre-upgrade inbound with sessionKey shows the value under the renamed field and re-saves with the new key.

Breaking changes

The wire keys sessionPlacement/sessionKey are renamed to sessionIDPlacement/sessionIDKey to match xray-core. Migration is automatic: stored inbound/outbound configs are lifted onto the new keys on load (Zod preprocess), the subscription and Clash builders fall back to the legacy keys for not-yet-resaved inbounds, and old share links carrying sessionKey/sessionPlacement are still imported. No user action required.

Checklist

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

🤖 Generated with Claude Code


🔄 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/5506 **Author:** [@rqzbeh](https://github.com/rqzbeh) **Created:** 6/23/2026 **Status:** ✅ Merged **Merged:** 6/23/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/xhttp-sessionid-v26.6.22` --- ### 📝 Commits (4) - [`71a6844`](https://github.com/MHSanaei/3x-ui/commit/71a68443717df4526f364becad08698930d80f29) feat(xhttp): support sessionID* rename + sessionIDTable/Length (xray v26.6.22) - [`13a446e`](https://github.com/MHSanaei/3x-ui/commit/13a446e0926bdb0e0c72243ff0fa14eb7c955631) test(xhttp): add Session ID Table to inbound form-blocks snapshot - [`1fdafa2`](https://github.com/MHSanaei/3x-ui/commit/1fdafa263691498242535a7a777d9e8bbe4502f6) fix(xhttp): migrate legacy session keys in the running xray config - [`3ef6171`](https://github.com/MHSanaei/3x-ui/commit/3ef617132acdb1454b3333b76cd53b9783124501) fix(xray): avoid summed-capacity allocation in mergeSubscriptionOutbounds ### 📊 Changes **31 files changed** (+498 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/xray/inbound-link.ts` (+4 -2) 📝 `frontend/src/lib/xray/outbound-link-parser.ts` (+23 -3) 📝 `frontend/src/lib/xray/stream-wire-normalize.ts` (+4 -2) ➕ `frontend/src/lib/xray/xhttp-session-id.ts` (+34 -0) 📝 `frontend/src/pages/inbounds/form/InboundFormModal.tsx` (+1 -1) 📝 `frontend/src/pages/inbounds/form/transport/xhttp.tsx` (+30 -6) 📝 `frontend/src/pages/xray/outbounds/transport/xhttp.tsx` (+36 -4) 📝 `frontend/src/schemas/protocols/stream/xhttp.ts` (+36 -4) 📝 `frontend/src/test/__snapshots__/inbound-form-blocks.test.tsx.snap` (+1 -0) 📝 `frontend/src/test/__snapshots__/stream.test.ts.snap` (+16 -8) 📝 `frontend/src/test/golden/fixtures/stream/xhttp-extra-placement.json` (+2 -2) 📝 `frontend/src/test/outbound-link-parser.test.ts` (+8 -3) ➕ `frontend/src/test/xhttp-session-id.test.ts` (+54 -0) 📝 `internal/sub/clash_service.go` (+19 -2) 📝 `internal/sub/clash_service_test.go` (+14 -6) 📝 `internal/sub/service.go` (+15 -1) 📝 `internal/web/service/xray.go` (+68 -1) ➕ `internal/web/service/xray_xhttp_session_test.go` (+81 -0) 📝 `internal/web/translation/ar-EG.json` (+4 -0) 📝 `internal/web/translation/en-US.json` (+4 -0) _...and 11 more files_ </details> ### 📄 Description ## Summary Bring the panel's XHTTP transport in line with xray-core v26.6.22 ([PR #6258](https://github.com/XTLS/Xray-core/pull/6258)): rename the session config keys and add the two new session-ID fields. ## Why xray-core v26.6.22 renamed `sessionPlacement`/`sessionKey` to `sessionIDPlacement`/`sessionIDKey` (the engine keeps **no** fallback for the old names) and added: - `sessionIDTable` — encoding charset: a predefined name (`ALPHABET`, `Alphabet`, `BASE36`, `Base62`, `HEX`, `alphabet`, `base36`, `hex`, `number`) or a literal ASCII string. - `sessionIDLength` — session-ID length range (e.g. `16-32`); lower bound must be > 0. xray validates that the resulting ID space exceeds ~2.1 billion possibilities. Until this change, any inbound configured with a non-default `sessionPlacement` is **silently ignored** by the bundled engine. Two sibling v26.6.22 XHTTP commits need no panel change and are covered by the core bump alone: [#6332](https://github.com/XTLS/Xray-core/commit/1e036ce1c5076f695d149a672ca578ebf907f882) (XHTTP/3 closes QUIC/UDP) and [#6320](https://github.com/XTLS/Xray-core/commit/829d54d7be3e5df9521c42948fe060d6c4660e19) (udpHop honors the existing `dialerProxy`). ## Type of change - [x] New feature - [x] Bug fix (non-default session placement was being dropped by the engine) ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [x] Xray config generation - [x] Subscription (share links / Clash / JSON) ## How was this tested? - Schema migration, defaults, new-key precedence, and the table/length validators verified directly (legacy `sessionPlacement`/`sessionKey` lift onto the renamed keys and the legacy keys are dropped). - Frontend `typecheck` + `lint` pass; snapshot and golden fixtures updated; added `xhttp-session-id.test.ts` (migration + validators) and legacy-alias coverage in `outbound-link-parser.test.ts`. - `go build ./...` and the full `go test -shuffle=on -count=1 ./...` suite pass; updated `clash_service_test.go` for the renamed/new keys. - Codegen staleness gate clean (`frontend/src/generated` + `openapi.json` unchanged — XHTTP settings are not modeled there). Manual: create an XHTTP inbound, set Session Placement = cookie, Session ID Table = `Base62`, Session ID Length = `16-32`, save → generated config emits `sessionIDPlacement`/`sessionIDKey`/`sessionIDTable`/`sessionIDLength` and no legacy `session*` keys. A pre-upgrade inbound with `sessionKey` shows the value under the renamed field and re-saves with the new key. ## Breaking changes The wire keys `sessionPlacement`/`sessionKey` are renamed to `sessionIDPlacement`/`sessionIDKey` to match xray-core. **Migration is automatic:** stored inbound/outbound configs are lifted onto the new keys on load (Zod preprocess), the subscription and Clash builders fall back to the legacy keys for not-yet-resaved inbounds, and old share links carrying `sessionKey`/`sessionPlacement` are still imported. No user action required. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior. - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: lint, typecheck, and build pass. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:04:56 +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#5906
No description provided.