Modules
Public API for the PeerNet library and the per-instance supervisor.
TCP listener for one PeerNet instance. Accepts inbound connections and
spawns one PeerNet.Connection per accepted socket.
Convenience layer that gives a specifically-trusted peer
BEAM-distribution-like RPC access — apply(mod, fun, args) over the
PeerNet wire, with the peer's identity verified cryptographically.
Post-handshake transport: ChaCha20-Poly1305 AEAD over the same Frame layer used during the handshake.
Per-direction AEAD key + counter. Treat as opaque; mutate only via
PeerNet.Channel.encrypt/2 and PeerNet.Channel.decrypt/2 (which
return updated structs).
One connection to one peer — a GenServer that owns a TCP socket, drives
the PeerNet.Handshake to completion, and then multiplexes
:call/:reply/:send envelopes over the wire.
DynamicSupervisor for live PeerNet.Connection processes.
Behaviour for discovering peers on a network.
No-op discovery implementation — exposes inject points so tests and manually-configured setups can drive discovery events at will.
LAN UDP-broadcast discovery. Each instance
Behaviour for the UDP transport used by PeerNet.Discovery.UDP.
Production transport for PeerNet.Discovery.UDP — wraps Erlang
:gen_udp with broadcast enabled.
Compact wire format for UDP-broadcast peer announcements.
Wire framing for PeerNet — length-prefixed Erlang Term Format payloads with safety guards against malformed or hostile input.
Default-deny registry of named, peer-callable handlers.
Mutual-authentication handshake for PeerNet — implementation of the Noise
protocol's XX pattern with the suite
Noise_XX_25519_ChaChaPoly_SHA256.
Cryptographic identity for a PeerNet node — an X25519 keypair that uniquely identifies one peer to all the others.
Application-level heartbeat for one peer connection.
Behaviour for noticing when this host's network situation changes — primarily, when the set of local IP addresses gains or loses entries.
Default PeerNet.NetworkMonitor implementation. Polls
:inet.getifaddrs/0 on a configurable interval (default 5 seconds)
and notifies subscribers when the local IP set changes.
Per-instance registry of peer state — pubkey → {connection, last-seen address, status} — plus the auto-connect dispatcher.
Persistent allowlist of peer public keys this node will talk to.