Module core

Module core 

Source
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§

ApplyError
Errors that can occur when applying a diff.
CryptoError
Errors in the crypto layer.
DecodeError
Errors that can occur when decoding a diff.
NomadError
Top-level NOMAD errors.
SyncError
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.
SyncState
Core trait for any state that can be synchronized.