Expand description
NOMAD Protocol - Core traits, types, and constants.
This module provides the foundational traits and types for the NOMAD protocol. It has minimal dependencies and defines the core abstractions.
Enums§
- Apply
Error - Errors that can occur when applying a diff.
- Crypto
Error - Errors in the crypto layer.
- Decode
Error - Errors that can occur when decoding a diff.
- Nomad
Error - Top-level NOMAD errors.
- Sync
Error - Errors in the sync layer.
Constants§
- AEAD_
NONCE_ SIZE - XChaCha20 nonce size.
- AEAD_
TAG_ SIZE - Poly1305 authentication tag size.
- COLLECTION_
INTERVAL - Collection interval for batching rapid state changes.
- DATA_
FRAME_ HEADER_ SIZE - Data frame header size (type + flags + session_id + nonce).
- DEAD_
INTERVAL - Consider connection dead after this long without frames.
- DEFAULT_
COMPRESSION_ LEVEL - Default zstd compression level.
- DELAYED_
ACK_ TIMEOUT - Maximum delay for ack-only frame.
- EXT_
COMPRESSION - Extension type: Compression (zstd).
- EXT_
PREDICTION - Extension type: Prediction (terminal-specific).
- EXT_
SCROLLBACK - Extension type: Scrollback (terminal-specific).
- FLAG_
ACK_ ONLY - Frame contains only acknowledgment, no state diff.
- FLAG_
HAS_ EXTENSION - Extension data follows payload.
- FRAME_
TYPE_ CLOSE - Close frame (graceful termination).
- FRAME_
TYPE_ DATA - Data frame (encrypted sync message).
- FRAME_
TYPE_ HANDSHAKE_ INIT - Handshake initiation (Noise_IK first message).
- FRAME_
TYPE_ HANDSHAKE_ RESP - Handshake response (Noise_IK second message).
- FRAME_
TYPE_ REKEY - Rekey frame.
- HANDSHAKE_
BACKOFF - Handshake backoff multiplier.
- HANDSHAKE_
MAX_ RETRIES - Maximum handshake retries.
- HANDSHAKE_
TIMEOUT - Handshake timeout (initial).
- HASH_
SIZE - BLAKE2s hash output size.
- INITIAL_
RTO - Initial retransmission timeout.
- KEEPALIVE_
INTERVAL - Send keepalive if idle for this long.
- MAX_
EPOCH - Maximum epoch value.
- MAX_
FRAME_ RATE - Maximum frame rate (Hz).
- MAX_
RETRANSMITS - Maximum retransmission attempts before giving up.
- MAX_RTO
- Maximum retransmission timeout.
- MIN_
COMPRESS_ SIZE - Minimum size to attempt compression.
- MIN_
DATA_ FRAME_ SIZE - Minimum data frame size (header + empty payload + tag).
- MIN_
FRAME_ INTERVAL_ MS - Minimum frame interval (ms) - will use max(SRTT/2, this).
- MIN_
HANDSHAKE_ INIT_ SIZE - Minimum handshake init size.
- MIN_
HANDSHAKE_ RESP_ SIZE - Minimum handshake response size.
- MIN_RTO
- Minimum retransmission timeout.
- NONCE_
DIR_ INITIATOR - Nonce direction: Initiator -> Responder.
- NONCE_
DIR_ RESPONDER - Nonce direction: Responder -> Initiator.
- OLD_
KEY_ RETENTION - Keep old keys for late packets during rekey.
- PRIVATE_
KEY_ SIZE - X25519 private key size.
- PROTOCOL_
VERSION - Protocol version (v1.0).
- PUBLIC_
KEY_ SIZE - X25519 public key size.
- RECOMMENDED_
MAX_ PAYLOAD - Recommended max payload for mobile networks.
- REJECT_
AFTER_ MESSAGES - Hard limit on messages - MUST terminate session.
- REJECT_
AFTER_ TIME - Hard limit, reject old keys after this time.
- REKEY_
AFTER_ MESSAGES - Soft limit on messages before rekey.
- REKEY_
AFTER_ TIME - Initiate rekey after this time.
- REPLAY_
WINDOW_ SIZE - Minimum replay window size in bits.
- SESSION_
ID_ SIZE - Session ID size (48-bit).
- SYNC_
MESSAGE_ HEADER_ SIZE - Sync message header size (3 x u64 + u32).
Traits§
- Predictable
- Optional trait for states that support client-side prediction.
- Sync
State - Core trait for any state that can be synchronized.