pub trait TokenStore: Send + Sync {
// Required methods
fn insert(&self, server_name: &str, token: Bytes);
fn take(&self, server_name: &str) -> Option<Bytes>;
}
Expand description
Responsible for storing validation tokens received from servers and retrieving them for use in subsequent connections
Required Methods§
Sourcefn insert(&self, server_name: &str, token: Bytes)
fn insert(&self, server_name: &str, token: Bytes)
Potentially store a token for later one-time use
Called when a NEW_TOKEN frame is received from the server.
Sourcefn take(&self, server_name: &str) -> Option<Bytes>
fn take(&self, server_name: &str) -> Option<Bytes>
Try to find and take a token that was stored with the given server name
The same token must never be returned from take
twice, as doing so can be used to
de-anonymize a client’s traffic.
Called when trying to connect to a server. It is always ok for this to return None
.