Expand description
Length-delimited message encoding/decoding for peer communication.
Provides PeerMessageCodec which encodes messages with a 4-byte big-endian
length prefix and an optional CRC32 checksum for integrity verification.
§Wire Format
+-------------------+-------------------+--------------------+
| Length (4 bytes) | Payload (N bytes) | CRC32 (4 bytes) |
| big-endian u32 | | (optional) |
+-------------------+-------------------+--------------------+The length prefix encodes the payload size only (not including itself or the checksum). When checksums are enabled, the CRC32 is computed over the payload bytes and appended after the payload.
Structs§
- Codec
Config - Configuration for
PeerMessageCodec. - Codec
Stats - Cumulative codec statistics.
- Encoded
Message - Metadata about an encoded message.
- Peer
Message Codec - Length-delimited message codec with optional CRC32 integrity checking.
Enums§
- Codec
Error - Errors returned by
PeerMessageCodecencode/decode operations.