Documentation
¶
Overview ¶
Package ipc names and opens the daemon's local API socket. The modern API lives on a Unix socket inside the private state directory: filesystem permissions are the credential boundary a local-first runtime already has, and no stale address file can ever point a client's bearer at a port that something else has since bound. The path carries the contract version so an older CLI meets no socket rather than a daemon it cannot talk to.
Index ¶
Constants ¶
const SocketName = "v1.sock"
SocketName is the modern API socket inside a state directory.
Variables ¶
var ErrForeignLink = errors.New("state socket path is a symlink this daemon did not create")
ErrForeignLink reports a symlink at the socket path that this package did not create. connect(2) follows symlinks, so such a link is never dialed: a client refuses, and the next daemon start replaces it.
var ErrServing = errors.New("another daemon is serving this state directory")
ErrServing reports that another daemon already answers on the socket.
Functions ¶
func Absent ¶
Absent reports whether no socket exists for the state directory at all, which tells a client the daemon was never started (or exited cleanly).
func Dial ¶
Dial connects to the state directory's API socket. A socket address must fit sockaddr_un as written, so when the daemon left a symlink to a short alias, the alias is what gets dialed.
Types ¶
type Listener ¶
Listener is the daemon's socket plus whatever it had to create to bind it.
func Listen ¶
Listen binds the state directory's API socket. A socket left behind by a crashed daemon is removed when nothing answers on it; a live daemon is refused. The socket file is private to the user.
func ListenPath ¶
ListenPath binds a private socket at path, with the same stale-clearing, live-refusal and long-path aliasing as the API socket. Block holders use it for their per-block sockets beside the API socket.