Skip to main content

Module session

Module session 

Source
Available on crate feature std only.
Expand description

Phantom Protocol - Session Management

The Session is the virtual association between two endpoints that persists across IP changes (single-path seamless connection migration — not multipath aggregation). It owns the per-direction AEAD CryptoState (hot-swapped on rekey via ArcSwap), the header-protection keys, the rotating connection-ID chain, the per-direction replay window, the stream table, the pacer + BBR bandwidth estimator, and the migration / liveness state. The Scheduler it holds is vestigial (see SchedulerMode).

Structs§

BandwidthSnapshot
Read-only snapshot of the session’s pacing / bandwidth state (Phase 2.6). Returned by Session::bandwidth_snapshot for telemetry / debugging without exposing the mutable estimator.
CidSlide
A one-step slide of the inbound CID demux window (ε / WIRE v5, P4b), produced by Session::note_migration_path when the peer migrates. The demux applies it: add are the CIDs to register at the new leading edge, remove the CIDs that fell past the trailing edge, and anchor is a CID still routed for this session (the demux resolves the session’s channel through it).
CryptoState
Crypto state for session encryption.
Session
Session - virtual association between two endpoints

Enums§

SessionState
Session state machine

Constants§

MAX_REKEY_CATCHUP
How many epochs the receive path will catch up in one packet when accepting an authenticated forward rekey (C1). A small bound caps the HKDF work an attacker can force per spoofed packet (each step is a trial that commits nothing unless AEAD verifies) while comfortably absorbing the small epoch divergence that arises when both directions rekey at slightly different cadences. A gap larger than this is rejected; over a reliable transport the sender retransmits at the then-current epoch, so no data is lost. In practice (production REKEY_SOFT_LIMIT of 2^32) the gap is essentially always 0 or 1.
REBIND_VALIDATION_PATH_ID
Reserved path_id for validating a passive NAT rebind (M-3).
REKEY_SOFT_LIMIT
Soft high-watermark for automatic mid-session rekey (C1). Once a direction’s AEAD invocation count crosses this, the data pump rotates to a fresh key before the hard AEAD_MAX_INVOCATIONS ceiling (Invariant 8) so a long-lived session ratchets keys instead of failing with NonceExhausted.