feat(config): add fallback destination mapping #1963
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
xray_config.jsonmay contain “virtual” inbounds that listen on pseudo addresses@...and must inherit port and Reality settings from a parent inbound (the one that owns afallbacks.dest). Stock Marzban could inherit only from a single global fallback (XRAY_FALLBACKS_INBOUND_TAG), so such schemes failed: inbounds without their ownport/realitySettingswere dropped or produced TCP‑Reality instead of XHTTP‑Reality.What changed
fallback_dest -> inboundinapp/xray/config.py, built fromsettings.fallbacks.dest.port, we now first look up a parent bylisten(e.g.,@child-xhttp→ fallback withdest: "@child-xhttp"); only if none is found do we use the oldXRAY_FALLBACKS_INBOUND_TAG.security/realitySettingsare also inherited from the found parent; the inbound keeps its ownnetwork(xhttp/ws/…).Why it’s useful
vless://…?type=xhttp&security=reality&pbk=…&sid=…for inbounds that don’t listen on a real port and sit on an@alias.xray_config.jsonwithout sacrificing any of them.Safety
portandlistenstarts with@; others are untouched.XRAY_FALLBACKS_INBOUND_TAGstill wins if present.port.What becomes possible
@alias” yields an XHTTP+Reality link with port/PBK/SID inherited automatically.Mini config example
{ "inbounds": [ { "tag": "PARENT-REALITY", "port": 1443, "protocol": "vless", "settings": { "decryption": "none", "fallbacks": [ { "dest": "@child-xhttp" } ] }, "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "publicKey": "PBK", "shortIds": ["abcd1234"] } } }, { "tag": "CHILD-XHTTP", "listen": "@child-xhttp", "protocol": "vless", "settings": { "decryption": "none" }, "streamSettings": { "network": "xhttp", "xhttpSettings": { "path": "/home" } } } ] }Result:
CHILD-XHTTPinherits port andrealitySettingsfromPARENT-REALITY; the generated link containstype=xhttp&security=reality&pbk=PBK&sid=abcd1234.For reference, a typical XHTTP+Reality setup can be seen here: https://github.com/chika0801/Xray-examples/tree/main/VLESS-XHTTP-REALITY/steal_oneself
What to verify
listen: "@alias"and noportreceives port/TLS/PBK/SID from the parent whosefallbacks.dest == "@alias".security=reality,pbk,sid, correct port, and preserves itsnetwork(ws/xhttp/etc.).XRAY_FALLBACKS_INBOUND_TAGstill work unchanged.Environment/frontend notes
XRAY_FALLBACKS_INBOUND_TAGcan be left empty if inheritance is driven byfallbacks.dest.