forked from quinn-rs/quinn
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP diff viewer: utilize NEW_TOKEN frames #8
Draft
gretchenfrage
wants to merge
24
commits into
main
Choose a base branch
from
new-token
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Key points:
NewToken
variant'saead_from_hkdf
key derivation is based on an empty byte slice&[]
rather than theretry_src_cid
.NewToken
variant's encrypted data consists of: randomly generated 128 bits, IP address (not including port), issued timestamp.ServerConfig.new_tokens_sent_upon_validation
)ClientConfig.new_token_store: Option<Arc<dyn NewTokenStore>>
object stores NEW_TOKEN tokens received by client, and dispenses them for one-time use when connecting to sameserver_name
againInMemNewTokenStore
stores 2 newest unused tokens for up to 256 servers with LRU eviction policy of server names, so as to pair well withrustls::client::ClientSessionMemoryCache
ServerConfig.token_reuse_preventer: Option<Arc<Mutex<Box<dyn TokenReusePreventer>>>>
object is responsible for mitigating reuse of NEW_TOKEN tokensDefault implementation
BloomTokenReusePreventer
:Divides all time into periods of length
new_token_lifetime
starting at unix epoch. Always maintains two "filters" which track used tokens which expires in that period. Turning over filters as time passes prevents infinite accumulation of tracked tokens.Filters start out as FxHashSets. This achieves the desirable property of linear-ish memory usage: if few NEW_TOKEN tokens are actually being used, the server's bloom token reuse preventer uses negligible memory.
Once a hash set filter would exceed a configurable maximum memory consumption, it's converted to a bloom filter. This achieves the property that an upper bound is set on the number of bytes allocated by the reuse preventer. Instead, as more tokens are added to the bloom filter, the false positive rate (tokens not actually reused but considered to be reused and thus ignored anyways) increases.
ServerConfig.new_token_lifetime
is different fromServerConfig.retry_token_lifetime
and defaults to 2 weeks.TODO: