mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5523] [Question]: Is there a way to automaticly set outbounds to inbound's listen address #3855
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#3855
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 @herotm on GitHub (Jun 23, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5523
What are you trying to do?
I have multiple nodes with multiple ip addresses, I understand the process of adding them manually via the Outbounds/Routing page to have them correspond to the Inbound ip.
Logging into multiple panels to do this manually is a bit Tedious, is there anyway this can be done easily to use outbound as its inbound.
What have you already tried?
No response
3x-ui version
3.4.0
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Screenshots or config snippets
No response
Before submitting
@github-actions[bot] commented on GitHub (Jun 23, 2026):
The panel has no built-in feature that automatically derives an outbound's bind address from an inbound's listen address. This was confirmed by reading
internal/web/service/xray.go,internal/xray/config.go, andinternal/database/model/model.go: the listen field on an inbound is used only to bind the listener socket and (optionally) to populate subscription share-links; it has no effect on outbound configuration.What the current architecture supports
The Xray template JSON (editable under Settings → Xray Settings) is passed through to Xray-core as-is. Xray-core's outbound objects accept a
sendThroughfield that pins the source IP for outgoing connections. Routing rules supportinboundTagas a match condition and can direct matched traffic to a specific outbound. Combining these two Xray-core primitives achieves the desired result:sendThroughset to that IP and a uniquetag:These edits are made directly in the Xray Settings JSON editor in the panel. The template is stored in the SQLite database and applied at Xray startup.
Automating this across multiple panels
The panel exposes a REST API. The relevant endpoints, relative to your panel's base path, are:
POST /panel/api/xray/— retrieves the current Xray template JSON (fieldxraySettingin the response)POST /panel/api/xray/update— saves a new template and restarts XrayAuthentication uses the same session cookie as the web UI; you can obtain a session by
POST /panel/api/loginwith{"username":"...","password":"..."}and pass the returnedSet-Cookiein subsequent requests.A script can therefore:
GETthe current template.sendThroughoutbound entries and routing rules into the JSON.POSTthe updated template back.The OpenAPI spec for the full API surface is served at
<base-path>/panel/api/openapi.jsonand accessible via the in-panel API docs page.Feature request note
If automatic derivation of outbound
sendThroughfrom an inbound's listen address is something you want the panel to handle natively, that would be a new feature. You are welcome to open a separate feature request with a clear description of the desired behaviour (e.g., a checkbox per-inbound to auto-create a matchingsendThroughoutbound).This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 3, 2026):
There is no built-in option that auto-derives an outbound's source IP from an inbound's listen address, but the panel supports this pattern directly: create one outbound per source IP with
sendThroughset (Xray → Outbounds), then add a routing rule matching each inbound's tag to the corresponding outbound (Xray → Routing).To avoid doing this by hand on every panel, the same configuration can be scripted over the REST API — each panel serves its OpenAPI spec at
/panel/api/openapi.json, and the Xray settings endpoints let you fetch the config, merge yoursendThroughoutbounds and routing rules, and push it back.If you'd like a native per-inbound "bind outbound to listen address" toggle, feel free to open a focused feature request for that. Closing this one as an answered usage question.