Skip to content

Commit ffe5000

Browse files
committed
chore: update dependencies and remove some debug log
1 parent 3e6420d commit ffe5000

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

Cargo.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ version = "0.2.15"
1111

1212
[dependencies]
1313
monoio = {version = "0.0.9"}
14-
monoio-rustls-fork-shadow-tls = {version = "0.0.7"}
15-
rustls-fork-shadow-tls = {version = "0.20", default-features = false}
14+
monoio-rustls-fork-shadow-tls = {version = "0.0.8-mod.2"}
15+
rustls-fork-shadow-tls = {version = "0.20.9-mod.2", default-features = false}
1616

1717
anyhow = "1"
1818
byteorder = "1"

src/client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,5 +545,6 @@ fn generate_session_id(hmac: &Hmac, buf: &[u8]) -> [u8; TLS_SESSION_ID_SIZE] {
545545
HMAC_SIZE,
546546
)
547547
}
548+
tracing::debug!("ClientHello before sign: {buf:?}, session_id {session_id:?}");
548549
session_id
549550
}

src/server.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<LA, TA> ShadowTlsServer<LA, TA> {
257257
let mut handshake_stream = TcpStream::connect(addr).await?;
258258
mod_tcp_conn(&mut handshake_stream, true, self.nodelay);
259259
tracing::debug!("handshake server connected: {addr}");
260-
260+
tracing::trace!("ClientHello frame {first_client_frame:?}");
261261
let (res, _) = handshake_stream.write_all(first_client_frame).await;
262262
res?;
263263
if !client_hello_pass {
@@ -281,7 +281,7 @@ impl<LA, TA> ShadowTlsServer<LA, TA> {
281281
return Ok(());
282282
}
283283
};
284-
tracing::debug!("ServerRandom extracted: {server_random:?}");
284+
tracing::debug!("Client authenticated. ServerRandom extracted: {server_random:?}");
285285

286286
if !support_tls13(&first_server_frame) {
287287
tracing::error!("TLS 1.3 is not supported, will copy bidirectional");
@@ -780,21 +780,13 @@ async fn copy_by_frame_until_hmac_matches(
780780
let mut g_buffer = Vec::new();
781781

782782
loop {
783-
tracing::debug!("copy_by_frame_until_hmac_matches getting frame");
784783
let buffer = read_exact_frame_into(&mut read, g_buffer).await?;
785-
tracing::debug!("copy_by_frame_until_hmac_matches get a frame: {buffer:?}",);
786784
if buffer.len() > 9 && buffer[0] == APPLICATION_DATA {
787785
// check hmac
788786
let mut tmp_hmac = hmac.to_owned();
789787
tmp_hmac.update(&buffer[TLS_HMAC_HEADER_SIZE..]);
790788
let h = tmp_hmac.finalize();
791789

792-
tracing::debug!(
793-
"tmp hmac({:?}) = {h:?}, raw = {:?}",
794-
&buffer[TLS_HMAC_HEADER_SIZE..],
795-
&buffer[TLS_HEADER_SIZE..TLS_HMAC_HEADER_SIZE]
796-
);
797-
798790
if buffer[TLS_HEADER_SIZE..TLS_HMAC_HEADER_SIZE] == h {
799791
hmac.update(&buffer[TLS_HMAC_HEADER_SIZE..]);
800792
hmac.update(&buffer[TLS_HEADER_SIZE..TLS_HMAC_HEADER_SIZE]);
@@ -829,7 +821,6 @@ async fn copy_by_frame_with_modification(
829821
monoio::select! {
830822
// this function can be stopped by a channel when reading.
831823
_ = &mut stop => {
832-
tracing::debug!("copy_by_frame_with_modification recv stop");
833824
return Ok(());
834825
},
835826
buffer_res = read_exact_frame_into(&mut read, g_buffer) => {
@@ -893,10 +884,11 @@ fn support_tls13(frame: &[u8]) -> bool {
893884
read_ok!(cursor.skip_by_u16());
894885
continue;
895886
}
896-
tracing::debug!("found supported_versions extension");
897887
let ext_len = read_ok!(cursor.read_u16::<BigEndian>());
898888
let ext_val = read_ok!(cursor.read_u16::<BigEndian>());
899-
return ext_len == 2 && ext_val == TLS_13;
889+
let use_tls13 = ext_len == 2 && ext_val == TLS_13;
890+
tracing::debug!("found supported_versions extension, tls1.3: {use_tls13}");
891+
return use_tls13;
900892
}
901893
false
902894
}

0 commit comments

Comments
 (0)