mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #4429] Feature request: support Unix domain socket path in inbound Listen field #3024
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#3024
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 @w3struk on GitHub (May 16, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4429
Is your feature request related to a problem?
No
Describe the solution you'd like
Currently, the inbound
Listenfield only accepts IP addresses. Unix socket support would enable architectures where Caddy (or another reverse proxy) communicates with Xray via local sockets instead of TCP127.0.0.1:<port>. This is useful for:fallbackdest ("dest": "/run/xray/xhttp_in.sock") and forrealitySettings.target. It's inconsistent that thelistenfield of an inbound cannot use the same mechanism.Describe alternatives you've considered
No response
Checklist
@MHSanaei commented on GitHub (Jun 1, 2026):
Implemented. Unix domain socket paths in the inbound
Listenfield are now fully supported. The core already worked — the listen string is passed to Xray verbatim and port 0 is accepted (since #4783), and the Go subscription/link layer deliberately ignores the bindlisten(resolveInboundAddress), even rewriting@-socket fallback children to the master's listen. The only gap was the frontendresolveAddr, which would emit the socket path as the host in share/sub links (e.g.vless://uuid@/run/xray/x.sock:0). It now treats a path-style listen (starting with/or@, optional,permsuffix) as having no client-reachable address and falls back to the node/host. Added a help hint under the Listen field across all locales.Usage: set
Listento the socket path (e.g./run/xray/in.sock, optionally/run/xray/in.sock,0666) andPortto 0, then front it with Caddy/another reverse proxy. Thanks for the well-reasoned request.@w3struk commented on GitHub (Jun 3, 2026):
https://github.com/user-attachments/assets/6d3b754a-7a26-4a9d-b76c-7da55791087f
@MHSanaei please take a look
@MHSanaei commented on GitHub (Jun 3, 2026):
Read the example
Should start with /
@w3struk commented on GitHub (Jun 4, 2026):
Thanks for the UDS support work. I think there is one remaining edge case for Linux abstract Unix sockets (
@name).Repro
Listento@uds_xhttp.Portto0.Actual behavior
The form still treats
@uds_xhttpas a normal TCP listen value, so the port input minimum remains1. A dummy non-zero port works because xray-core ignores the port for UDS listeners, but this is misleading and inconsistent withfilesystem UDS behavior.
Code references
The issue seems localized to the inbound form:
InboundFormModal.tsxdefinesisUdsListenaswListen.startsWith('/')only:https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/pages/inbounds/form/InboundFormModal.tsx#L163-L166
The port input then uses that boolean for
min={isUdsListen ? 0 : 1}:https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/pages/inbounds/form/InboundFormModal.tsx#L491-L497
Other code paths already treat both filesystem and abstract UDS as UDS:
inbound-link.tschecks both/and@inisUnixSocketListen():https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/lib/xray/inbound-link.ts#L753-L766
sub/subService.goalso excludes both@...and/...listens from advertised subscription addresses:https://github.com/MHSanaei/3x-ui/blob/main/sub/subService.go#L727-L734
The generic inbound port validation already allows
0, so this does not look like a backend validation issue:Frontend
InboundPortSchemaallowsmin(0):https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/schemas/primitives/port.ts#L3-L6
Go
model.Inbound.Portallowsgte=0:https://github.com/MHSanaei/3x-ui/blob/main/database/model/model.go#L56-L58
Expected behavior
Listenvalues starting with/or@should both be treated as Unix Domain Socket inbounds by the form, soPort: 0is accepted for both:/run/xray/in.sock@uds_xhttpA minimal fix may be to change the form-side detection to something equivalent to:
and add a regression test for listen = '@xray-abstract' with port = 0.
@CursedSisyphus commented on GitHub (Jun 9, 2026):
please add support for abstract uds
@w3struk commented on GitHub (Jun 10, 2026):
@MHSanaei
@MHSanaei commented on GitHub (Jun 10, 2026):
@w3struk ok