Skip to main content

Module connect

Module connect 

Source
Expand description

Dialling the daemon (blueprint §4.2, §7.2).

Local node listener on TCP 7408 (loopback) and a Unix domain socket ($XDG_RUNTIME_DIR/astrs/daemon.sock) — UDS preferred, TCP fallback.

The node tries every endpoint its configuration names, in order, and keeps every failure: “connection refused on the Unix socket” and “no route to host on the TCP fallback” are two different diagnoses, and an error that reports only the last one sends an operator to the wrong place.

§What this module produces

A NodeLink: a framed duplex whose halves are boxed trait objects, so a Unix socket, a TCP socket and the testing harness’s tokio::io::duplex pair are all the same type from here on. That is what lets crate::Node be one concrete type instead of being generic over its transport, and it is what makes the in-process mock daemon speak the real protocol rather than a stub of it.

Structs§

NodeLink
A live, greeted connection to the daemon.

Constants§

LINK_BUFFER_CAPACITY
The read-buffer capacity a node’s link starts with.

Functions§

dial
Dials the first endpoint that answers, then greets it.
dial_one
Dials exactly one endpoint.
fresh_counters
The counters a freshly wrapped link starts with, exposed so a caller can share one set across a reconnect.
node_handshake_params
The handshake parameters a node presents (§7.2).
wrap_stream
Wraps an already-open byte stream in the node link’s frame codec.

Type Aliases§

LinkDuplex
A framed duplex over a type-erased transport.
LinkReader
The read half of a node’s daemon link, type-erased.
LinkWriter
The write half of a node’s daemon link, type-erased.