Skip to content

Bind to Unix domain socket with a file descriptor #2119

@xadenryan

Description

@xadenryan

I would like to be able to bind to a Unix domain socket with a file descriptor instead of binding the to host and port.

Looks like bun can do this: https://bun.com/docs/api/http#unix-domain-sockets

I think all we have to do is change the bun server binding to support the unix param.

My use case is for spinning up thousands of opencode instances in isolation so they can be tested in parallel without any shared state. I have a parser that parses out the message that prints the host and port that it currently binds to but this is flaky and I have to update it every time the text changes. It would be better if I can specify a file descriptor to the unix: param, then I don't have to go through the IP stack either.

Review of what needs to change in the Bun.serve call: https://opencode.ai/s/s7yqFUTh

Discord conversation: https://discord.com/channels/1391832426048651334/1394667004979445931/1407782275881631754

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions