Expand description
The CONNECT/HELLO handshake and the application-frame stream
abstraction, ported from src/peering/macula_peering_conn.erl
(macula-io/macula) — see plans/PLAN_WIRE_PROTOCOL.md §3.
Only the client role’s connecting -> handshaking -> connected path
is implemented. FrameStream is the reusable “send/receive signed
application frames on one QUIC stream” primitive — Session wraps
one for the control stream, and Session::open_dedicated_stream
hands out fresh ones for content transfer (§12) and streaming RPC
(§13), which both run on dedicated streams rather than the control
stream.
Structs§
- Frame
Stream - Session
- A completed, handshaked connection to a macula-station. Holds the open control stream (CONNECT/HELLO already exchanged) and the station’s identity as verified by the HELLO frame’s own signature.
Enums§
- Call
Error - Handshake
Error - Recv
Event Error - Recv
Frame Error - RunSubscriber
Error - Errors from
Session::run_subscriber. - Send
Frame Error - Serve
Call Error
Constants§
- DEFAULT_
CALL_ TIMEOUT - Default timeout for a single CALL awaiting its RESULT/ERROR. Not from
the reference source (macula’s own CALL timeout is caller-supplied
per-call via
deadline_msinside the frame itself, not a transport- level default) — a reasonable local default for this crate’s API. - HANDSHAKE_
TIMEOUT - Matches
HANDSHAKE_TIMEOUT_MSinmacula_peering_conn.erl: CONNECT -> HELLO is sub-second on a healthy peer; this is generous. The most common real-world trigger for hitting it is a protocol version mismatch — bytes accumulate but never form a valid frame, so the station-side symptom and this crate’s symptom are the same shape.
Functions§
- connect
- Dial
host:portand complete the full CONNECT/HELLO handshake: open a QUIC connection, open the control stream, send a signed CONNECT built fromidentity, and wait for a HELLO whose own signature verifies against the node_id it claims.
Type Aliases§
- BoxFuture
- A boxed,
'staticfuture — hand-rolled rather than pulling in thefuturescrate for one type alias. - Call
Handler - Answers one inbound CALL.
Ok(payload)sends a RESULT;Err(reason)sends an ERROR (BOLT#4unknown_error,detail = reason); a panic inside the handler (caught viatokio::spawn, the same “one transient task per call” shapemacula_station_link.erluses one process per call for) is sent as ERRORtemporary_relay_failure— matching that module’s ownsafe_invoke_handler/4mapping exactly (including sending nodetailon a crash, since the reference doesn’t either — it only logs locally).