[GH-ISSUE #6441] [Feature]: Advanced Subscription Customization (Injecting Fragment, Noise, ALPN) #4360

Closed
opened 2026-10-31 20:39:07 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Plus98ir on GitHub (Sep 9, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6441

👋 Feature Request: Advanced Subscription Customization (Injecting Fragment, Noise, ALPN)

Hello again, and thank you for the amazing updates! The recent additions like the PWA have been fantastic. ❤️

🔍 Current Behavior

Currently, the subscription links generated by the panel provide standard, baseline configurations to clients (such as v2rayNG, v2rayN, etc.). However, there is no built-in way to append or inject advanced Xray parameters—like Fragment, Noise, or specific ALPN settings—directly from the panel into the exported subscription links.

💡 Proposed Solution

It would be a massive quality-of-life improvement for admins if we could customize the subscription output directly from the panel.

I suggest adding a "Subscription Customization" section (either globally or per-inbound) with the following capabilities:

  • Parameter Injection: Allow admins to define advanced parameters (e.g., Fragment values, Noise packets, custom ALPN) that get automatically injected into the subscription payload.
  • Seamless Client Updates: This would ensure that when users update their subscriptions, they instantly receive the highly optimized configurations tailored for specific ISPs, without needing to manually edit their configs after importing.

Thank you for considering this suggestion and for your continuous hard work on this project! 🚀

Describe the solution you'd like

None

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @Plus98ir on GitHub (Sep 9, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6441 ### Is your feature request related to a problem? ### 👋 Feature Request: Advanced Subscription Customization (Injecting Fragment, Noise, ALPN) Hello again, and thank you for the amazing updates! The recent additions like the PWA have been fantastic. ❤️ #### 🔍 Current Behavior Currently, the subscription links generated by the panel provide standard, baseline configurations to clients (such as v2rayNG, v2rayN, etc.). However, there is no built-in way to append or inject advanced Xray parameters—like **Fragment**, **Noise**, or specific **ALPN** settings—directly from the panel into the exported subscription links. #### 💡 Proposed Solution It would be a massive quality-of-life improvement for admins if we could customize the subscription output directly from the panel. I suggest adding a **"Subscription Customization"** section (either globally or per-inbound) with the following capabilities: - **Parameter Injection:** Allow admins to define advanced parameters (e.g., Fragment values, Noise packets, custom ALPN) that get automatically injected into the subscription payload. - **Seamless Client Updates:** This would ensure that when users update their subscriptions, they instantly receive the highly optimized configurations tailored for specific ISPs, without needing to manually edit their configs after importing. Thank you for considering this suggestion and for your continuous hard work on this project! 🚀 ### Describe the solution you'd like None ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 9, 2026):

Short answer: most of this already ships. FinalMask — which is Xray's current form of fragment and noise — can be injected into subscription output at three scopes, and ALPN at two, all server-side so clients get it on their next subscription update.

1. Globally, into every generated Xray JSON profile

Panel Settings → Sub Formats → Final Mask. It writes the subJsonFinalMask setting (internal/web/service/setting.go:125), and internal/sub/json_service.go:686 merges it into every outbound's streamSettings.finalmask:

func (s *SubJsonService) applyGlobalFinalMask(streamSettings map[string]any) {
	var fm map[string]any
	if err := json.Unmarshal([]byte(s.finalMask), &fm); err != nil || len(fm) == 0 {
		return
	}
	merged := mergeFinalMask(streamSettings["finalmask"], fm)

The field's own description in the panel (internal/web/translation/en-US.json:1385): "Inject Xray finalmask TCP/UDP masks and QUIC parameters into every generated Xray JSON profile. Requires a client app that supports Xray JSON subscriptions and a recent Xray core."

2. Per host

Hosts page → host → Final Mask (Host.FinalMask, internal/database/model/model.go:1096). Unlike the global setting this reaches both output formats: merged into the JSON stream at internal/sub/host_sub.go:150-158, and into the base64/raw share link's fm= field at internal/sub/host_sub.go:324. Hosts also carry a per-host alpn (frontend/src/schemas/api/host.ts:33) plus muxParams / sockoptParams (internal/database/model/model.go:1092-1093).

3. Per inbound

The inbound edit form's transport section (frontend/src/pages/inbounds/form/InboundFormModal.tsx:936). Note this one is a server-side change — the inbound then expects the mask as well — so for injection that only affects what clients receive, use (1) or (2).

Available masks: TCP fragment, sudoku, header-custom, xmc (frontend/src/schemas/protocols/stream/finalmask.ts:13); UDP salamander, mkcp-legacy, header-custom, xdns, xicmp, noise, sudoku, realm; plus QUIC params (internal/sub/service.go:2485-2501). Documented at docs.sanaei.dev/docs/config/transports — "FinalMask replaces the per-transport header/seed obfuscation that older Xray builds exposed" (docs/content/docs/en/config/transports.mdx:135).

ALPN is not missing either: per inbound under TLS (frontend/src/pages/inbounds/form/security/tls.tsx:274), emitted to share links as alpn= (internal/sub/service.go:1262-1263) and into JSON profiles (internal/sub/json_service.go:710), with the per-host value overriding it (internal/sub/service.go:1900).

One caveat about v2rayNG/v2rayN specifically: on base64/raw subscriptions FinalMask travels as the compact fm=<json> field, described in the source as "the compact fm=<json> share-link field used by v2rayN-compatible clients" (internal/sub/service.go:2635-2636). The panel emits it regardless; whether a given client applies it depends on that client's Xray core version. The JSON subscription format is the reliable carrier.

The one part that genuinely does not exist

The legacy freedom-outbound form of fragment/noise (outbounds[].settings.fragment / settings.noises) inside the generated client profile. The JSON template ships a fixed direct outbound with "noises": [] (internal/sub/default.json:47-56) and nothing populates it — no Go file under internal/ references noises at all — while sockopt is stripped from the proxy outbound (delete(streamSettings, "sockopt"), internal/sub/json_service.go:650). Those two fields are exposed only for the panel's own server-side outbounds (frontend/src/schemas/protocols/outbound/freedom.ts:57-58).

So one question, and it decides whether anything is left to build here:

  1. When you say "Fragment values, Noise packets", do you mean the FinalMask masks described above (already available), or the older freedom-outbound fragment/noises block that clients like v2rayNG expose in their own settings? If it's the latter, this stays open as a narrow request; if FinalMask covers you, the three switches above work today.

The global switch landed in 97f88fb1 "feat(sub): modern xray JSON format with unified finalmask editor (#4912)" (2026-06-05), first released in v3.2.8 and present in v3.7.0.

For the maintainer: docs/content/docs/en/config/subscription.mdx covers the subscription formats but never mentions the Sub Formats → Final Mask / Mux injection — FinalMask is only documented in config/transports.mdx, so this capability is easy to miss. Related earlier requests, both closed: #5075, #3203.

Verdict: Already fixed

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5602625271 --> @github-actions[bot] commented on GitHub (Sep 9, 2026): Short answer: most of this already ships. FinalMask — which is Xray's current form of **fragment** and **noise** — can be injected into subscription output at three scopes, and **ALPN** at two, all server-side so clients get it on their next subscription update. ### 1. Globally, into every generated Xray JSON profile **Panel Settings → Sub Formats → Final Mask.** It writes the `subJsonFinalMask` setting (`internal/web/service/setting.go:125`), and `internal/sub/json_service.go:686` merges it into every outbound's `streamSettings.finalmask`: ```go func (s *SubJsonService) applyGlobalFinalMask(streamSettings map[string]any) { var fm map[string]any if err := json.Unmarshal([]byte(s.finalMask), &fm); err != nil || len(fm) == 0 { return } merged := mergeFinalMask(streamSettings["finalmask"], fm) ``` The field's own description in the panel (`internal/web/translation/en-US.json:1385`): *"Inject Xray finalmask TCP/UDP masks and QUIC parameters into every generated Xray JSON profile. Requires a client app that supports Xray JSON subscriptions and a recent Xray core."* ### 2. Per host **Hosts page → host → Final Mask** (`Host.FinalMask`, `internal/database/model/model.go:1096`). Unlike the global setting this reaches **both** output formats: merged into the JSON stream at `internal/sub/host_sub.go:150-158`, and into the base64/raw share link's `fm=` field at `internal/sub/host_sub.go:324`. Hosts also carry a per-host `alpn` (`frontend/src/schemas/api/host.ts:33`) plus `muxParams` / `sockoptParams` (`internal/database/model/model.go:1092-1093`). ### 3. Per inbound The inbound edit form's transport section (`frontend/src/pages/inbounds/form/InboundFormModal.tsx:936`). Note this one is a *server-side* change — the inbound then expects the mask as well — so for injection that only affects what clients receive, use (1) or (2). Available masks: TCP `fragment`, `sudoku`, `header-custom`, `xmc` (`frontend/src/schemas/protocols/stream/finalmask.ts:13`); UDP `salamander`, `mkcp-legacy`, `header-custom`, `xdns`, `xicmp`, `noise`, `sudoku`, `realm`; plus QUIC params (`internal/sub/service.go:2485-2501`). Documented at [docs.sanaei.dev/docs/config/transports](https://docs.sanaei.dev/docs/config/transports) — *"FinalMask replaces the per-transport `header`/`seed` obfuscation that older Xray builds exposed"* (`docs/content/docs/en/config/transports.mdx:135`). **ALPN** is not missing either: per inbound under TLS (`frontend/src/pages/inbounds/form/security/tls.tsx:274`), emitted to share links as `alpn=` (`internal/sub/service.go:1262-1263`) and into JSON profiles (`internal/sub/json_service.go:710`), with the per-host value overriding it (`internal/sub/service.go:1900`). One caveat about v2rayNG/v2rayN specifically: on base64/raw subscriptions FinalMask travels as the compact `fm=<json>` field, described in the source as *"the compact `fm=<json>` share-link field used by v2rayN-compatible clients"* (`internal/sub/service.go:2635-2636`). The panel emits it regardless; whether a given client applies it depends on that client's Xray core version. The JSON subscription format is the reliable carrier. ### The one part that genuinely does not exist The **legacy `freedom`-outbound** form of fragment/noise (`outbounds[].settings.fragment` / `settings.noises`) inside the generated client profile. The JSON template ships a fixed `direct` outbound with `"noises": []` (`internal/sub/default.json:47-56`) and nothing populates it — no Go file under `internal/` references `noises` at all — while `sockopt` is stripped from the proxy outbound (`delete(streamSettings, "sockopt")`, `internal/sub/json_service.go:650`). Those two fields are exposed only for the panel's *own* server-side outbounds (`frontend/src/schemas/protocols/outbound/freedom.ts:57-58`). So one question, and it decides whether anything is left to build here: 1. When you say "Fragment values, Noise packets", do you mean the FinalMask masks described above (already available), or the older `freedom`-outbound `fragment`/`noises` block that clients like v2rayNG expose in their own settings? If it's the latter, this stays open as a narrow request; if FinalMask covers you, the three switches above work today. The global switch landed in `97f88fb1` *"feat(sub): modern xray JSON format with unified finalmask editor (#4912)"* (2026-06-05), first released in **v3.2.8** and present in **v3.7.0**. For the maintainer: `docs/content/docs/en/config/subscription.mdx` covers the subscription formats but never mentions the Sub Formats → Final Mask / Mux injection — FinalMask is only documented in `config/transports.mdx`, so this capability is easy to miss. Related earlier requests, both closed: #5075, #3203. Verdict: Already fixed *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4360
No description provided.