Disable resumption
This commit is contained in:
parent
b51a09795f
commit
9bb6e4fe9d
5 changed files with 152 additions and 10 deletions
131
Cargo.lock
generated
131
Cargo.lock
generated
|
|
@ -11,6 +11,56 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "argp"
|
||||
version = "0.4.0"
|
||||
|
|
@ -191,6 +241,12 @@ dependencies = [
|
|||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.9.0"
|
||||
|
|
@ -243,6 +299,29 @@ version = "1.15.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
|
||||
[[package]]
|
||||
name = "env_filter"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.11.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"env_filter",
|
||||
"jiff",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fast-tlsh"
|
||||
version = "0.1.10"
|
||||
|
|
@ -376,6 +455,12 @@ dependencies = [
|
|||
"vsimd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.13.0"
|
||||
|
|
@ -391,6 +476,30 @@ version = "1.0.15"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||
|
||||
[[package]]
|
||||
name = "jiff"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35"
|
||||
dependencies = [
|
||||
"jiff-static",
|
||||
"log",
|
||||
"portable-atomic",
|
||||
"portable-atomic-util",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jiff-static"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.34"
|
||||
|
|
@ -458,6 +567,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"argp",
|
||||
"aws-lc-rs",
|
||||
"env_logger",
|
||||
"fast-tlsh",
|
||||
"futures-util",
|
||||
"memchr",
|
||||
|
|
@ -529,6 +639,12 @@ version = "1.21.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell_polyfill"
|
||||
version = "1.70.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.74"
|
||||
|
|
@ -597,6 +713,15 @@ version = "1.11.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic-util"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
|
||||
dependencies = [
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
|
|
@ -974,6 +1099,12 @@ version = "0.9.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ edition = "2024"
|
|||
argp = "0.4.0"
|
||||
aws-lc-rs = "1.14.1"
|
||||
#console-subscriber = "0.5.0"
|
||||
env_logger = "0.11.8"
|
||||
futures-util = "0.3.31"
|
||||
memchr = "2.7.6"
|
||||
regex = "1.12.2"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ use tokio_rustls::{
|
|||
TlsConnector,
|
||||
rustls::{
|
||||
SignatureScheme,
|
||||
client::danger::{HandshakeSignatureValid, ServerCertVerifier},
|
||||
client::{
|
||||
Resumption,
|
||||
danger::{HandshakeSignatureValid, ServerCertVerifier},
|
||||
},
|
||||
pki_types::ServerName,
|
||||
},
|
||||
};
|
||||
|
|
@ -98,12 +101,12 @@ pub async fn play(
|
|||
let connect_to = connect_to.to_socket_addrs().unwrap().next().unwrap();
|
||||
match tls_mode {
|
||||
TlsMode::Both | TlsMode::Client => {
|
||||
let config = Arc::new(
|
||||
tokio_rustls::rustls::ClientConfig::builder()
|
||||
.dangerous()
|
||||
.with_custom_certificate_verifier(Arc::new(DummyCertVerifier))
|
||||
.with_no_client_auth(),
|
||||
);
|
||||
let mut config = tokio_rustls::rustls::ClientConfig::builder()
|
||||
.dangerous()
|
||||
.with_custom_certificate_verifier(Arc::new(DummyCertVerifier))
|
||||
.with_no_client_auth();
|
||||
config.resumption = Resumption::disabled();
|
||||
let config = Arc::new(config);
|
||||
for (id, (server_name, records)) in records.iter() {
|
||||
let connector = TlsConnector::from(config.clone());
|
||||
let counter = counter.clone();
|
||||
|
|
@ -250,7 +253,7 @@ pub async fn play(
|
|||
for (direction, data) in records {
|
||||
match direction {
|
||||
Direction::ClientToServer => {
|
||||
//println!("[CLT] ({id}) >> {}", data.len());
|
||||
//println!("[CLT] ({id}) >> {}", str::from_utf8(&data[..data.len().min(255)]).unwrap());
|
||||
//stream.get_mut().write_all(data).await.unwrap();
|
||||
match tokio::time::timeout(
|
||||
std::time::Duration::from_millis(1000),
|
||||
|
|
@ -267,7 +270,7 @@ pub async fn play(
|
|||
//let mut buf = Vec::new();
|
||||
//stream.read_buf(&mut buf).await.ok();
|
||||
//let mut buf = vec![0; data.len().saturating_sub(50).max(1)];
|
||||
match tokio::time::timeout(
|
||||
let resp = match tokio::time::timeout(
|
||||
std::time::Duration::from_millis(1000),
|
||||
stream.next(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ static RECORDS: StaticCell<Records> = StaticCell::new();
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
env_logger::init();
|
||||
let opt: Opt = argp::parse_args_or_exit(argp::DEFAULT);
|
||||
|
||||
match opt.subcommand {
|
||||
|
|
|
|||
|
|
@ -182,7 +182,12 @@ pub async fn play(
|
|||
};*/
|
||||
let fut = async move {
|
||||
let accepted = acceptor.await.unwrap();
|
||||
let server_name = accepted.client_hello().server_name().unwrap().to_string();
|
||||
let server_name = accepted
|
||||
.client_hello()
|
||||
.server_name()
|
||||
.unwrap()
|
||||
.trim_end_matches(".localhost")
|
||||
.to_string();
|
||||
let stream = accepted.into_stream(config).await.unwrap();
|
||||
let mut stream = Framed::new(stream, crate::http::HttpCodec {});
|
||||
let req = stream.next().await.unwrap().unwrap();
|
||||
|
|
@ -270,6 +275,7 @@ pub async fn play(
|
|||
//println!("[SRV] New task");
|
||||
let mut stream = Framed::new(stream, crate::http::HttpCodec {});
|
||||
let req = stream.next().await.unwrap().unwrap();
|
||||
//println!("[SRV] << {}", str::from_utf8(&req[..req.len().min(255)]).unwrap());
|
||||
let req_hash = tlsh::hash_buf(&req)
|
||||
.map_or_else(|_| req.clone(), |h| h.to_string().into_bytes());
|
||||
let mut best = None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue