Available on crate feature
link only.Expand description
The SYN Cookie and the Listener’s stateless identifiers — draft-sharabayko-srt-01 §4.3.1.1
(“a cookie that is crafted based on host, port and current time with 1 minute accuracy”;
private/specs-verified/rules/srt-rules.md).
The draft names the cookie’s inputs, not an algorithm. Here the cookie is a keyed MAC — HMAC-SHA-256 under the listener’s secret — over the peer’s full address (family, IP, port), the Caller’s Socket ID and a coarse time bucket, so a cookie obtained from one source proves nothing for another, and it expires once its bucket is two old. This crate never reads a clock: the caller supplies the bucket (UNIX time / 60) and the secret (from a CSPRNG, replaced periodically).
Structs§
- Cookie
Origin - The key and the bucket a validated cookie was issued under.
Functions§
- derive_
cookie - The SYN Cookie for
peerand the Caller’scaller_socket_idintime_bucket, undersecret. Never0(that value means “no cookie yet”). - derive_
listener_ ids - The Listener’s per-connection Socket ID and Initial Sequence Number for a cookie issued over
the same inputs: a stateless Listener has nowhere to keep what its INDUCTION answer carried,
so the CONCLUSION recomputes it. Domain-separated from the cookie, so a Caller that has seen
its cookie cannot compute them. The Socket ID is never
0(no socket assigned). - validate_
cookie - Whether
cookiewas issued topeerandcaller_socket_idunder one ofsecrets, innow_bucketor the bucket before it, compared in constant time. A cookie two buckets old is refused.