[GH-ISSUE #4429] Feature request: support Unix domain socket path in inbound Listen field #3024

Closed
opened 2026-10-31 20:29:34 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @w3struk on GitHub (May 16, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4429

No

Describe the solution you'd like

Currently, the inbound Listen field only accepts IP addresses. Unix socket support would enable architectures where Caddy (or another reverse proxy) communicates with Xray via local sockets instead of TCP 127.0.0.1:<port>. This is useful for:

  1. Security — no TCP port listening at all (even localhost), access controlled by filesystem permissions
  2. Performance — avoids TCP stack overhead for local IPC
  3. Architecture parity with Reality fallback — Xray already uses Unix sockets for fallback dest ("dest": "/run/xray/xhttp_in.sock") and for realitySettings.target. It's inconsistent that the listen field of an inbound cannot use the same mechanism.

Describe alternatives you've considered

No response

Checklist

  • This feature report is written entirely in English.
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 `Listen` field only accepts IP addresses. Unix socket support would enable architectures where Caddy (or another reverse proxy) communicates with Xray via local sockets instead of TCP `127.0.0.1:<port>`. This is useful for: 1. **Security** — no TCP port listening at all (even localhost), access controlled by filesystem permissions 2. **Performance** — avoids TCP stack overhead for local IPC 3. **Architecture parity with Reality fallback** — Xray already uses Unix sockets for `fallback` dest (`"dest": "/run/xray/xhttp_in.sock"`) and for `realitySettings.target`. It's inconsistent that the `listen` field of an inbound cannot use the same mechanism. ### Describe alternatives you've considered _No response_ ### Checklist - [x] This feature report is written entirely in English.
bsakaguchi 2026-10-31 20:29:34 +07:00
Author
Owner

@MHSanaei commented on GitHub (Jun 1, 2026):

Implemented. Unix domain socket paths in the inbound Listen field 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 bind listen (resolveInboundAddress), even rewriting @-socket fallback children to the master's listen. The only gap was the frontend resolveAddr, 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 ,perm suffix) 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 Listen to the socket path (e.g. /run/xray/in.sock, optionally /run/xray/in.sock,0666) and Port to 0, then front it with Caddy/another reverse proxy. Thanks for the well-reasoned request.

<!-- gh-comment-id:4597056286 --> @MHSanaei commented on GitHub (Jun 1, 2026): Implemented. Unix domain socket paths in the inbound `Listen` field 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 bind `listen` (`resolveInboundAddress`), even rewriting `@`-socket fallback children to the master's listen. The only gap was the frontend `resolveAddr`, 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 `,perm` suffix) 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 `Listen` to the socket path (e.g. `/run/xray/in.sock`, optionally `/run/xray/in.sock,0666`) and `Port` to 0, then front it with Caddy/another reverse proxy. Thanks for the well-reasoned request.
Author
Owner

@w3struk commented on GitHub (Jun 3, 2026):

https://github.com/user-attachments/assets/6d3b754a-7a26-4a9d-b76c-7da55791087f

@MHSanaei please take a look

<!-- gh-comment-id:4609772113 --> @w3struk commented on GitHub (Jun 3, 2026): https://github.com/user-attachments/assets/6d3b754a-7a26-4a9d-b76c-7da55791087f @MHSanaei please take a look
Author
Owner

@MHSanaei commented on GitHub (Jun 3, 2026):

Read the example
Should start with /

<!-- gh-comment-id:4612037260 --> @MHSanaei commented on GitHub (Jun 3, 2026): Read the example Should start with /
Author
Owner

@w3struk commented on GitHub (Jun 4, 2026):

Read the example Should start with /

Thanks for the UDS support work. I think there is one remaining edge case for Linux abstract Unix sockets (@name).

Repro

  1. Add/edit an inbound that listens on an abstract UDS, for example XHTTP behind Caddy.
  2. Set Listen to @uds_xhttp.
  3. Try to set Port to 0.

Actual behavior

The form still treats @uds_xhttp as a normal TCP listen value, so the port input minimum remains 1. A dummy non-zero port works because xray-core ignores the port for UDS listeners, but this is misleading and inconsistent with
filesystem UDS behavior.

Code references

The issue seems localized to the inbound form:

Other code paths already treat both filesystem and abstract UDS as UDS:

The generic inbound port validation already allows 0, so this does not look like a backend validation issue:

Expected behavior

Listen values starting with / or @ should both be treated as Unix Domain Socket inbounds by the form, so Port: 0 is accepted for both:

  • filesystem UDS: /run/xray/in.sock
  • abstract UDS: @uds_xhttp

A minimal fix may be to change the form-side detection to something equivalent to:

const isUdsListen = wListen.startsWith('/') || wListen.startsWith('@');

and add a regression test for listen = '@xray-abstract' with port = 0.

<!-- gh-comment-id:4620925099 --> @w3struk commented on GitHub (Jun 4, 2026): > Read the example Should start with / Thanks for the UDS support work. I think there is one remaining edge case for Linux abstract Unix sockets (`@name`). ### Repro 1. Add/edit an inbound that listens on an abstract UDS, for example XHTTP behind Caddy. 2. Set `Listen` to `@uds_xhttp`. 3. Try to set `Port` to `0`. ### Actual behavior The form still treats `@uds_xhttp` as a normal TCP listen value, so the port input minimum remains `1`. A dummy non-zero port works because xray-core ignores the port for UDS listeners, but this is misleading and inconsistent with filesystem UDS behavior. ### Code references The issue seems localized to the inbound form: - `InboundFormModal.tsx` defines `isUdsListen` as `wListen.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.ts` checks both `/` and `@` in `isUnixSocketListen()`: https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/lib/xray/inbound-link.ts#L753-L766 - `sub/subService.go` also 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 `InboundPortSchema` allows `min(0)`: https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/schemas/primitives/port.ts#L3-L6 - Go `model.Inbound.Port` allows `gte=0`: https://github.com/MHSanaei/3x-ui/blob/main/database/model/model.go#L56-L58 ### Expected behavior `Listen` values starting with `/` or `@` should both be treated as Unix Domain Socket inbounds by the form, so `Port: 0` is accepted for both: - filesystem UDS: `/run/xray/in.sock` - abstract UDS: `@uds_xhttp` A minimal fix may be to change the form-side detection to something equivalent to: ```ts const isUdsListen = wListen.startsWith('/') || wListen.startsWith('@'); ``` and add a regression test for listen = '@xray-abstract' with port = 0.
Author
Owner

@CursedSisyphus commented on GitHub (Jun 9, 2026):

please add support for abstract uds

<!-- gh-comment-id:4665089122 --> @CursedSisyphus commented on GitHub (Jun 9, 2026): please add support for abstract uds
Author
Owner

@w3struk commented on GitHub (Jun 10, 2026):

Read the example Should start with /

Thanks for the UDS support work. I think there is one remaining edge case for Linux abstract Unix sockets (@name).

Repro

1. Add/edit an inbound that listens on an abstract UDS, for example XHTTP behind Caddy.

2. Set `Listen` to `@uds_xhttp`.

3. Try to set `Port` to `0`.

Actual behavior

The form still treats @uds_xhttp as a normal TCP listen value, so the port input minimum remains 1. A dummy non-zero port works because xray-core ignores the port for UDS listeners, but this is misleading and inconsistent with filesystem UDS behavior.

Code references

The issue seems localized to the inbound form:

* `InboundFormModal.tsx` defines `isUdsListen` as `wListen.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.ts` checks both `/` and `@` in `isUnixSocketListen()`:
  https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/lib/xray/inbound-link.ts#L753-L766

* `sub/subService.go` also 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 `InboundPortSchema` allows `min(0)`:
  https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/schemas/primitives/port.ts#L3-L6

* Go `model.Inbound.Port` allows `gte=0`:
  https://github.com/MHSanaei/3x-ui/blob/main/database/model/model.go#L56-L58

Expected behavior

Listen values starting with / or @ should both be treated as Unix Domain Socket inbounds by the form, so Port: 0 is accepted for both:

* filesystem UDS: `/run/xray/in.sock`

* abstract UDS: `@uds_xhttp`

A minimal fix may be to change the form-side detection to something equivalent to:

const isUdsListen = wListen.startsWith('/') || wListen.startsWith('@');

and add a regression test for listen = '@xray-abstract' with port = 0.

@MHSanaei

<!-- gh-comment-id:4667176915 --> @w3struk commented on GitHub (Jun 10, 2026): > > Read the example Should start with / > > Thanks for the UDS support work. I think there is one remaining edge case for Linux abstract Unix sockets (`@name`). > ### Repro > > 1. Add/edit an inbound that listens on an abstract UDS, for example XHTTP behind Caddy. > > 2. Set `Listen` to `@uds_xhttp`. > > 3. Try to set `Port` to `0`. > > > ### Actual behavior > > The form still treats `@uds_xhttp` as a normal TCP listen value, so the port input minimum remains `1`. A dummy non-zero port works because xray-core ignores the port for UDS listeners, but this is misleading and inconsistent with filesystem UDS behavior. > ### Code references > > The issue seems localized to the inbound form: > > * `InboundFormModal.tsx` defines `isUdsListen` as `wListen.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.ts` checks both `/` and `@` in `isUnixSocketListen()`: > https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/lib/xray/inbound-link.ts#L753-L766 > > * `sub/subService.go` also 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 `InboundPortSchema` allows `min(0)`: > https://github.com/MHSanaei/3x-ui/blob/main/frontend/src/schemas/primitives/port.ts#L3-L6 > > * Go `model.Inbound.Port` allows `gte=0`: > https://github.com/MHSanaei/3x-ui/blob/main/database/model/model.go#L56-L58 > > > ### Expected behavior > > `Listen` values starting with `/` or `@` should both be treated as Unix Domain Socket inbounds by the form, so `Port: 0` is accepted for both: > > * filesystem UDS: `/run/xray/in.sock` > > * abstract UDS: `@uds_xhttp` > > > A minimal fix may be to change the form-side detection to something equivalent to: > > const isUdsListen = wListen.startsWith('/') || wListen.startsWith('@'); > > and add a regression test for listen = '@xray-abstract' with port = 0. @MHSanaei
Author
Owner

@MHSanaei commented on GitHub (Jun 10, 2026):

@w3struk ok

<!-- gh-comment-id:4667183883 --> @MHSanaei commented on GitHub (Jun 10, 2026): @w3struk ok
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3024
No description provided.