mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6379] [Bug]: JSON subscription's mixed local inbound leaves iOS clients (Happ) connected with zero traffic #4327
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#4327
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?
Originally created by @Fiveloss on GitHub (Aug 31, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6379
Feature request
Please make the local
inboundsblock of the JSON subscription configurable — or simply change"protocol": "mixed"to"protocol": "socks"ininternal/sub/default.json.Why
The client-side balancer added in v3.7.0 is genuinely useful, but it is unusable for iOS users, because the whole JSON config is rejected there.
I run a small paid VPN service and tested the same subscription on three of my own devices:
On iOS this happens with every entry of the JSON subscription — the balancer and each individual inbound alike — so it is not related to the balancer, the outbound protocols, or DNS. The tunnel reports "connected" and no bytes ever move.
Root cause
internal/sub/default.json(embedded at compile time via//go:embedininternal/sub/json_service.go) declares:mixedis a comparatively new inbound protocol, and the Xray core shipped in the iOS client does not appear to route with it.None of the three JSON subscription settings can change this:
subJsonMuxaffects outbound mux,subJsonRulesprepends routing rules,subJsonFinalMaskmasks stream settings. Theinboundssection is not reachable from the panel at all.Prior reports
This has been raised twice already and closed without a fix:
The automated reply on #5342 confirmed there is no runtime mechanism for this and suggested opening an enhancement request instead. That is what this issue is.
For comparison
Remnawave's default Xray JSON subscription template declares the same kind of local inbound, but as classic
socks:Users report that its balancer works on the same iOS clients. The difference between the two templates is the inbound protocol, not the presence of the inbounds block.
Suggested fix
Either of these would solve it:
mixedtosocks(plus a separatehttpinbound) ininternal/sub/default.json— a one-line change with no downside I can see, since Windows and Android acceptsockstoo.subJsonInboundssetting so the inbounds block can be overridden per deployment.Option 1 alone would be enough for us.
Environment
@github-actions[bot] commented on GitHub (Aug 31, 2026):
Confirmed as a valid enhancement request: the local
inboundsblock of the JSON subscription is compiled into the binary and no runtime setting can change it, so what you are asking for genuinely does not exist today. Your reading of the code is accurate in every detail I checked. The one part I could not verify is the causal half — thatmixedis what stops traffic on iOS — see the last section, because it decides whether option 1 is actually the whole fix.What the code does today
The skeleton is embedded at compile time:
internal/sub/default.json:14-32is exactly what you quoted ("port": 10808,"protocol": "mixed","tag": "mixed",destOverrideincludingfakedns). The separatehttpinbound on 10809 that you list under option 1 already exists atdefault.json:33-40.All three places that assemble a document copy that map wholesale and replace only
outbounds,remarksand — for a balancer —routing:internal/sub/json_service.go:544-551:426-437(maps.Copy(newConfigJson, s.configJson), thennewConfigJson["outbounds"],["remarks"],["routing"]):142-146Nothing ever writes
newConfigJson["inbounds"], which is why the block is byte-identical in every entry — balancer and single inbound alike, matching what you observed.The four runtime knobs are
subJsonMux,subJsonRules,subJsonFinalMaskandsubJsonObservatory(internal/web/service/setting.go:118-121), applied inNewSubJsonService(json_service.go:37-66, rules are prepended at:53) andapplyGlobalFinalMask(:614). None of them reachesinbounds. The docs state the same: "a fixed skeleton (local mixed/HTTP inbounds, DNS, routing, policy)" —docs/content/docs/en/config/subscription.mdx:60.Where
mixedcame fromOne commit changed it, and only the two lines:
First released in v2.7.0 (tagged 2025-09-10). The same commit renamed the panel's own protocol enum (
Socks→Mixed,database/model/model.go) against xray-corev1.250905.0, andinternal/database/db.go:825-840still carries the matching DB migration. So your option 1 is a revert of that one hunk of the template, not a new behaviour.Three facts that make option 1 cheap, for whoever picks this up:
socksas an inbound protocol — the panel itself emits"protocol": "socks"inbounds into the live server config it hands to Xray atinternal/web/service/xray.go:484,:577,:683and:751;internal/subreferences the skeleton's inbound, and no routing rule ever names the inbound tag (default.json:79-88is{"type":"field","network":"tcp,udp","outboundTag":"proxy"}), so thetaghalf is cosmetic;internal/sub/default.jsonand the docs site's independent copy atdocs/lib/xray/subscription.ts:145-154— so a change that touches one and not the other silently drifts.Between your two options: option 1 is two files and no schema change; option 2 (
subJsonInbounds) adds a setting, a UI field, i18n keys across the 13 locale files ininternal/web/translation/, and validation of user-supplied JSON. That is triage information for the maintainer, not a decision I can make.What I could not verify, and the one test that would settle it
I cannot run a client, so I have no evidence either way that
mixedis what breaks Happ 5.6.0 on iOS. A second candidate lives in the same shared skeleton and would produce the identical "zero bytes on every entry" symptom: sniffing declares"destOverride": ["http","tls","quic","fakedns"](default.json:22-30) while thednsblock (:3-12) declares no fakedns server at all. That is an inference from reading the template, not something I confirmed.Since both live in the same block, one test separates them. Take the JSON body your panel serves, host it as a static file, point Happ iOS at that URL, and change one thing at a time:
"protocol": "mixed"→"protocol": "socks";"fakedns"removed fromdestOverride.If (1) moves bytes, your request is proven and the one-line change is the whole fix. If only (2) does, the template needs a different change and swapping to
sockswould not have helped. Please post which one worked — that result is the missing piece here, so I have added theclarification neededlabel; the request itself stands either way.The same edit is your stopgap in the meantime:
internal/sub/default.jsonis compiled in, so changing it means rebuilding the panel — or rewrite the served body at your reverse proxy, where replacing only the protocol value is enough.Related and all closed, same limitation: #4138, #5342, #5346.
Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.
@Fiveloss commented on GitHub (Aug 31, 2026):
Ran the test you asked for. Result:
mixedis the cause;fakednsis not.Method
Took the exact JSON body my panel serves for one subscription, hosted it as a static file over HTTPS, and pointed Happ 5.6.0 (iOS) at it. Three files, each differing from the control by one change, applied to all 7 entries:
"protocol": "mixed"→"protocol": "socks"only (tag left as"mixed")"fakedns"removed fromdestOverrideonlyA is the same size as the control because
mixedandsocksare both 5 characters — nothing else was touched. B is 161 bytes smaller, which is exactly the seven removed"fakedns"entries.Same device, same subscription, same session, tested one after another.
Conclusion
fakednschanges nothing, so the sniffing/dnsmismatch you spotted is not the blocker here (it may still be worth tidying, but it is not this bug).So option 1 from the issue — reverting
"protocol": "mixed"back to"socks"ininternal/sub/default.json(and the docs copy atdocs/lib/xray/subscription.ts) — is the whole fix, not a partial one. No new setting is needed for this case.Note that the
tagstayed"mixed"in the working variant, which matches your finding that the tag is cosmetic and referenced nowhere.Happy to run any further variation if it helps.
@github-actions[bot] commented on GitHub (Aug 31, 2026):
Your differential test settles it, so I am reclassifying this from an enhancement to a confirmed bug: the compiled-in
"protocol": "mixed"inbound is the blocker, and the two-file revert you propose is the whole fix — nosubJsonInboundssetting is needed for this case. I have swapped theenhancementlabel forbug, removedclarification needed, and retitled the issue to state the symptom rather than the requested mechanism (old title: "[Feature]: Make the JSON subscription inbound protocol configurable (mixed -> socks) so iOS clients work").I will not repeat the earlier analysis; everything in it still holds against the tip (
f727d04f, v3.7.0) —internal/sub/default.json:16still reads"protocol": "mixed",anddocs/lib/xray/subscription.ts:149still readsprotocol: 'mixed',.What your result adds, and one check I ran on it
I cannot run Happ or inspect which core it embeds, so the causal step is your device evidence, not mine. What I could check is whether your control file was really the panel's output, because the whole differential rests on that — and your byte arithmetic confirms it independently.
A multi-entry document is serialised at
internal/sub/json_service.go:165:Two-space indent from a top-level array puts
destOverrideelements six levels deep, i.e. 12 spaces. Removing one costs the preceding comma (1) + newline (1) + indent (12) +"fakedns"(9) = 23 bytes, and 23 × 7 entries = 161 — exactly the delta you measured. That is not evidence about iOS, but it does confirm the control was the panel's real 7-entry body and that file B differed from it in nothing else.Your point about the tag matches the source: the only routing rule in the skeleton is
{"type":"field","network":"tcp,udp","outboundTag":"proxy"}(internal/sub/default.json:82-86), which names an outbound tag, so the inboundtagis never referenced and leaving it as"mixed"changes nothing.Stopgap until this is addressed
Unchanged from before: the template is
//go:embed-ed at compile time (internal/sub/json_service.go:22-23), so either rebuild the panel with the value changed, or rewrite the served body at your reverse proxy — replacing only the protocol value, exactly as your file A did.Verdict: Confirmed bug
Severity: High
Confidence: Medium
Root cause:
internal/sub/default.json:16—"protocol": "mixed",in the local inbound of the JSON-subscription skeleton, embedded at compile time by//go:embed default.json(internal/sub/json_service.go:22-23). Every assembled document copies that skeleton and replaces onlyoutbounds,remarks,routingandburstObservatory(json_service.go:144-145,:428-434,:548-549), so the block is byte-identical in every entry — which is why the reporter sees zero traffic on the balancer and on each single inbound alike. Introduced by7dc52e9a"dokodemo-door, socks renamed to mixed, tunnel" (2025-09-09), which renamed the panel's own protocol enum (Socks→Mixed,internal/database/model/model.go:31, migration atinternal/database/db.go:825-840) and swept this client-side template along with it, although this block is consumed by third-party client cores rather than by the panel's own Xray. Triggering condition: a JSON subscription rendered on a client whose bundled core does not route with themixedinbound alias.Already fixed: Still present on the default branch —
7dc52e9ais the only commit that ever touched this value (git log -S '"protocol": "mixed"' -- internal/sub/default.json sub/default.json), first released in v2.7.0, and no merged PR since changes it.Duplicate of: None. Related: #4138 and #5342 (same request, both closed with no code change and no maintainer rationale recorded); this issue is the first with a controlled A/B result attached.
Evidence:
internal/sub/default.json:16"protocol": "mixed",and:31"tag": "mixed";internal/sub/json_service.go:22-23//go:embed default.json/var defaultJson string;json_service.go:165json.MarshalIndent(configArray, "", " ")(corroborates the reporter's 161-byte delta as 7 × 23); the onlynewConfigJson[...]writes in the file areoutbounds/remarks/routing/burstObservatoryat:144-145,:428-434,:548-549, soinboundsis never overwritten;socksremains a valid inbound protocol for the pinned core (go.mod:28github.com/xtls/xray-core v1.260327.1-...) because the panel emitsProtocol: "socks"inbounds into the live server config atinternal/web/service/xray.go:484,:577,:683,:751and matches on it at:808; nothing pins the template value — no test underinternal/subasserts the skeleton inbound (the onlymixedhits areremark_vars_test.go:161andremote_routing_test.go:455, both unrelated); second copy of the same skeleton atdocs/lib/xray/subscription.ts:145-154.Not determined: Whether the failure is
mixedbeing unknown to the client's core or being parsed but mis-handled — I cannot run Happ 5.6.0 or read which core it bundles, and the result comes from one device and one client version. The check that would settle it: the client-side Xray log from the failing run (an unknown-protocol error at config load versus a clean start with no inbound traffic).Suggested fix: revert the one hunk of
7dc52e9athat touched the client-side template —internal/sub/default.json:16and the independent docs copy atdocs/lib/xray/subscription.ts:149— leaving the panel's own protocol enum and its DB migration untouched. The separatehttpinbound on 10809 already exists (default.json:33-40), so no second inbound needs adding, and thetagcan stay as-is since nothing references it.@MHSanaei this one is a confirmed High-severity regression in JSON-subscription output, unfixed since v2.7.0, with a two-line revert as the fix.
This reply was generated automatically; a maintainer may follow up.
@dawNotPoi commented on GitHub (Sep 3, 2026):
I'd like to work on this. I'll change only the embedded JSON subscription inbound on port 10808 from the
mixedprotocol tosocks, keep its existingmixedtag and the separate HTTP inbound intact, mirror the runtime template in the docs implementation, and add focused Go and docs regression coverage for that compatibility contract.