Skip to main content

Module protocol

Module protocol 

Source
Expand description

Wire frames shared between the bridge and the central server.

Both peers serialize ProtocolMessage with a fixed bincode configuration behind a length-delimited framing (the ProtocolWrite / ProtocolRead stream extensions). Two properties are fixed here for forward-compat (DESIGN.md §13), so later additions are additive rather than breaking:

  • a protocol-version field carried in ProtocolMessage::Hello and checked with negotiate_version; peers advertising an incompatible version are rejected,
  • an opaque encrypted-payload envelope + key-id (Payload::Encrypted), so end-to-end encryption (DESIGN.md §19) can be layered in without a wire break.

ProtocolError is the typed, wire-crossing error surfaced as a ProtocolMessage::Error frame; application glue elsewhere uses anyhow via the Res / Void aliases.

Structs§

ChannelInfo
A channel as surfaced by discovery (ProtocolMessage::ChannelList, DESIGN.md §6).
Envelope
An opaque end-to-end-encrypted payload envelope, reserved now for v2 (DESIGN.md §13, §19).
InviteInfo
An outstanding invite as surfaced by the channel-admin audit (ProtocolMessage::InviteList).
MachineInfo
An enrolled machine as surfaced by ProtocolMessage::MachineList (machine list, §5.1).

Enums§

AdminOp
An admin / moderation operation (DESIGN.md §7), authorized server-side by user role.
Payload
A message body: plaintext in v1, or the reserved E2E Envelope in v2.
ProtocolError
Errors that cross the wire as a ProtocolMessage::Error frame and are matched on by the server and bridge (DESIGN.md §16). Application glue elsewhere uses anyhow via Res / Void.
ProtocolMessage
The versioned frame exchanged between a bridge and a central server.

Traits§

ProtocolRead
Length-delimited receiving of protocol frames over any async reader.
ProtocolWrite
Length-delimited sending of protocol frames over any async writer.

Functions§

decode
Decodes a frame from its wire bytes with the fixed codec configuration.
encode
Encodes a frame to its wire bytes with the fixed codec configuration.
negotiate_version
Returns this build’s protocol version if theirs is compatible, else a ProtocolError::VersionMismatch.