Skip to main content

Module protocol

Module protocol 

Source
Expand description

Defines the protocol trait. Read More

Modules§

peer_conn 🔒

Structs§

PeerConn
Per-protocol view of a Peer with the protocol id baked in. Built by karyon and handed to the protocol constructor. Hides the underlying proto_id routing so user code never types it.
ProtocolMeta
Per-protocol metadata stored in the peer pool.

Enums§

ProtocolEvent
Protocol event used internally by karyon. User code reads messages via PeerConn::recv which yields Vec<u8> directly and surfaces shutdown as Err(PeerShutdown).
ProtocolKind
Whether a protocol is required for handshake / discovery to consider a peer compatible.

Traits§

Protocol
The Protocol trait defines the interface for core protocols and custom protocols.

Type Aliases§

ProtocolConstructor
User-supplied constructor handed to Node::attach_protocol. karyon calls it once per connected peer with a typed PeerConn scoped to this protocol. Capture whatever shared state the protocol needs in the closure.
ProtocolID