diff --git a/Cargo.toml b/Cargo.toml index 9e8a6a1..4089df3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,15 +11,15 @@ readme = "README.md" [dependencies] ahash = "0.8" -tokio = { version = "1.39", features = [ +tokio = { version = "1.41", features = [ "sync", "rt", "time", "io-util", "macros", ], default-features = false } -etherparse = { version = "0.15", default-features = false, features = ["std"] } -thiserror = { version = "1.0", default-features = false } +etherparse = { version = "0.16", default-features = false, features = ["std"] } +thiserror = { version = "2.0", default-features = false } log = { version = "0.4", default-features = false } rand = { version = "0.8.5", default-features = false, features = [ "std", @@ -27,7 +27,7 @@ rand = { version = "0.8.5", default-features = false, features = [ ] } [dev-dependencies] -tokio = { version = "1.39", features = [ +tokio = { version = "1.41", features = [ "rt-multi-thread", ], default-features = false } clap = { version = "4.5", features = ["derive"] } @@ -37,12 +37,8 @@ udp-stream = { version = "0.0", default-features = false } # Benchmarks criterion = { version = "0.5" } -#tun2.rs example -tun2 = { version = "2.0", features = ["async"] } - -#tun_wintun.rs example [target.'cfg(any(target_os = "linux", target_os = "macos"))'.dev-dependencies] -tun = { version = "0.6.1", features = ["async"], default-features = false } +tun = { version = "0.7.5", features = ["async"], default-features = false } [target.'cfg(target_os = "windows")'.dev-dependencies] wintun = { version = "0.5", default-features = false } diff --git a/examples/tun2.rs b/examples/tun2.rs index d3e54ea..e406203 100644 --- a/examples/tun2.rs +++ b/examples/tun2.rs @@ -5,7 +5,7 @@ //! //! This example must be run as root or administrator privileges. //! ``` -//! sudo target/debug/examples/tun2 --server-addr 127.0.0.1:8080 # Linux or macOS +//! sudo target/debug/examples/tun --server-addr 127.0.0.1:8080 # Linux or macOS //! ``` //! Then please run the `echo` example server, which listens on TCP & UDP ports 127.0.0.1:8080. //! ``` @@ -81,7 +81,7 @@ async fn main() -> Result<(), Box> { #[cfg(not(target_os = "windows"))] let gateway = Ipv4Addr::new(10, 0, 0, 1); - let mut tun_config = tun2::Configuration::default(); + let mut tun_config = tun::Configuration::default(); tun_config.address(ipv4).netmask(netmask).mtu(MTU).up(); #[cfg(not(target_os = "windows"))] tun_config.destination(gateway); // avoid routing all traffic to tun on Windows platform @@ -101,7 +101,7 @@ async fn main() -> Result<(), Box> { ipstack_config.tcp_timeout(std::time::Duration::from_secs(args.tcp_timeout)); ipstack_config.udp_timeout(std::time::Duration::from_secs(args.udp_timeout)); - let mut ip_stack = ipstack::IpStack::new(ipstack_config, tun2::create_as_async(&tun_config)?); + let mut ip_stack = ipstack::IpStack::new(ipstack_config, tun::create_as_async(&tun_config)?); let server_addr = args.server_addr; diff --git a/examples/tun_wintun.rs b/examples/tun_wintun.rs index 5ef0f38..5db5f4d 100644 --- a/examples/tun_wintun.rs +++ b/examples/tun_wintun.rs @@ -7,7 +7,7 @@ use tokio::net::TcpStream; use udp_stream::UdpStream; // const MTU: u16 = 1500; -const MTU: i32 = u16::MAX as i32; +const MTU: u16 = u16::MAX; #[derive(Parser)] #[command(author, version, about = "Testing app for tun.", long_about = None)] @@ -39,7 +39,7 @@ async fn main() -> Result<(), Box> { }); let mut ipstack_config = ipstack::IpStackConfig::default(); - ipstack_config.mtu(MTU as u16); + ipstack_config.mtu(MTU); ipstack_config.packet_information(cfg!(target_family = "unix")); #[cfg(not(target_os = "windows"))]