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.
ProtocolFlags
Bit flags describing how a protocol takes part in handshake and discovery. Combine with |. empty() means the protocol is negotiated but neither required nor advertised.
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).

Traits§

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

Type Aliases§

ProtocolConstructor
Boxed protocol constructor stored in the peer pool. Built by Node::attach_protocol from the user’s Fn(PeerConn) -> P closure. karyon calls it once per connected peer with a typed PeerConn scoped to this protocol.
ProtocolID