From 5bc71862a22db1a63e5123dd348ff99985e350be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kub=C3=ADk?= Date: Sat, 3 Aug 2024 20:01:44 +0200 Subject: [PATCH 1/6] feat(network): add DNS servers configuration for Linux, FreeBSD, MacOS Added DNS configuration for Linux, FreeBSD and MacOS (Windows TBD). Bumped MSRV to 1.80 due to stdlib LazyLock. --- Cargo.lock | 1 - Cargo.toml | 3 +- examples/client.toml | 3 + src/client.rs | 34 ++++++++-- src/config.rs | 15 +++++ src/network/dns/darwin.rs | 125 +++++++++++++++++++++++++++++++++++++ src/network/dns/linux.rs | 51 +++++++++++++++ src/network/dns/mod.rs | 14 +++++ src/network/dns/windows.rs | 10 +++ src/network/interface.rs | 20 +++++- src/network/mod.rs | 1 + src/network/route.rs | 26 +++++--- src/utils/command.rs | 14 +++++ src/utils/mod.rs | 1 + tests/common/mod.rs | 8 +++ 15 files changed, 308 insertions(+), 18 deletions(-) create mode 100644 src/network/dns/darwin.rs create mode 100644 src/network/dns/linux.rs create mode 100644 src/network/dns/mod.rs create mode 100644 src/network/dns/windows.rs create mode 100644 src/utils/command.rs diff --git a/Cargo.lock b/Cargo.lock index 1f0e0b2..a6c136e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -898,7 +898,6 @@ dependencies = [ "futures", "ipnet", "jemallocator", - "libc", "nu-ansi-term 0.50.1", "once_cell", "quinn", diff --git a/Cargo.toml b/Cargo.toml index 9be1e1b..852f947 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/M0dEx/quincy" keywords = ["vpn", "quic", "tunnel", "networking", "tokio"] categories = ["command-line-utilities", "network-programming"] edition = "2021" -rust-version = "1.75" +rust-version = "1.80" [[bin]] name = "quincy-client" @@ -43,7 +43,6 @@ socket2 = "^0.5.2" bytes = "^1.4" etherparse = "^0.15.0" ipnet = { version = "^2.7", features = ["serde"] } -libc = "^0.2.147" # Tokio tokio = { version = "^1.25", features = [ diff --git a/examples/client.toml b/examples/client.toml index ff00306..51816d0 100644 --- a/examples/client.toml +++ b/examples/client.toml @@ -18,6 +18,9 @@ routes = [ "10.0.1.0/24", "10.11.12.0/24" ] +dns_servers = [ + "10.0.0.1" +] [log] # The log level diff --git a/src/client.rs b/src/client.rs index f7baab3..74b55f3 100644 --- a/src/client.rs +++ b/src/client.rs @@ -10,9 +10,10 @@ use quinn::{Connection, Endpoint, VarInt}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs}; +use crate::network::dns::{add_dns_servers, delete_dns_servers}; use crate::network::interface::{Interface, InterfaceRead, InterfaceWrite}; use crate::network::packet::Packet; -use crate::network::route::add_route; +use crate::network::route::add_routes; use futures::stream::FuturesUnordered; use futures::StreamExt; use std::sync::Arc; @@ -49,13 +50,36 @@ impl QuincyClient { let mtu = self.config.connection.mtu; let interface = I::create(client_address, mtu)?; + let interface_name = interface.name()?; - for route in &self.config.network.routes { - add_route(route, &server_address.addr())? + info!("Created interface: {interface_name}"); + + let routes = &self.config.network.routes; + let dns_servers = &self.config.network.dns_servers; + + if !routes.is_empty() { + add_routes(routes, &server_address.addr())?; + for route in routes { + info!("Added route: {route}"); + } + } + + if !dns_servers.is_empty() { + add_dns_servers(dns_servers, &interface_name)?; + for dns_server in dns_servers { + info!("Added DNS server: {dns_server}"); + } + } + + let relay_result = self + .relay_packets(connection, interface, mtu as usize) + .await; + + if !dns_servers.is_empty() { + delete_dns_servers()?; } - self.relay_packets(connection, interface, mtu as usize) - .await + relay_result } /// Connects to the Quincy server. diff --git a/src/config.rs b/src/config.rs index a55ee29..91668ac 100644 --- a/src/config.rs +++ b/src/config.rs @@ -134,6 +134,16 @@ pub struct NetworkConfig { /// ``` #[serde(default = "default_routes")] pub routes: Vec, + /// DNS servers to use for the tunnel + /// + /// In the format of `address`, e.g.: + /// ```toml + /// dns_servers = [ + /// "10.0.1.1", + /// ] + /// ``` + #[serde(default = "default_dns_servers")] + pub dns_servers: Vec, } /// Logging configuration @@ -202,6 +212,7 @@ impl Default for NetworkConfig { fn default() -> Self { Self { routes: default_routes(), + dns_servers: default_dns_servers(), } } } @@ -242,6 +253,10 @@ fn default_routes() -> Vec { Vec::new() } +fn default_dns_servers() -> Vec { + Vec::new() +} + fn default_true_fn() -> bool { true } diff --git a/src/network/dns/darwin.rs b/src/network/dns/darwin.rs new file mode 100644 index 0000000..cbec2ef --- /dev/null +++ b/src/network/dns/darwin.rs @@ -0,0 +1,125 @@ +use crate::utils::command::run_command; +use anyhow::{anyhow, Result}; +use dashmap::DashMap; +use std::net::IpAddr; +use std::str::FromStr; +use std::sync::LazyLock; + +const NETWORK_SETUP_COMMAND: &str = "networksetup"; +const DNS_GET_ARG: &str = "-getdnsservers"; +const DNS_SET_ARG: &str = "-setdnsservers"; +const SERVICES_GET_ARG: &str = "-listallnetworkservices"; + +static SERVICE_DNS_SERVERS: LazyLock>> = LazyLock::new(DashMap::new); + +/// Gets the names of all network services on the endpoint. +/// +/// ### Returns +/// A vector of network service names. +fn get_service_names() -> Result> { + // networksetup -listallnetworkservices + let output = run_command(NETWORK_SETUP_COMMAND, [SERVICES_GET_ARG])?.wait_with_output()?; + + if !output.status.success() { + return Err(anyhow!( + "failed to get network services: {}", + String::from_utf8_lossy(&output.stdout) + )); + } + + let output_str = String::from_utf8_lossy(&output.stdout); + let service_names = output_str + .lines() + .skip(1) // the first line is "An asterisk (*) denotes that a network service is disabled." + .map(|line| line.trim().to_string()) + .collect(); + + Ok(service_names) +} + +/// Adds a list of DNS servers to all network services on the endpoint. +/// +/// ### Arguments +/// - `dns_servers` - the DNS servers to be added +/// - `interface_name` - the name of the interface to add the DNS servers to (unused) +pub fn add_dns_servers(dns_servers: &[IpAddr], _interface_name: &str) -> Result<()> { + let service_names = get_service_names()?; + let dns_servers_args = dns_servers + .iter() + .map(|ip| ip.to_string()) + .collect::>(); + + for service_name in service_names { + // networksetup -getdnsservers + let get_args = [DNS_GET_ARG, &service_name]; + let get_output = run_command(NETWORK_SETUP_COMMAND, get_args)?.wait_with_output()?; + + if !get_output.status.success() { + return Err(anyhow!( + "failed to add DNS servers: {}", + String::from_utf8_lossy(&get_output.stdout) + )); + } + + let original_dns_servers = String::from_utf8(get_output.stdout)? + .lines() + .filter_map(|dns_str| IpAddr::from_str(dns_str).ok()) + .collect(); + + SERVICE_DNS_SERVERS.insert(service_name.clone(), original_dns_servers); + + // networksetup -setdnsservers + let set_args = [DNS_SET_ARG, &service_name].into_iter().chain( + dns_servers_args + .iter() + .map(|addr_string| addr_string.as_str()), + ); + + let set_output = run_command(NETWORK_SETUP_COMMAND, set_args)?.wait_with_output()?; + + if !set_output.status.success() { + return Err(anyhow!( + "failed to add DNS servers: {}", + String::from_utf8_lossy(&set_output.stdout) + )); + } + } + + Ok(()) +} + +/// Deletes all DNS servers from all network services on the endpoint. +pub fn delete_dns_servers() -> Result<()> { + for service_entry in SERVICE_DNS_SERVERS.iter() { + let service_name = service_entry.key(); + let original_dns_servers = service_entry.value(); + + // If the original DNS servers are empty (set by the DHCP, ...), we need to pass "Empty" + let dns_servers_args = if original_dns_servers.is_empty() { + vec!["Empty".to_owned()] + } else { + original_dns_servers + .iter() + .map(|ip| ip.to_string()) + .collect::>() + }; + + // networksetup -setdnsservers + let set_args = [DNS_SET_ARG, service_name].into_iter().chain( + dns_servers_args + .iter() + .map(|addr_string| addr_string.as_str()), + ); + + let set_output = run_command(NETWORK_SETUP_COMMAND, set_args)?.wait_with_output()?; + + if !set_output.status.success() { + return Err(anyhow!( + "failed to delete DNS servers: {}", + String::from_utf8_lossy(&set_output.stdout) + )); + } + } + + Ok(()) +} diff --git a/src/network/dns/linux.rs b/src/network/dns/linux.rs new file mode 100644 index 0000000..7fd8924 --- /dev/null +++ b/src/network/dns/linux.rs @@ -0,0 +1,51 @@ +use crate::utils::command::run_command; +use anyhow::{anyhow, Context, Result}; +use std::io::Write; +use std::net::IpAddr; + +const RESOLVCONF_COMMAND: &str = "resolvconf"; + +/// Adds a list of DNS servers to the given interface. +/// +/// ### Arguments +/// - `dns_servers` - the DNS servers to be added +/// - `interface_name` - the name of the interface to add the DNS servers to +pub fn add_dns_servers(dns_servers: &[IpAddr], interface_name: &str) -> Result<()> { + let set_args = ["-a", interface_name, "-x"]; + let input = dns_servers + .iter() + .map(|ip| format!("nameserver {ip}")) + .collect::>() + .join("\n"); + + let mut process = run_command(RESOLVCONF_COMMAND, set_args)?; + let mut process_in = process + .stdin + .take() + .ok_or(anyhow!("failed to open stdin"))?; + + process_in + .write_all(input.as_bytes()) + .context("failed to write to stdin")?; + let output = process + .wait_with_output() + .context("failed to wait for process to exit")?; + + if !output.status.success() { + return Err(anyhow!( + "failed to add DNS servers: {}", + String::from_utf8_lossy(&output.stderr) + )); + } + + Ok(()) +} + +/// Deletes all DNS servers from the given interface. +/// +/// No-op on Linux/FreeBSD. +pub fn delete_dns_servers() -> Result<()> { + // This is a no-op on Linux and FreeBSD as the interface is deleted when the process exits + // along with its routes and DNS servers + Ok(()) +} diff --git a/src/network/dns/mod.rs b/src/network/dns/mod.rs new file mode 100644 index 0000000..133d16c --- /dev/null +++ b/src/network/dns/mod.rs @@ -0,0 +1,14 @@ +#[cfg(target_os = "macos")] +mod darwin; +#[cfg(target_os = "macos")] +pub use darwin::{add_dns_servers, delete_dns_servers}; + +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +mod linux; +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +pub use linux::{add_dns_servers, delete_dns_servers}; + +#[cfg(target_os = "windows")] +mod windows; +#[cfg(target_os = "windows")] +pub use windows::{add_dns_servers, delete_dns_servers}; diff --git a/src/network/dns/windows.rs b/src/network/dns/windows.rs new file mode 100644 index 0000000..9a328dd --- /dev/null +++ b/src/network/dns/windows.rs @@ -0,0 +1,10 @@ +use anyhow::Result; +use std::net::IpAddr; + +pub fn add_dns_servers(_dns_servers: &[IpAddr], _interface_name: &str) -> Result<()> { + unimplemented!() +} + +pub fn delete_dns_servers() -> Result<()> { + unimplemented!() +} diff --git a/src/network/interface.rs b/src/network/interface.rs index bd6009e..1f48e43 100644 --- a/src/network/interface.rs +++ b/src/network/interface.rs @@ -1,11 +1,11 @@ #![allow(async_fn_in_trait)] use crate::network::packet::Packet; -use anyhow::Result; +use anyhow::{Context, Result}; use bytes::BytesMut; use ipnet::IpNet; use tokio::io::{AsyncReadExt, AsyncWriteExt, ReadHalf, WriteHalf}; -use tun2::{AsyncDevice, Configuration}; +use tun2::{AbstractDevice, AsyncDevice, Configuration}; pub trait InterfaceRead: AsyncReadExt + Sized + Unpin + Send + 'static { #[inline] @@ -39,6 +39,10 @@ pub trait InterfaceWrite: AsyncWriteExt + Sized + Unpin + Send + 'static { pub trait Interface: InterfaceRead + InterfaceWrite { fn create(interface_address: IpNet, mtu: u16) -> Result; + fn mtu(&self) -> Result; + + fn name(&self) -> Result; + fn split(self) -> (ReadHalf, WriteHalf) { tokio::io::split(self) } @@ -66,4 +70,16 @@ impl Interface for AsyncDevice { Ok(interface) } + + fn mtu(&self) -> Result { + self.as_ref() + .mtu() + .context("failed to retrieve interface MTU") + } + + fn name(&self) -> Result { + self.as_ref() + .tun_name() + .context("failed to retrieve interface name") + } } diff --git a/src/network/mod.rs b/src/network/mod.rs index 9494934..edc9cd8 100644 --- a/src/network/mod.rs +++ b/src/network/mod.rs @@ -1,3 +1,4 @@ +pub mod dns; pub mod interface; pub mod packet; pub mod route; diff --git a/src/network/route.rs b/src/network/route.rs index 76e6c1c..77f24ce 100644 --- a/src/network/route.rs +++ b/src/network/route.rs @@ -1,7 +1,7 @@ -use anyhow::{anyhow, Context, Result}; +use crate::utils::command::run_command; +use anyhow::{anyhow, Result}; use ipnet::IpNet; use std::net::IpAddr; -use std::process::Command; #[cfg(target_os = "linux")] const ROUTE_ADD_COMMAND: &str = "route add -net {network} netmask {netmask} gw {gateway}"; @@ -12,11 +12,24 @@ const ROUTE_ADD_COMMAND: &str = "route -n add -net {network} -netmask {netmask} #[cfg(target_os = "freebsd")] const ROUTE_ADD_COMMAND: &str = "route add -net {network} -netmask {netmask} {gateway}"; +/// Adds a list of routes to the routing table. +/// +/// ### Arguments +/// - `networks` - the networks to be routed through the gateway +/// - `gateway` - the gateway to be used for the routes +pub fn add_routes(networks: &[IpNet], gateway: &IpAddr) -> Result<()> { + for network in networks { + add_route(network, gateway)?; + } + + Ok(()) +} + /// Adds a route to the routing table. /// /// ### Arguments -/// - `network` - the network to add the route for -/// - `gateway` - the gateway to use for the route +/// - `network` - the network to be routed through the gateway +/// - `gateway` - the gateway to be used for the route pub fn add_route(network: &IpNet, gateway: &IpAddr) -> Result<()> { let route_add_command = ROUTE_ADD_COMMAND .replace("{network}", &network.addr().to_string()) @@ -28,10 +41,7 @@ pub fn add_route(network: &IpNet, gateway: &IpAddr) -> Result<()> { let route_program = route_command_split[0]; let route_args = &route_command_split[1..]; - let output = Command::new(route_program) - .args(route_args) - .output() - .context("failed to execute route command")?; + let output = run_command(route_program, route_args)?.wait_with_output()?; if !output.status.success() { return Err(anyhow!( diff --git a/src/utils/command.rs b/src/utils/command.rs new file mode 100644 index 0000000..23d86a7 --- /dev/null +++ b/src/utils/command.rs @@ -0,0 +1,14 @@ +use anyhow::{Context, Result}; +use std::ffi::OsStr; +use std::process::{Child, Command, Stdio}; + +pub fn run_command, S: AsRef>( + program: &str, + arguments: I, +) -> Result { + Command::new(program) + .args(arguments) + .stdout(Stdio::piped()) + .spawn() + .context("failed to execute command") +} diff --git a/src/utils/mod.rs b/src/utils/mod.rs index df1c32c..bdd7c37 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,3 +1,4 @@ +pub mod command; pub mod signal_handler; pub mod tasks; pub mod tracing; diff --git a/tests/common/mod.rs b/tests/common/mod.rs index ccc78e3..558c0a9 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -111,6 +111,14 @@ macro_rules! interface_impl { $test_queue_recv.1.clone(), )) } + + fn mtu(&self) -> Result { + Ok(1400) + } + + fn name(&self) -> Result { + Ok("test".to_owned()) + } } }; } From 5b96945cb004c44f9b0fd2c62c959b18976f2632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kub=C3=ADk?= Date: Sun, 11 Aug 2024 13:23:19 +0200 Subject: [PATCH 2/6] ci(workflows/rust): upgrade codecov to v4 --- .github/workflows/rust.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 3bd251d..ba0f6c7 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -25,7 +25,7 @@ jobs: name: Cache toolchain and dependencies - run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info name: Test with coverage - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 name: Upload coverage to Codecov env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 045cb75285dfcb037fdfcdb5919a37f92d177fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kub=C3=ADk?= Date: Sun, 18 Aug 2024 12:21:44 +0200 Subject: [PATCH 3/6] chore(deps): remove once_cell + update dependencies --- Cargo.lock | 9 ++++----- Cargo.toml | 3 +-- src/constants.rs | 10 +++++----- tests/common/mod.rs | 7 +++---- tests/test_client_communication.rs | 17 ++++++++--------- tests/test_client_isolation.rs | 17 ++++++++--------- tests/test_end_to_end.rs | 10 +++++----- tests/test_failed_auth.rs | 10 +++++----- 8 files changed, 39 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6c136e..b28d1e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -899,7 +899,6 @@ dependencies = [ "ipnet", "jemallocator", "nu-ansi-term 0.50.1", - "once_cell", "quinn", "rpassword", "rstest", @@ -1090,9 +1089,9 @@ dependencies = [ [[package]] name = "rstest" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afd55a67069d6e434a95161415f5beeada95a01c7b815508a82dcb0e1593682" +checksum = "7b423f0e62bdd61734b67cd21ff50871dfaeb9cc74f869dcd6af974fbcb19936" dependencies = [ "futures", "futures-timer", @@ -1102,9 +1101,9 @@ dependencies = [ [[package]] name = "rstest_macros" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4165dfae59a39dd41d8dec720d3cbfbc71f69744efb480a3920f5d4e0cc6798d" +checksum = "c5e1711e7d14f74b12a58411c542185ef7fb7f2e7f8ee6e2940a883628522b42" dependencies = [ "cfg-if", "glob", diff --git a/Cargo.toml b/Cargo.toml index 852f947..02ee675 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,12 +78,11 @@ nu-ansi-term = "^0.50.0" time = "^0.3.23" anyhow = "^1.0" clap = { version = "^4.1", features = ["derive"] } -once_cell = "^1.17" # Alloc [target.'cfg(unix)'.dependencies] jemallocator = { version = "0.5", optional = true } [dev-dependencies] -rstest = "^0.21.0" +rstest = "^0.22.0" tracing-test = { version = "^0.2.4", features = ["no-env-filter"] } diff --git a/src/constants.rs b/src/constants.rs index dde230e..4fd2157 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,6 +1,5 @@ -use std::sync::Arc; +use std::sync::{Arc, LazyLock}; -use once_cell::sync::Lazy; use quinn::Runtime; use rustls::crypto::{ring, CryptoProvider}; use rustls::CipherSuite; @@ -21,13 +20,14 @@ pub const PACKET_CHANNEL_SIZE: usize = 1024 * 1024; pub static TLS_PROTOCOL_VERSIONS: &[&rustls::SupportedProtocolVersion] = &[&rustls::version::TLS13]; /// Represents the supported TLS ALPN protocols for Quincy. -pub static TLS_ALPN_PROTOCOLS: Lazy>> = Lazy::new(|| vec![b"quincy".to_vec()]); +pub static TLS_ALPN_PROTOCOLS: LazyLock>> = LazyLock::new(|| vec![b"quincy".to_vec()]); /// Represents the async runtime used by Quinn. -pub static QUINN_RUNTIME: Lazy> = Lazy::new(|| Arc::new(quinn::TokioRuntime)); +pub static QUINN_RUNTIME: LazyLock> = + LazyLock::new(|| Arc::new(quinn::TokioRuntime)); /// Represents the crypto provider used by Quincy. -pub static CRYPTO_PROVIDER: Lazy> = Lazy::new(|| { +pub static CRYPTO_PROVIDER: LazyLock> = LazyLock::new(|| { let mut provider = ring::default_provider(); provider.cipher_suites.retain(|suite| { diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 558c0a9..f502898 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1,6 +1,5 @@ use bytes::{BufMut, Bytes, BytesMut}; use etherparse::PacketBuilder; -use once_cell::sync::Lazy; use quincy::config::{ClientConfig, FromPath, ServerConfig}; use quincy::network::interface::{InterfaceRead, InterfaceWrite}; use rstest::fixture; @@ -8,7 +7,7 @@ use std::io::Error; use std::net::Ipv4Addr; use std::path::Path; use std::pin::Pin; -use std::sync::Arc; +use std::sync::{Arc, LazyLock}; use std::task::{Context, Poll}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; @@ -94,8 +93,8 @@ pub fn server_config() -> ServerConfig { ServerConfig::from_path(Path::new("tests/static/server.toml"), "QUINCY").unwrap() } -pub const fn make_queue_pair() -> Lazy<(TestSender, TestReceiver)> { - Lazy::new(|| { +pub const fn make_queue_pair() -> LazyLock<(TestSender, TestReceiver)> { + LazyLock::new(|| { let (tx, rx) = mpsc::unbounded_channel(); (Arc::new(Mutex::new(tx)), Arc::new(Mutex::new(rx))) }) diff --git a/tests/test_client_communication.rs b/tests/test_client_communication.rs index f7ccd50..a66b516 100644 --- a/tests/test_client_communication.rs +++ b/tests/test_client_communication.rs @@ -1,12 +1,9 @@ -use std::net::Ipv4Addr; - use crate::common::dummy_packet; use anyhow::Result; use common::{ client_config, make_queue_pair, server_config, TestInterface, TestReceiver, TestSender, }; use ipnet::IpNet; -use once_cell::sync::Lazy; use quincy::network::interface::Interface; use quincy::{ client::QuincyClient, @@ -14,6 +11,8 @@ use quincy::{ server::QuincyServer, }; use rstest::rstest; +use std::net::Ipv4Addr; +use std::sync::LazyLock; mod common; @@ -24,12 +23,12 @@ type ClientBInterface = TestInterface; struct Server; type ServerInterface = TestInterface; -pub static TEST_QUEUE_CLIENT_A_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_A_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_B_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_B_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_A_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_A_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_B_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_B_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); interface_impl!( ClientAInterface, diff --git a/tests/test_client_isolation.rs b/tests/test_client_isolation.rs index c6f99dc..700b22b 100644 --- a/tests/test_client_isolation.rs +++ b/tests/test_client_isolation.rs @@ -1,12 +1,9 @@ -use std::{net::Ipv4Addr, time::Duration}; - use crate::common::dummy_packet; use anyhow::Result; use common::{ client_config, make_queue_pair, server_config, TestInterface, TestReceiver, TestSender, }; use ipnet::IpNet; -use once_cell::sync::Lazy; use quincy::network::interface::Interface; use quincy::{ client::QuincyClient, @@ -14,6 +11,8 @@ use quincy::{ server::QuincyServer, }; use rstest::rstest; +use std::sync::LazyLock; +use std::{net::Ipv4Addr, time::Duration}; use tokio::time::timeout; mod common; @@ -25,12 +24,12 @@ type ClientBInterface = TestInterface; struct Server; type ServerInterface = TestInterface; -pub static TEST_QUEUE_CLIENT_A_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_A_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_B_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_B_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_A_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_A_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_B_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_B_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); interface_impl!( ClientAInterface, diff --git a/tests/test_end_to_end.rs b/tests/test_end_to_end.rs index d93a97e..59c1a00 100644 --- a/tests/test_end_to_end.rs +++ b/tests/test_end_to_end.rs @@ -4,13 +4,13 @@ use crate::common::{ }; use anyhow::Result; use ipnet::IpNet; -use once_cell::sync::Lazy; use quincy::client::QuincyClient; use quincy::config::{ClientConfig, ServerConfig}; use quincy::network::interface::Interface; use quincy::server::QuincyServer; use rstest::rstest; use std::net::Ipv4Addr; +use std::sync::LazyLock; mod common; @@ -19,10 +19,10 @@ type ClientInterface = TestInterface; struct Server; type ServerInterface = TestInterface; -pub static TEST_QUEUE_CLIENT_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); interface_impl!( ClientInterface, diff --git a/tests/test_failed_auth.rs b/tests/test_failed_auth.rs index 28c02ce..4cb384b 100644 --- a/tests/test_failed_auth.rs +++ b/tests/test_failed_auth.rs @@ -4,13 +4,13 @@ use crate::common::{ }; use anyhow::Result; use ipnet::IpNet; -use once_cell::sync::Lazy; use quincy::client::QuincyClient; use quincy::config::{ClientConfig, ServerConfig}; use quincy::network::interface::Interface; use quincy::server::QuincyServer; use rstest::rstest; use std::net::Ipv4Addr; +use std::sync::LazyLock; use std::time::Duration; use tokio::time::sleep; use tracing_test::traced_test; @@ -22,10 +22,10 @@ type ClientInterface = TestInterface; struct Server; type ServerInterface = TestInterface; -pub static TEST_QUEUE_CLIENT_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_CLIENT_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_SEND: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); -pub static TEST_QUEUE_SERVER_RECV: Lazy<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_CLIENT_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_SEND: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); +pub static TEST_QUEUE_SERVER_RECV: LazyLock<(TestSender, TestReceiver)> = make_queue_pair(); interface_impl!( ClientInterface, From 0fcfa8075a0b978d0e2001e5d1486d3203d1b4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kub=C3=ADk?= Date: Wed, 4 Sep 2024 21:41:48 +0200 Subject: [PATCH 4/6] chore: update packages + quinn (security advisory) --- Cargo.lock | 381 ++++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 2 +- 2 files changed, 258 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b28d1e7..69b2f23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,19 +95,37 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-task" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -119,6 +137,12 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.3.0" @@ -176,17 +200,36 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" + +[[package]] +name = "byteorder" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "c2rust-bitfields" @@ -210,9 +253,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.6" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" +dependencies = [ + "shlex", +] [[package]] name = "cesu8" @@ -234,9 +280,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.11" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -244,9 +290,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.11" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", @@ -256,14 +302,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -288,6 +334,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -300,15 +355,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -378,6 +433,33 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + [[package]] name = "figment" version = "0.10.19" @@ -440,6 +522,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -448,7 +540,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -540,9 +632,9 @@ checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "indexmap" -version = "2.2.6" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown", @@ -623,9 +715,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" @@ -679,9 +771,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi", "libc", @@ -756,9 +848,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.2" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -781,6 +873,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot_core" version = "0.9.10" @@ -825,7 +923,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -840,6 +938,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -848,17 +957,20 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.21.1", + "toml_edit", ] [[package]] @@ -878,7 +990,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", "version_check", "yansi", ] @@ -917,9 +1029,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" dependencies = [ "bytes", "pin-project-lite", @@ -927,6 +1039,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", + "socket2", "thiserror", "tokio", "tracing", @@ -934,9 +1047,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.3" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" dependencies = [ "bytes", "rand", @@ -952,22 +1065,22 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" dependencies = [ "libc", "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1013,9 +1126,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -1113,7 +1226,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.72", + "syn 2.0.77", "unicode-ident", ] @@ -1135,15 +1248,15 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -1164,9 +1277,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -1177,9 +1290,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64", "rustls-pki-types", @@ -1187,15 +1300,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-platform-verifier" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e3beb939bcd33c269f4bf946cc829fcd336370267c4a927ac0399c84a3151a1" +checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490" dependencies = [ "core-foundation", "core-foundation-sys", @@ -1214,15 +1327,15 @@ dependencies = [ [[package]] name = "rustls-platform-verifier-android" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84e217e7fdc8466b5b35d30f8c0a30febd29173df4a3a0c2115d306b9c4117ad" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" dependencies = [ "ring", "rustls-pki-types", @@ -1291,31 +1404,32 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -1338,6 +1452,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -1403,9 +1523,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -1429,7 +1549,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1478,9 +1598,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -1501,7 +1621,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1519,47 +1639,36 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.17", + "toml_edit", ] [[package]] name = "toml_datetime" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.17" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.16", + "winnow", ] [[package]] @@ -1582,7 +1691,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1642,17 +1751,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" dependencies = [ "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] name = "tun2" -version = "2.0.5" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50ff242bea1c5ceb9b6aa4918cf340a6c157e1328a2389c5353cf91049d8cf17" +checksum = "2104af96dec2277bc9727a05846b0566b5f94c00005e701c3e861cebc45e095c" dependencies = [ "bytes", "cfg-if", + "futures", "futures-core", "ipnet", "libc", @@ -1662,8 +1772,8 @@ dependencies = [ "thiserror", "tokio", "tokio-util", - "windows-sys 0.52.0", - "wintun", + "windows-sys 0.59.0", + "wintun-bindings", ] [[package]] @@ -1729,9 +1839,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" dependencies = [ "rustls-pki-types", ] @@ -1754,11 +1864,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1785,6 +1895,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -1908,33 +2027,26 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] [[package]] -name = "winnow" -version = "0.6.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c" -dependencies = [ - "memchr", -] - -[[package]] -name = "wintun" -version = "0.5.0" +name = "wintun-bindings" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b196f9328341b035820c54beebca487823e2e20a5977f284f2af2a0ee8f04400" +checksum = "70756f591de368f0f4ad2761de198e8ab535551a59942a46da25328af0864b29" dependencies = [ + "blocking", "c2rust-bitfields", + "futures", "libloading", "log", "thiserror", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1943,6 +2055,27 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "zeroize" version = "1.8.1" diff --git a/Cargo.toml b/Cargo.toml index 02ee675..9b1712f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ jemalloc = ["dep:jemallocator"] quinn = "^0.11.1" # Interfaces and networking -tun2 = { version = "^2.0.0", features = ["async"] } +tun2 = { version = "^3.1.2", features = ["async"] } socket2 = "^0.5.2" bytes = "^1.4" etherparse = "^0.15.0" From b18dc10cd9621ffd0c2ee007d48e48549758c062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kub=C3=ADk?= Date: Wed, 4 Sep 2024 22:39:45 +0200 Subject: [PATCH 5/6] refactor: leverage DNS and gateway configuration from rust-tun --- src/client.rs | 35 +++++++---------- src/network/dns/mod.rs | 5 --- src/network/dns/windows.rs | 10 ----- src/network/interface.rs | 61 +++++++++++++++++++++++------- src/server/mod.rs | 2 +- tests/common/mod.rs | 15 ++++++-- tests/test_client_communication.rs | 1 + tests/test_client_isolation.rs | 1 + tests/test_end_to_end.rs | 1 + tests/test_failed_auth.rs | 1 + 10 files changed, 78 insertions(+), 54 deletions(-) delete mode 100644 src/network/dns/windows.rs diff --git a/src/client.rs b/src/client.rs index 74b55f3..4c7112e 100644 --- a/src/client.rs +++ b/src/client.rs @@ -10,10 +10,8 @@ use quinn::{Connection, Endpoint, VarInt}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs}; -use crate::network::dns::{add_dns_servers, delete_dns_servers}; use crate::network::interface::{Interface, InterfaceRead, InterfaceWrite}; use crate::network::packet::Packet; -use crate::network::route::add_routes; use futures::stream::FuturesUnordered; use futures::StreamExt; use std::sync::Arc; @@ -48,34 +46,29 @@ impl QuincyClient { info!("Received client address: {client_address}"); info!("Received server address: {server_address}"); + let routes = &self.config.network.routes; + let dns_servers = &self.config.network.dns_servers; let mtu = self.config.connection.mtu; - let interface = I::create(client_address, mtu)?; + let interface = I::create_client( + client_address, + server_address.addr(), + mtu, + routes, + dns_servers, + )?; let interface_name = interface.name()?; info!("Created interface: {interface_name}"); - - let routes = &self.config.network.routes; - let dns_servers = &self.config.network.dns_servers; - - if !routes.is_empty() { - add_routes(routes, &server_address.addr())?; - for route in routes { - info!("Added route: {route}"); - } - } - - if !dns_servers.is_empty() { - add_dns_servers(dns_servers, &interface_name)?; - for dns_server in dns_servers { - info!("Added DNS server: {dns_server}"); - } - } + info!("Added routes: {routes:?}"); + info!("Set DNS servers: {dns_servers:?}"); let relay_result = self .relay_packets(connection, interface, mtu as usize) .await; - if !dns_servers.is_empty() { + #[cfg(not(target_os = "windows"))] + { + use crate::network::dns::delete_dns_servers; delete_dns_servers()?; } diff --git a/src/network/dns/mod.rs b/src/network/dns/mod.rs index 133d16c..39108c7 100644 --- a/src/network/dns/mod.rs +++ b/src/network/dns/mod.rs @@ -7,8 +7,3 @@ pub use darwin::{add_dns_servers, delete_dns_servers}; mod linux; #[cfg(any(target_os = "linux", target_os = "freebsd"))] pub use linux::{add_dns_servers, delete_dns_servers}; - -#[cfg(target_os = "windows")] -mod windows; -#[cfg(target_os = "windows")] -pub use windows::{add_dns_servers, delete_dns_servers}; diff --git a/src/network/dns/windows.rs b/src/network/dns/windows.rs deleted file mode 100644 index 9a328dd..0000000 --- a/src/network/dns/windows.rs +++ /dev/null @@ -1,10 +0,0 @@ -use anyhow::Result; -use std::net::IpAddr; - -pub fn add_dns_servers(_dns_servers: &[IpAddr], _interface_name: &str) -> Result<()> { - unimplemented!() -} - -pub fn delete_dns_servers() -> Result<()> { - unimplemented!() -} diff --git a/src/network/interface.rs b/src/network/interface.rs index 1f48e43..c934932 100644 --- a/src/network/interface.rs +++ b/src/network/interface.rs @@ -1,9 +1,11 @@ #![allow(async_fn_in_trait)] use crate::network::packet::Packet; +use crate::network::route::add_routes; use anyhow::{Context, Result}; use bytes::BytesMut; use ipnet::IpNet; +use std::net::IpAddr; use tokio::io::{AsyncReadExt, AsyncWriteExt, ReadHalf, WriteHalf}; use tun2::{AbstractDevice, AsyncDevice, Configuration}; @@ -37,9 +39,15 @@ pub trait InterfaceWrite: AsyncWriteExt + Sized + Unpin + Send + 'static { } pub trait Interface: InterfaceRead + InterfaceWrite { - fn create(interface_address: IpNet, mtu: u16) -> Result; + fn create_server(interface_address: IpNet, mtu: u16) -> Result; - fn mtu(&self) -> Result; + fn create_client( + interface_address: IpNet, + tunnel_gateway: IpAddr, + mtu: u16, + routes: &[IpNet], + dns_servers: &[IpAddr], + ) -> Result; fn name(&self) -> Result; @@ -53,33 +61,58 @@ impl InterfaceWrite for WriteHalf {} impl InterfaceRead for AsyncDevice {} impl InterfaceWrite for AsyncDevice {} impl Interface for AsyncDevice { - fn create(interface_address: IpNet, mtu: u16) -> Result { + fn create_server(interface_address: IpNet, mtu: u16) -> Result { let mut config = Configuration::default(); config .address(interface_address.addr()) .netmask(interface_address.netmask()) + .destination(interface_address.network()) .mtu(mtu) .up(); - // Needed due to rust-tun using the destination address as the default GW - #[cfg(not(target_os = "windows"))] - config.destination(interface_address.network()); - let interface = tun2::create_as_async(&config)?; Ok(interface) } - fn mtu(&self) -> Result { - self.as_ref() - .mtu() - .context("failed to retrieve interface MTU") + fn create_client( + interface_address: IpNet, + tunnel_gateway: IpAddr, + mtu: u16, + routes: &[IpNet], + dns_servers: &[IpAddr], + ) -> Result { + let mut config = Configuration::default(); + + config + .address(interface_address.addr()) + .netmask(interface_address.netmask()) + .mtu(mtu) + .up(); + + #[cfg(not(target_os = "windows"))] + config.destination(tunnel_gateway); + + #[cfg(target_os = "windows")] + config.platform_config(|platform| { + platform.dns_servers(dns_servers); + }); + + let interface = tun2::create_as_async(&config)?; + + add_routes(routes, &interface_address.addr())?; + + #[cfg(not(target_os = "windows"))] + { + use crate::network::dns::add_dns_servers; + add_dns_servers(dns_servers, &interface.tun_name()?)?; + } + + Ok(interface) } fn name(&self) -> Result { - self.as_ref() - .tun_name() - .context("failed to retrieve interface name") + self.tun_name().context("failed to retrieve interface name") } } diff --git a/src/server/mod.rs b/src/server/mod.rs index cb4f575..21fc80f 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -50,7 +50,7 @@ impl QuincyServer { /// Starts the tasks for this instance of Quincy tunnel and listens for incoming connections. pub async fn run(&self) -> Result<()> { - let interface = I::create( + let interface = I::create_server( self.config.tunnel_network.into(), self.config.connection.mtu, )?; diff --git a/tests/common/mod.rs b/tests/common/mod.rs index f502898..5dcd354 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -104,15 +104,24 @@ pub const fn make_queue_pair() -> LazyLock<(TestSender, TestReceiver)> { macro_rules! interface_impl { ($name:ident, $test_queue_send:ident, $test_queue_recv:ident) => { impl Interface for $name { - fn create(_interface_address: IpNet, _mtu: u16) -> Result { + fn create_server(_interface_address: IpNet, _mtu: u16) -> Result { Ok(Self::new( $test_queue_send.0.clone(), $test_queue_recv.1.clone(), )) } - fn mtu(&self) -> Result { - Ok(1400) + fn create_client( + _interface_address: IpNet, + _tunnel_gateway: IpAddr, + _mtu: u16, + _routes: &[IpNet], + _dns_servers: &[IpAddr], + ) -> Result { + Ok(Self::new( + $test_queue_send.0.clone(), + $test_queue_recv.1.clone(), + )) } fn name(&self) -> Result { diff --git a/tests/test_client_communication.rs b/tests/test_client_communication.rs index a66b516..c5994b4 100644 --- a/tests/test_client_communication.rs +++ b/tests/test_client_communication.rs @@ -11,6 +11,7 @@ use quincy::{ server::QuincyServer, }; use rstest::rstest; +use std::net::IpAddr; use std::net::Ipv4Addr; use std::sync::LazyLock; diff --git a/tests/test_client_isolation.rs b/tests/test_client_isolation.rs index 700b22b..cd7a4a1 100644 --- a/tests/test_client_isolation.rs +++ b/tests/test_client_isolation.rs @@ -11,6 +11,7 @@ use quincy::{ server::QuincyServer, }; use rstest::rstest; +use std::net::IpAddr; use std::sync::LazyLock; use std::{net::Ipv4Addr, time::Duration}; use tokio::time::timeout; diff --git a/tests/test_end_to_end.rs b/tests/test_end_to_end.rs index 59c1a00..7d151f3 100644 --- a/tests/test_end_to_end.rs +++ b/tests/test_end_to_end.rs @@ -9,6 +9,7 @@ use quincy::config::{ClientConfig, ServerConfig}; use quincy::network::interface::Interface; use quincy::server::QuincyServer; use rstest::rstest; +use std::net::IpAddr; use std::net::Ipv4Addr; use std::sync::LazyLock; diff --git a/tests/test_failed_auth.rs b/tests/test_failed_auth.rs index 4cb384b..711b77f 100644 --- a/tests/test_failed_auth.rs +++ b/tests/test_failed_auth.rs @@ -9,6 +9,7 @@ use quincy::config::{ClientConfig, ServerConfig}; use quincy::network::interface::Interface; use quincy::server::QuincyServer; use rstest::rstest; +use std::net::IpAddr; use std::net::Ipv4Addr; use std::sync::LazyLock; use std::time::Duration; From c7b1f3d0f959479e8d0bd2797ff9b60dcf2f09ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kub=C3=ADk?= Date: Wed, 4 Sep 2024 23:18:42 +0200 Subject: [PATCH 6/6] chore: ignore CI-untestable code --- codecov.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codecov.yml b/codecov.yml index f185c06..0e63e79 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,5 @@ ignore: # Ignore all app entrypoints because they are not unit/integration tested - "src/bin" + # Ignore all network related code because it cannot be unit/integration tested in CI + - "src/network"