-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(s2n-quic-transport): dc Manager (#2218)
* feat(s2n-quic-transport): dc Manager * wire up dc manager * expose new method in `Flag` * add publisher to frame handling * dc mod * create dc manager in session_context.rs * update select_version to use tp * add events * dc manager tests * dc manager * dc integration test * cleanup snapshots * move flag to manager and use state transition macro * move application_params * add assertion for path secrets ready * add test for not mtls * return vec from trait and simplify trait * add new state * add use * use ensure * use test_transitions
- Loading branch information
1 parent
c96e57c
commit 391068e
Showing
33 changed files
with
1,300 additions
and
59 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::{crypto::tls::TlsSession, dc, dc::ConnectionInfo, stateless_reset}; | ||
|
||
pub struct MockDcEndpoint { | ||
stateless_reset_tokens: Vec<stateless_reset::Token>, | ||
} | ||
|
||
impl MockDcEndpoint { | ||
pub fn new(tokens: &[stateless_reset::Token]) -> Self { | ||
Self { | ||
stateless_reset_tokens: tokens.to_vec(), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Default)] | ||
pub struct MockDcPath { | ||
pub on_path_secrets_ready_count: u8, | ||
pub on_peer_stateless_reset_tokens_count: u8, | ||
pub stateless_reset_tokens: Vec<stateless_reset::Token>, | ||
pub peer_stateless_reset_tokens: Vec<stateless_reset::Token>, | ||
} | ||
|
||
impl dc::Endpoint for MockDcEndpoint { | ||
type Path = MockDcPath; | ||
|
||
fn new_path(&mut self, _connection_info: &ConnectionInfo) -> Option<Self::Path> { | ||
Some(MockDcPath { | ||
stateless_reset_tokens: self.stateless_reset_tokens.clone(), | ||
..Default::default() | ||
}) | ||
} | ||
} | ||
|
||
impl dc::Path for MockDcPath { | ||
fn on_path_secrets_ready(&mut self, _session: &impl TlsSession) -> Vec<stateless_reset::Token> { | ||
self.on_path_secrets_ready_count += 1; | ||
self.stateless_reset_tokens.clone() | ||
} | ||
|
||
fn on_peer_stateless_reset_tokens<'a>( | ||
&mut self, | ||
stateless_reset_tokens: impl Iterator<Item = &'a stateless_reset::Token>, | ||
) { | ||
self.on_peer_stateless_reset_tokens_count += 1; | ||
self.peer_stateless_reset_tokens | ||
.extend(stateless_reset_tokens); | ||
} | ||
} |
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
Oops, something went wrong.