mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6691] [MERGED] fix(sub): keep serverNames out of a reality host's JSON client config #6414
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6414
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6691
Author: @FZ1010
Created: 9/30/2026
Status: ✅ Merged
Merged: 10/2/2026
Merged by: @MHSanaei
Base:
main← Head:fix/host-reality-sni-json📝 Commits (2)
1f5f458fix(sub): keep serverNames out of a reality host's JSON client confige2e3385docs(sub): keep the host reality SNI comments within two lines📊 Changes
2 files changed (+58 additions, -3 deletions)
View changed files
📝
internal/sub/host_sub.go(+2 -3)📝
internal/sub/host_sub_test.go(+56 -0)📄 Description
Summary
When a host with an SNI sits on a REALITY inbound, its client stream now gets only
serverName, so the JSON subscription no longer ships the server-sideserverNameslist, which Xray-core refuses.Why
Fixes #6690.
applyHostStreamOverridesset bothserverNameandserverNames, on the assumption that the JSONrealityDatareadsserverNameslater. But the JSON and Clash renderers both runstreamData→realityDatabefore the host overrides, so by then the stream is already in client form.serverNameswas never read, and it ended up in the JSON proxy outbound. Xray-core then refuses the whole config:This cuts off every JSON-subscription client (Happ, v2rayN/v2rayNG JSON mode, …) on an inbound whose host has an SNI. Share links were unaffected, and so was Clash: its renderer reads only
serverName, so it keeps working with the one key.Type of change
Areas affected
How was this tested?
New
TestSub_HostRealitySniJSONAndClash(internal/sub/host_sub_test.go). It seeds a REALITY inbound plus a host with an SNI, then checks that:realitySettings.serverNameis the host SNI;serverNameskey;servername: <host SNI>.It failed before the change (
serverNames [host.reality.com] leaked into the json reality client) and passes after.go test -shuffle=on -count=1 ./internal/sub/...andgo vet ./internal/sub/pass.End to end with real Xray-core: I rendered the same inbound + host through
GetJsonbefore and after the change and ranxray run -test -con each config with Xray 26.7.28 and 26.9.9:non-empty "serverNames", please use "serverName" insteadConfiguration OK.Screenshots / recordings
The new test on
main(red), then on this branch (green), plus the wholeinternal/subsuite:The same inbound + host rendered through
GetJsononmain(before.json) and on this branch (after.json), loaded with Xray-core 26.7.28 and 26.9.9:Breaking changes
None. Only the invalid
serverNameskey disappears from JSON subscriptions.Checklist
go build ./...and the test suite pass locally. (go build ./...needs the frontenddistembed; the changed package builds, vets and tests clean.)npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.