macula_peering_conn (macula v3.13.0)

View Source

Per-peer connection state machine.

Implements the lifecycle from Part 4 §10 simplified for Phase 1: no REFRESH phase, no RECONNECTING — just enough to exchange signed CONNECT/HELLO frames and drain on GOODBYE.

State graph:

    client: connecting  handshaking  connected  draining  (terminate)
    server: awaiting_start  handshaking  connected  draining  (terminate)
  

Summary

Types

connect_opts/0

-type connect_opts() ::
          #{host := binary() | string(),
            port := inet:port_number(),
            alpn => [binary()],
            timeout_ms => timeout(),
            _ => _}.

opts/0

-type opts() ::
          #{role := client | server,
            identity := macula_identity:key_pair(),
            realms := [macula_identity:pubkey()],
            capabilities := non_neg_integer(),
            controlling_pid := pid(),
            target => connect_opts(),
            quic_conn => reference()}.

Functions

awaiting_start(EventType, Old, Data)

callback_mode()

code_change(OldVsn, State, Data, Extra)

connected(EventType, Old, Data)

connecting(EventType, Old, Data)

draining(EventType, Old, Data)

handshaking(EventType, Old, Data)

init(Opts)

start_link(Opts)

-spec start_link(opts()) -> {ok, pid()} | {error, term()}.

terminate(Reason, State, Data)