Skip to main content

Module server

Module server 

Source
Expand description

Server-side policy: client tracking, rate limiting, and interleaved mode.

All decisions, no I/O. The daemon owns sockets and NTS; this module owns what the answer should be, which is what makes it testable without a network and portable to wasm.

The client key is generic on purpose: the core must not know what an IP address is (mission plan §4 — the core knows bytes and timestamps, never a product type). The daemon instantiates it with the peer address.

Structs§

ClientHandle
A resolved position in the table.
ClientHashBuilder
A fast, seeded hasher for short keys.
ClientHasher
ClientRecord
Per-client state: enough for rate limiting, interleaved mode and the MRU report, and no more — this is multiplied by every client that has ever spoken to us.
ClientTable
Bounded most-recently-used client table.
RateLimitConfig
Rate-limit policy, mirroring chrony’s ratelimit interval/burst/leak.
ServerStats
Aggregate counters for the status.serverstats op.

Enums§

Disposition
What the server should do with one request.
ResponseMode
Which timestamps a response should carry.

Functions§

mark_server_timestamps
Mark a server response’s timestamps so the two are distinguishable by their lowest bit: receive has bit 0 set, transmit has it clear (RFC 9769 and chrony’s ntp_core.c).