From bd9c30d6ec1594405f21659950ae735e7d22537a Mon Sep 17 00:00:00 2001 From: "Sajjad (Sage) Pourali" Date: Sun, 1 Dec 2024 13:02:33 -0500 Subject: [PATCH] Update Dependencies (#54) * update dependencies * Fix clippy issue * Remove use of packet_information * Remove use of packet_information --- Cargo.toml | 14 +++++--------- examples/tun2.rs | 6 +++--- examples/tun_wintun.rs | 14 +++++++------- 3 files changed, 15 insertions(+), 19 deletions(-) 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..1af173c 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)] @@ -33,14 +33,14 @@ async fn main() -> Result<(), Box> { #[cfg(not(target_os = "windows"))] config.destination(_gateway); - #[cfg(target_os = "linux")] - config.platform(|config| { - config.packet_information(true); - }); + // #[cfg(target_os = "linux")] + // config.platform_config(|config| { + // config.ensure_root_privileges(true); + // }); let mut ipstack_config = ipstack::IpStackConfig::default(); - ipstack_config.mtu(MTU as u16); - ipstack_config.packet_information(cfg!(target_family = "unix")); + ipstack_config.mtu(MTU); + // ipstack_config.packet_information(cfg!(target_family = "unix")); #[cfg(not(target_os = "windows"))] let mut ip_stack = ipstack::IpStack::new(ipstack_config, tun::create_as_async(&config)?);