mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6435] [Feature]: Hide an inbound from subscription output without disabling it #4355
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#4355
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 @Motokichirou on GitHub (Sep 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6435
Problem
Subscription output emits one link per
(inbound, client)pair. In a multi-nodehigh-availability setup this produces duplicate, functionally identical endpoints that
clients do not need to see.
Scenario
A relay sits in front of two exit nodes. Failover happens at the relay (it rewrites its
forwarding target when an exit becomes unreachable), not in the client — because in a
whitelisted network the client has exactly one reachable entry point and cannot choose.
For that failover to be transparent, both exits must carry an identical REALITY identity:
same private/public key, same shortIds, same serverNames/target, same client UUIDs. Otherwise
switching breaks authentication instead of preserving it.
Since an inbound belongs to a single node (
node_id), covering two nodes requires two inboundsper identity. With two identities that is four REALITY inbounds, and the subscription therefore
contains four REALITY links where two would be enough — the node clones are pure duplicates from
the client's point of view.
Why the existing options don't help
Enable = falsehides the inbound from the subscription, but also stops it servingtraffic. Clients must stay attached to the clone for authentication to work after failover, so
this is not usable.
excludeFromSubTypesand anis_hiddencolumn, but those govern the extralinks a host contributes, not the inbound's own link.
Inboundmodel hasEnable,SubSortIndex,ShareAddrStrategy,ShareAddrandDisableFlow— there is no equivalent visibility switch.Proposal
A per-inbound boolean, e.g.
hideFromSub/excludeFromSub, that keeps the inbound fullyoperational (Xray config, client auth, traffic accounting) while omitting its links from
subscription output.
This mirrors what hosts already have, and would let operators keep redundant backing inbounds
for failover without cluttering what end users see.
Workarounds considered
SubSortIndexonly reorders links, it cannot remove them.central management, node sync and traffic accounting — which is the reason to use nodes at all.
Version
Panel 3.7.0, Xray 26.7.28, SQLite backend, one master + one node.
@github-actions[bot] commented on GitHub (Sep 8, 2026):
Your reading of the code is correct: there is no per-inbound subscription-visibility switch on the default branch,
Enableis the only per-inbound gate the subscription honours, and hosts cannot substitute for one. This is a valid feature request. There is also a workaround that works today without any code change — it is at the bottom.What the source says
1. The inbound set is chosen by exactly two conditions.
getInboundsBySubId(internal/sub/service.go:577) is the only place that decides which inbounds a subscription contains:internal/sub/service.go:585-588Protocol, and
enable. Nothing else. Your list ofInboundfields is complete —SubSortIndex(internal/database/model/model.go:54),Enable(:55),ShareAddrStrategy/ShareAddr(:71-72) andDisableFlow(:74) are all there is, and none of them removes a link.2. Hosts genuinely cannot do it, for the reason you suspected plus one more.
hostEndpointsfilters onis_disabledandExcludeFromSubTypes(internal/sub/host_sub.go:22,:34), but every caller falls back to the plain inbound link when the filtered list comes back empty:internal/sub/service.go:411-415; same shape atinternal/sub/json_service.go:97-99andinternal/sub/clash_service.go:53-55So excluding an inbound's every host from
raw,jsonandclashdoes not silence the inbound — it just makes it emit its own link instead. That fallback is deliberate and documented in the function comment atinternal/sub/host_sub.go:13-18("preserving byte-identical output for zero-host inbounds"), so it is not a bug to be exploited.3.
Host.IsHiddenis not the analogue you thought it was. The column exists (internal/database/model/model.go:1073) and is mapped in both directions (internal/web/service/host.go:39,:126), but no subscription renderer reads it —hostEndpointsfilters onis_disabledonly — and the host form carries it purely as a default value (frontend/src/pages/hosts/HostFormModal.tsx:50) with no control bound to it. It is stored and currently unused.Workaround available today
Because the join is on
clients.sub_id, an inbound whose clients all carry a differentsubIdnever enters the loop at all —matchingClientsreturns nothing and the inbound is skipped atinternal/sub/service.go:398-401.The catch you have hit is that
SubIDlives on the client row (ClientRecord.SubID,internal/database/model/model.go:919), andclient_inbounds(:998-1005) attaches one identity to many inbounds — so attaching the same client to both the primary and the standby inbound necessarily shares onesubId.So instead of attaching the same client, give the standby clone its own client row carrying the same credential:
fillProtocolDefaultsonly mints a fresh one when it is empty (internal/web/service/client_crud.go:387-390). Do the same forpassword/authon Trojan/Shadowsocks/Hysteria.email(that column isuniqueIndex,internal/database/model/model.go:918) and let the panel generate itssubId— reusing the primary's is rejected withsubId already in use(internal/web/service/client_crud.go:192-201).The standby then keeps serving with an identical REALITY identity and the UUID your relay's failover depends on, while contributing nothing to the user's subscription.
Trade-offs, so you can judge whether it is worth it:
internal/sub/service.go:601-607indexes stats bysub_id). Limits have to be maintained in two places.subId, which is exactly the case that produces the duplicate link.I derived this from the query and validation code above; I cannot run the panel here, so I have not exercised it through the UI.
For the maintainer
The request is one boolean and one clause. The gate is a single
WHEREatinternal/sub/service.go:585-588; adding a column would also need a hand-written migration ininternal/database/db.goper the repo's DB rules. Nothing about the ask conflicts with the existing host-levelExcludeFromSubTypesdesign — as the reporter notes, that axis governs the extra endpoints a host contributes, not whether the inbound itself is advertised. Related, not a duplicate: #4945 (disabled nodes still appearing in subscriptions) — different trigger, and it wants the inbound stopped, not kept alive.I have labelled this
enhancement. No searched issue shares this root cause, so it stays open.Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.