Search documentation of macula

# macula_peering_conn (macula v4.4.9)

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
opts/0

## 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)
terminate(Reason, State, Data)

# 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(),
                accept_owner => pid(),
                dht_recipient => pid(),
                pubsub_recipient => pid(),
                timing_enabled => boolean()}.

# 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)