diff --git a/Cargo.toml b/Cargo.toml index 48f8492..36b77e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ thiserror = { version = "1.0", default-features = false } tracing = { version = "0.1", default-features = false, features = [ "log", ], optional = true } +rand = {version = "0.8.5", default-features = false, features = ["std","std_rng"] } [dev-dependencies] clap = { version = "4.5", features = ["derive"] } @@ -35,6 +36,7 @@ tokio = { version = "1.36", features = [ "rt-multi-thread", ], default-features = false } + #tun2.rs example tun2 = { version = "1.2", features = ["async"] } diff --git a/src/stream/tcb.rs b/src/stream/tcb.rs index 4e5a8db..0e7383b 100644 --- a/src/stream/tcb.rs +++ b/src/stream/tcb.rs @@ -43,7 +43,10 @@ pub(super) struct Tcb { impl Tcb { pub(super) fn new(ack: u32, tcp_timeout: Duration) -> Tcb { + #[cfg(debug_assertions)] let seq = 100; + #[cfg(not(debug_assertions))] + let seq = rand::random::(); let deadline = tokio::time::Instant::now() + tcp_timeout; Tcb { seq,