Skip to content

feat: add unix domain socket listener support to port option#1932

Open
benmcclelland wants to merge 1 commit intomainfrom
ben/uds-listener
Open

feat: add unix domain socket listener support to port option#1932
benmcclelland wants to merge 1 commit intomainfrom
ben/uds-listener

Conversation

@benmcclelland
Copy link
Member

This adds the ability to specify unix domain socket paths for the service listener with the --port option. Where can be either a path to a file in a filesystem or prefixed with @ for an abstract socket name.

@benmcclelland benmcclelland requested a review from niksis02 March 5, 2026 16:23
&cli.StringSliceFlag{
Name: "port",
Usage: "gateway listen address <ip>:<port> or :<port> (can be specified multiple times for listening on multiple addresses)",
Usage: "gateway listen address: <ip>:<port>, :<port>, /path/to/socket for file-backed UNIX sockets, or @name for Linux abstract namespace sockets (can be specified multiple times for listening on multiple addresses)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update example.conf to add info about unix sockets ?

// For file-backed sockets, remove any stale file so re-binding works cleanly.
// Abstract sockets (@name) have no filesystem entry; skip os.Remove for them.
if !isAbstractSocket(address) {
os.Remove(address)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably also need to verify that it's fs.ModeSocket that's being removed, someone might accidentally use it as an rm 😄

// - "@name" — Linux abstract namespace socket (no filesystem entry)
func IsUnixSocketPath(addr string) bool {
return strings.HasPrefix(addr, "/") ||
strings.HasPrefix(addr, "./") ||
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the relative path seems to be a problematic use-case: with posix backend the CWD is set to the data directory before the listener is initialized, so the socket is being created there instead of the CWD of the shell invoking the gateway startup

This adds the ability to specify unix domain socket paths for the
service listener with the --port <path> option. Where <path> can
be either a path to a file in a filesystem or prefixed with @ for
an abstract socket name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants