Documentation ¶
Overview ¶
Serves a file descriptor over an AF_UNIX socket when presented with a nonce.
You must pass the socket path and nonce to the client via some out-of-band mechanism, such as gRPC or a bash script.
Notes: - Uses the unix domain socket abstract namespace - Picks its own path in the abstract namespace for the socket. - Shared FDs are essentially duped, and they point to the same struct file: they share offsets and whatnot.
Options: - WithServeOnce: serve once and shuts down (default is forever) - WithTimeout: cancel itself after a timeout (default none)
Usage Server:
fds, err := NewServer(fd_to_share, "some_nonce", WithServeOnce()) var s path = fds.UDSPath() // Pass path and some_nonce to the client via an out of band mechanism fds.Serve(); // Blocks until the server is done fds.Close()
Usage Client:
sfd, err := GetSharedFD("uds_path", "some_nonce")
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetSharedFD ¶
GetSharedFD gets an FD served at udsPath with nonce
func WithServeOnce ¶
WithServeOnce sets the "serve once and exit" option to NewServer