ipc

package
v0.1.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const SocketName = "v1.sock"

SocketName is the modern API socket inside a state directory.

Variables

View Source
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.

View Source
var ErrServing = errors.New("another daemon is serving this state directory")

ErrServing reports that another daemon already answers on the socket.

Functions

func Absent

func Absent(dir string) bool

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

func Dial(ctx context.Context, dir string) (net.Conn, error)

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.

func IsAlias

func IsAlias(path string) bool

IsAlias reports whether path is a symlink of the shape this package creates.

func Path

func Path(dir string) string

Path is the socket the CLI dials for the given state directory.

func Resolve

func Resolve(path string) (string, error)

Resolve follows only the symlink shape this package creates: a link to `<alias>/<name>.sock` inside a `continuum-ipc-*` directory directly under a temp root. Any other link is refused rather than followed.

Types

type Listener

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

Listener is the daemon's socket plus whatever it had to create to bind it.

func Listen

func Listen(dir string) (*Listener, error)

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

func ListenPath(path string) (*Listener, error)

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.

func (*Listener) Alias

func (l *Listener) Alias() string

Alias is the short private directory the socket was bound in, or "" when the state path itself was short enough.

func (*Listener) Close

func (l *Listener) Close() error

Close stops listening and removes the socket (and alias) it created.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL