Skip to main content

Module session

Module session 

Source
Expand description

What a peering session enforces after the handshake, and what guards the handshake itself.

  • DirectoryVersions is the persisted anti-rollback floor: the highest directory_version this device has verified. Persistence is local state, so it lives behind this seam; MemoryDirectoryVersions is the in-process adapter.
  • HandshakeLimiter caps handshake attempts per source address, so the LAN cannot probe a device for membership. Time is passed in, so every rule is a deterministic unit test.
  • PeerSession re-checks the peer’s revocation on every request, not only at the handshake, and remembers what the peer delivered and when, so everything delivered after its revocation took effect can be quarantined.
  • TrustSource is where the serving side reads the trust each request is checked against; SharedTrust is the in-process adapter a refreshing owner replaces.

Structs§

HandshakeLimiter
A sliding-window handshake rate limit per source address.
MemoryDirectoryVersions
An in-memory DirectoryVersions: monotonic for the life of the process.
PeerSession
One established peering session, as the serving side tracks it: the verified peer, whether it has been cut off, and what it delivered when.
SharedTrust
Trust held in memory that its owner replaces as the directory refreshes: a session reading it sees each replacement at its next request.

Constants§

DEFAULT_HANDSHAKES_PER_WINDOW
Handshake attempts admitted per source address within one window, by default.
DEFAULT_HANDSHAKE_WINDOW
The default rate-limit window.
MAX_TRACKED_SOURCES
The most source addresses the limiter tracks at once, bounding its memory. When a new source finds the table full, idle sources are pruned, and if it is still full of live ones the least recently active source is evicted: a full table never refuses a new source.

Traits§

DirectoryVersions
The persisted anti-rollback floor: the highest device-directory version this device has verified. Implementations must be monotonic — record never lowers it — and durable across restarts, or a reboot readmits a stale directory.
TrustSource
Where the serving side of a channel reads the trust it authorizes each request against: the account’s directory as this device pins it now, so a peer revoked mid-session is refused at its next request. An implementation that cannot produce current trust returns an error, and the request is refused (fail closed) rather than served under trust that may be stale.