#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TlsProfile {
pub protocol: char,
pub tls_version: u16,
pub supported_versions: alloc::vec::Vec<u16>,
pub has_sni: bool,
pub ciphers: alloc::vec::Vec<u16>,
pub extensions: alloc::vec::Vec<u16>,
pub signature_algorithms: alloc::vec::Vec<u16>,
pub groups: alloc::vec::Vec<u16>,
pub point_formats: alloc::vec::Vec<u8>,
pub alpn: alloc::vec::Vec<alloc::string::String>,
}
impl Default for TlsProfile {
fn default() -> Self {
Self {
protocol: 't',
tls_version: 0x0303,
supported_versions: alloc::vec::Vec::new(),
has_sni: true,
ciphers: alloc::vec::Vec::new(),
extensions: alloc::vec::Vec::new(),
signature_algorithms: alloc::vec::Vec::new(),
groups: alloc::vec::Vec::new(),
point_formats: alloc::vec::Vec::new(),
alpn: alloc::vec::Vec::new(),
}
}
}
#[inline]
pub fn is_grease(v: u16) -> bool {
v & 0x000f == 0x000a && (v >> 8) == (v & 0x00ff)
}
pub fn chrome_tls_profile() -> TlsProfile {
TlsProfile {
protocol: 't',
tls_version: 0x0303,
supported_versions: alloc::vec![0x0304, 0x0303, 0x0302, 0x0301],
has_sni: true,
ciphers: alloc::vec![
0x1301, 0x1302, 0x1303, 0xc02b, 0xc02f, 0xc02c, 0xc030, 0xcca9, 0xcca8, 0xc013, 0xc014,
0x009c, 0x009d, 0x002f, 0x0035,
],
extensions: alloc::vec![
0x0000, 0x0017, 0xff01, 0x000a, 0x000b, 0x0023, 0x0010, 0x0005, 0x000d, 0x0012, 0x0033,
0x002d, 0x002b, 0x001b, 0x4469, 0x0015,
],
signature_algorithms: alloc::vec![
0x0403, 0x0804, 0x0401, 0x0503, 0x0805, 0x0501, 0x0806, 0x0601,
],
groups: alloc::vec![29, 23, 24],
point_formats: alloc::vec![0],
alpn: alloc::vec!["h2".into(), "http/1.1".into()],
}
}