1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use s2n_quic_core::application::ServerName;
use s2n_tls::config::Config;
#[cfg(test)]
#[global_allocator]
static ALLOCATOR: checkers::Allocator = checkers::Allocator::system();
#[cfg(all(s2n_quic_unstable, s2n_quic_enable_pq_tls))]
static DEFAULT_POLICY: &s2n_tls::security::Policy = &s2n_tls::security::TESTING_PQ;
#[cfg(not(all(s2n_quic_unstable, s2n_quic_enable_pq_tls)))]
static DEFAULT_POLICY: &s2n_tls::security::Policy = &s2n_tls::security::DEFAULT_TLS13;
#[non_exhaustive]
pub struct ConnectionContext<'a> {
pub server_name: Option<&'a ServerName>,
}
pub trait ConfigLoader: 'static + Send {
fn load(&mut self, cx: ConnectionContext) -> Config;
}
impl ConfigLoader for Config {
#[inline]
fn load(&mut self, _cx: ConnectionContext) -> Config {
self.clone()
}
}
impl<T: FnMut(ConnectionContext) -> Config + Send + 'static> ConfigLoader for T {
#[inline]
fn load(&mut self, cx: ConnectionContext) -> Config {
(self)(cx)
}
}
impl ConfigLoader for Box<dyn ConfigLoader> {
#[inline]
fn load(&mut self, cx: ConnectionContext) -> Config {
(**self).load(cx)
}
}
mod callback;
mod keylog;
mod params;
mod session;
pub mod certificate;
pub mod client;
pub mod server;
pub use client::Client;
pub use server::Server;
#[cfg(any(test, all(s2n_quic_unstable, feature = "unstable_client_hello")))]
pub use s2n_tls::{self, callbacks::ClientHelloCallback, connection::Connection};
#[cfg(test)]
mod tests;