warnings fix
This commit is contained in:
@@ -8,8 +8,3 @@ pub const PSK_DHE_KE_MODE: u8 = 0x01;
|
||||
pub const CERT_COMPRESSION_BROTLI: u16 = 0x0002;
|
||||
|
||||
pub const OCSP_STATUS_TYPE: u8 = 0x01;
|
||||
|
||||
pub const GREASE_IDENTIFIERS: [u16; 16] = [
|
||||
0x0A0A, 0x1A1A, 0x2A2A, 0x3A3A, 0x4A4A, 0x5A5A, 0x6A6A, 0x7A7A, 0x8A8A, 0x9A9A, 0xAAAA, 0xBABA,
|
||||
0xCACA, 0xDADA, 0xEAEA, 0xFAFA,
|
||||
];
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
use bytes::{BufMut, Bytes, BytesMut};
|
||||
use rand::RngExt;
|
||||
|
||||
use crate::tlseng::{
|
||||
consts::{
|
||||
CERT_COMPRESSION_BROTLI, GREASE_IDENTIFIERS, OCSP_STATUS_TYPE, PSK_DHE_KE_MODE,
|
||||
TYPE_HOST_NAME,
|
||||
},
|
||||
consts::{CERT_COMPRESSION_BROTLI, OCSP_STATUS_TYPE, PSK_DHE_KE_MODE, TYPE_HOST_NAME},
|
||||
profile::BrowserProfile,
|
||||
types::{TlsExtensions, TlsGroups, TlsSignatures, TlsVersions},
|
||||
};
|
||||
@@ -58,18 +54,11 @@ impl ExtensionBuilder {
|
||||
self.payload.put_slice(data);
|
||||
}
|
||||
|
||||
pub fn grease(&mut self) {
|
||||
let mut rng = rand::rng();
|
||||
let rnd = rng.random_range(0..GREASE_IDENTIFIERS.len());
|
||||
let etype = GREASE_IDENTIFIERS[rnd];
|
||||
self.add_extension(etype, &[]);
|
||||
}
|
||||
|
||||
pub fn grease_with_id(&mut self, etype: u16) {
|
||||
self.add_extension(etype, &[]);
|
||||
}
|
||||
|
||||
pub fn apply_generic_extension(&mut self, etype: u16, profile: &BrowserProfile) {
|
||||
pub fn apply_generic_extension(&mut self, etype: u16, _profile: &BrowserProfile) {
|
||||
match etype {
|
||||
_ => {
|
||||
netrunner_logger::trace!(etype, "Applying generic or unknown extension");
|
||||
|
||||
@@ -8,18 +8,18 @@ use crate::{
|
||||
extension::ExtensionBuilder,
|
||||
profile::{BrowserProfile, ServerProfile},
|
||||
tls_record::TlsRecord,
|
||||
types::{ContentType, HelloType, ProtocolVersion, TlsVersions},
|
||||
types::{ContentType, HelloType, ProtocolVersion},
|
||||
},
|
||||
utils::u24::U24,
|
||||
};
|
||||
|
||||
pub struct HelloHeader {
|
||||
pub header_type: HelloType,
|
||||
pub len: U24,
|
||||
pub _len: U24,
|
||||
}
|
||||
|
||||
pub struct ClientHello {
|
||||
pub version: ProtocolVersion,
|
||||
pub _version: ProtocolVersion,
|
||||
|
||||
pub random: [u8; 32],
|
||||
|
||||
@@ -88,7 +88,7 @@ impl ClientHello {
|
||||
let extensions_bytes = ext_builder.build();
|
||||
|
||||
let client_hello = ClientHello {
|
||||
version: ProtocolVersion::Tls12,
|
||||
_version: ProtocolVersion::Tls12,
|
||||
random: tls_random,
|
||||
session_id: Bytes::copy_from_slice(&session_id_bytes),
|
||||
cipher_suites: profile.cipher_suites.to_vec(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use bytes::Bytes;
|
||||
|
||||
pub struct ApplicationData {
|
||||
pub len: usize,
|
||||
pub _len: usize,
|
||||
pub payload: Bytes,
|
||||
}
|
||||
|
||||
|
||||
@@ -64,31 +64,27 @@ impl BrowserProfile {
|
||||
}
|
||||
|
||||
pub struct ServerProfile {
|
||||
pub name: &'static str,
|
||||
pub versions: TlsVersions,
|
||||
|
||||
pub record_layer_version: ProtocolVersion,
|
||||
|
||||
pub cipher_suites: &'static [u16],
|
||||
pub groups: TlsGroups,
|
||||
pub signatures: TlsSignatures,
|
||||
pub alpn: &'static [&'static str],
|
||||
pub session_tickets: bool,
|
||||
pub _groups: TlsGroups,
|
||||
pub _signatures: TlsSignatures,
|
||||
pub _alpn: &'static [&'static str],
|
||||
pub _session_tickets: bool,
|
||||
pub honor_cipher_order: bool,
|
||||
}
|
||||
|
||||
impl ServerProfile {
|
||||
pub const MODERN: Self = Self {
|
||||
name: "Modern-Secure",
|
||||
versions: TlsVersions::MODERN,
|
||||
|
||||
record_layer_version: ProtocolVersion::Tls12,
|
||||
|
||||
cipher_suites: &[0x1301, 0x1302, 0x1303],
|
||||
groups: TlsGroups::MODERN,
|
||||
signatures: TlsSignatures::BROWSER_STANDARD,
|
||||
alpn: &["h2", "http/1.1"],
|
||||
session_tickets: true,
|
||||
_groups: TlsGroups::MODERN,
|
||||
_signatures: TlsSignatures::BROWSER_STANDARD,
|
||||
_alpn: &["h2", "http/1.1"],
|
||||
_session_tickets: true,
|
||||
honor_cipher_order: true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ pub struct TlsRecord {
|
||||
|
||||
pub version: ProtocolVersion,
|
||||
|
||||
pub len: u16,
|
||||
pub _len: u16,
|
||||
|
||||
pub payload: Bytes,
|
||||
}
|
||||
@@ -18,7 +18,7 @@ impl TlsRecord {
|
||||
Self {
|
||||
content_type,
|
||||
version,
|
||||
len: payload.len() as u16,
|
||||
_len: payload.len() as u16,
|
||||
payload,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user