[PR #5278] [MERGED] feat(finalmask): support Salamander packetSize (Gecko) and Realm tlsConfig for Hysteria2 #5841

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

📋 Pull Request Information

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

Base: main ← Head: feat/hysteria2-gecko-realm-tls


📝 Commits (4)

  • ecd6e17 feat(finalmask): support salamander packetSize (Gecko) and realm tlsConfig
  • 9d9e3d4 test(finalmask): add snapshots for salamander-gecko and realm-tls fixtures
  • 436ccf2 Merge branch 'main' into feat/hysteria2-gecko-realm-tls
  • 5b904d7 feat(finalmask): polished Gecko UX with core-grounded validation

📊 Changes

6 files changed (+300 additions, -17 deletions)

View changed files

📝 frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx (+178 -17)
📝 frontend/src/test/__snapshots__/finalmask.test.ts.snap (+40 -0)
📝 frontend/src/test/finalmask.test.ts (+20 -0)
➕ frontend/src/test/golden/fixtures/finalmask/realm-tls.json (+17 -0)
➕ frontend/src/test/golden/fixtures/finalmask/salamander-gecko.json (+5 -0)
📝 frontend/src/test/outbound-link-parser.test.ts (+40 -0)

📄 Description

Summary

Expose two Hysteria2 finalmask features that the current Xray-core already supports but the panel UI did not surface: Salamander packetSize (Gecko) and the Realm mask's optional tlsConfig.

Why

Hysteria v2.9.1 and v2.9.2 added these to Xray-core, all of which land in the version this panel already pins (Xray 26.6.1, 94ffd50):

  • Gecko — Salamander gained a packetSize range; when present, core builds a GeckoConfig{MinPacketSize, MaxPacketSize}, otherwise plain Salamander. Ref: XTLS/Xray-core#6198 (66a8100).
  • Realm — UDP hole-punching mask gained an optional tlsConfig (xray's flat TLSConfig) for the connection to the realm server. Ref: XTLS/Xray-core#6137 (3630369).

The panel already whitelisted the salamander and realm mask types and passed settings through opaquely, but the form exposed only Salamander password and Realm url/stunServers — so users could not configure the new fields without hand-editing JSON. This adds typed schema + form support for both.

Type of change

  • New feature

Areas affected

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

How was this tested?

Frontend gates: tsc --noEmit and eslint src pass; added Vitest round-trip cases for both new shapes under the fm= share-link param, plus golden fixtures parsed through FinalMaskStreamSettingsSchema.

Validated against the bundled Xray 26.6.1 (94ffd50) — fed the exact JSON the panel emits to xray run -test:

Config Result
Salamander + packetSize: "100-200" (Gecko) Configuration OK.
Realm + full tlsConfig (serverName/alpn/fingerprint/allowInsecure) Configuration OK.
Plain Salamander (no packetSize) Configuration OK. (backward compatible)
Malformed packetSize: "not-a-range" Correctly rejected by the salamander mask builder — confirms the field is parsed, not ignored

Built via the repo Dockerfile (node:22-alpine frontend stage + Go builder) to confirm the full npm run build and go build succeed with the change.

UI changes:

  • Salamander mask: new optional Packet Size input (dash-range, e.g. 100-200; empty = plain Salamander, enabling Gecko when set).
  • Realm mask: new optional TLS section (Server Name / ALPN / Fingerprint / Allow Insecure), reusing the existing uTLS fingerprint and ALPN option sets.

Screenshots / recordings

To follow.

Breaking changes

None. All new fields are optional and additive. Absent packetSize preserves plain-Salamander behaviour; absent realm tlsConfig is unchanged. UdpMaskSchema.settings stays permissive, matching the existing finalmask design note.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior.
  • go build and the relevant test suite pass locally (no Go changes — settings pass through opaquely).
  • For frontend changes: typecheck and lint pass; full build verified via Docker.
  • I updated the Wiki / README / API docs (no API/endpoint changes; UI-only).
  • 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/5278 **Author:** [@rqzbeh](https://github.com/rqzbeh) **Created:** 6/13/2026 **Status:** ✅ Merged **Merged:** 6/14/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/hysteria2-gecko-realm-tls` --- ### 📝 Commits (4) - [`ecd6e17`](https://github.com/MHSanaei/3x-ui/commit/ecd6e1750a7b05955cc7610c2bcef841d3774eba) feat(finalmask): support salamander packetSize (Gecko) and realm tlsConfig - [`9d9e3d4`](https://github.com/MHSanaei/3x-ui/commit/9d9e3d496cb7cccb6aaa657f41fbd2287f910ee5) test(finalmask): add snapshots for salamander-gecko and realm-tls fixtures - [`436ccf2`](https://github.com/MHSanaei/3x-ui/commit/436ccf2bd8d860945bc2cbb9fb107515b38ffb0a) Merge branch 'main' into feat/hysteria2-gecko-realm-tls - [`5b904d7`](https://github.com/MHSanaei/3x-ui/commit/5b904d7cf951a74d3e84ed0cef70ab4f033b5587) feat(finalmask): polished Gecko UX with core-grounded validation ### 📊 Changes **6 files changed** (+300 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx` (+178 -17) 📝 `frontend/src/test/__snapshots__/finalmask.test.ts.snap` (+40 -0) 📝 `frontend/src/test/finalmask.test.ts` (+20 -0) ➕ `frontend/src/test/golden/fixtures/finalmask/realm-tls.json` (+17 -0) ➕ `frontend/src/test/golden/fixtures/finalmask/salamander-gecko.json` (+5 -0) 📝 `frontend/src/test/outbound-link-parser.test.ts` (+40 -0) </details> ### 📄 Description ## Summary Expose two Hysteria2 finalmask features that the current Xray-core already supports but the panel UI did not surface: **Salamander `packetSize`** (Gecko) and the **Realm** mask's optional **`tlsConfig`**. ## Why Hysteria v2.9.1 and v2.9.2 added these to Xray-core, all of which land in the version this panel already pins (Xray 26.6.1, `94ffd50`): - **Gecko** — Salamander gained a `packetSize` range; when present, core builds a `GeckoConfig{MinPacketSize, MaxPacketSize}`, otherwise plain Salamander. Ref: XTLS/Xray-core#6198 (`66a8100`). - **Realm** — UDP hole-punching mask gained an optional `tlsConfig` (xray's flat `TLSConfig`) for the connection to the realm server. Ref: XTLS/Xray-core#6137 (`3630369`). The panel already whitelisted the `salamander` and `realm` mask *types* and passed `settings` through opaquely, but the form exposed only Salamander `password` and Realm `url`/`stunServers` — so users could not configure the new fields without hand-editing JSON. This adds typed schema + form support for both. ## Type of change - [x] New feature ## Areas affected - [x] Frontend (UI / panel pages) - [x] Xray config generation - [x] Subscription (share links / Clash / JSON) ## How was this tested? **Frontend gates:** `tsc --noEmit` and `eslint src` pass; added Vitest round-trip cases for both new shapes under the `fm=` share-link param, plus golden fixtures parsed through `FinalMaskStreamSettingsSchema`. **Validated against the bundled Xray 26.6.1 (`94ffd50`)** — fed the exact JSON the panel emits to `xray run -test`: | Config | Result | |--------|--------| | Salamander + `packetSize: "100-200"` (Gecko) | `Configuration OK.` | | Realm + full `tlsConfig` (serverName/alpn/fingerprint/allowInsecure) | `Configuration OK.` | | Plain Salamander (no `packetSize`) | `Configuration OK.` (backward compatible) | | Malformed `packetSize: "not-a-range"` | Correctly rejected by the salamander mask builder — confirms the field is parsed, not ignored | Built via the repo `Dockerfile` (node:22-alpine frontend stage + Go builder) to confirm the full `npm run build` and `go build` succeed with the change. UI changes: - Salamander mask: new optional **Packet Size** input (dash-range, e.g. `100-200`; empty = plain Salamander, enabling Gecko when set). - Realm mask: new optional **TLS** section (Server Name / ALPN / Fingerprint / Allow Insecure), reusing the existing uTLS fingerprint and ALPN option sets. ## Screenshots / recordings _To follow._ ## Breaking changes None. All new fields are optional and additive. Absent `packetSize` preserves plain-Salamander behaviour; absent realm `tlsConfig` is unchanged. `UdpMaskSchema.settings` stays permissive, matching the existing finalmask design note. ## 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 relevant test suite pass locally (no Go changes — settings pass through opaquely). - [x] For frontend changes: typecheck and lint pass; full build verified via Docker. - [ ] I updated the Wiki / README / API docs (no API/endpoint changes; UI-only). - [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:04:28 +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#5841
No description provided.