Trait TokenStore
pub trait TokenStore: Send + Sync {
// Required methods
fn insert(&self, server_name: &str, version: Version, token: StoredToken);
fn take(&self, server_name: &str, version: Version) -> Option<StoredToken>;
}quic and std only.Expand description
Responsible for storing validation tokens received from servers and retrieving them for use in subsequent connections
Required Methods§
fn insert(&self, server_name: &str, version: Version, token: StoredToken)
fn insert(&self, server_name: &str, version: Version, token: StoredToken)
Potentially store a token for later one-time use
Called when a NEW_TOKEN frame is received from the server. version is the QUIC
version of the connection that received it: a token is only valid for a connection in
the same version (RFC 9369 §5).
fn take(&self, server_name: &str, version: Version) -> Option<StoredToken>
fn take(&self, server_name: &str, version: Version) -> Option<StoredToken>
Try to find and take a token that was stored with the given server name and version
The same token must never be returned from take twice, as doing so can be used to
de-anonymize a client’s traffic. A token stored under another version must not be
returned either.
Called when trying to connect to a server. It is always ok for this to return None.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".