docs/pkg/ipcsocket.md

pkg/ipcsocket: endpoint plumbing

pkg/ipcsocket validates endpoint descriptions and opens raw network connections or listeners. It does not own daemon lifecycle, runtime paths, JSONL framing, handshakes, or typed RPC.

Wrong page?

How do I describe an endpoint?

RoleSurfaceResponsibility
Endpoint descriptionAddress and Unix(path)Select a network and supply its Unix Path or TCP Addr
Outbound establishmentDial(ctx, address, timeout)Validate and return a raw net.Conn
Inbound establishmentListen(address)Validate and return a raw net.Listener

What do Dial and Listen guarantee?

Validation precedes establishment. Dial's timeout bounds connection establishment only, not a later protocol handshake or traffic. Returned connections and listeners are caller-owned: callers close them and set any post-dial deadlines, framing, or handshake behavior.

Who owns the socket path and readiness?

This package receives an already-resolved endpoint. Runtime-directory policy and creation belong to service config; client readiness, hello/ack, and retry behavior belong to the shared frontend lifecycle and ezagentapi.

The daemon deliberately does not bind through ipcsocket.Listen: it uses a raw Unix listener to handle stale paths and carry one listener through bootstrap to the ready server. A successful Dial therefore only establishes transport; it cannot establish that the daemon is ready.

Where is the detail authority?

NeedSource or test
Address selection, validation, dial/listen wrappingipcsocket.go
Unix round trip and validation casesipcsocket_test.go
Client endpoint resolution and readiness deadlinesinternal/frontend/lifecycle.go
Daemon probing, stopping, bootstrap binding, and handoffpkg/service/daemon.go, server.go

What must remain true when editing?

Keep this package protocol-free. Do not infer listener support for every accepted address family from the validated endpoint form; the focused tests demonstrate ordinary Unix-stream dialing and listening.