diff --git a/Cargo.lock b/Cargo.lock index 3feccf73a2..d451c4b24a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1611,17 +1611,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "hostname" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9c7c7c8ac16c798734b8a24560c1362120597c40d5e1459f09498f8f6c8f2ba" -dependencies = [ - "cfg-if", - "libc", - "windows 0.52.0", -] - [[package]] name = "hostname-validator" version = "1.1.1" @@ -2013,7 +2002,6 @@ dependencies = [ "anyhow", "axum", "backoff", - "base64", "bytes", "clap", "concurrent-queue", @@ -2028,7 +2016,6 @@ dependencies = [ "futures-util", "governor 0.7.0", "hickory-resolver", - "hostname 0.4.0", "http 1.2.0", "http-body-util", "hyper", @@ -2043,42 +2030,28 @@ dependencies = [ "iroh-quinn-udp", "iroh-relay", "iroh-test 0.30.0", - "libc", "netdev", - "netlink-packet-core", - "netlink-packet-route 0.19.0", - "netlink-packet-route 0.21.0", - "netlink-sys", "netwatch", - "num_enum", - "once_cell", "parse-size", "pin-project", "pkarr", "portmapper", - "postcard", "pretty_assertions", "rand", "rand_chacha", "rcgen", - "regex", "reqwest", "ring", - "rtnetlink 0.13.1", - "rtnetlink 0.14.1", "rustls", "rustls-webpki", "serde", "serde_json", "smallvec", - "socket2", "strum", "stun-rs", - "surge-ping", "swarm-discovery", "testresult", "thiserror 2.0.7", - "time", "tokio", "tokio-rustls", "tokio-stream", @@ -2089,8 +2062,6 @@ dependencies = [ "tracing-subscriber", "url", "webpki-roots", - "windows 0.58.0", - "wmi", "x509-parser", "z32", ] @@ -2130,7 +2101,6 @@ dependencies = [ "iroh-quinn", "rcgen", "rustls", - "socket2", "tokio", "tracing", "tracing-subscriber", @@ -2223,7 +2193,6 @@ dependencies = [ "iroh-relay", "iroh-test 0.30.0", "netwatch", - "once_cell", "portmapper", "pretty_assertions", "rand", @@ -2231,7 +2200,7 @@ dependencies = [ "rustls", "surge-ping", "testresult", - "thiserror 1.0.69", + "thiserror 2.0.7", "tokio", "tokio-util", "tracing", @@ -2292,7 +2261,6 @@ name = "iroh-relay" version = "0.30.0" dependencies = [ "anyhow", - "base64", "bytes", "clap", "crypto_box", @@ -2305,7 +2273,6 @@ dependencies = [ "governor 0.7.0", "hickory-proto", "hickory-resolver", - "hostname 0.4.0", "http 1.2.0", "http-body-util", "hyper", @@ -2315,10 +2282,8 @@ dependencies = [ "iroh-quinn", "iroh-quinn-proto", "iroh-test 0.30.0", - "libc", "lru", "num_enum", - "once_cell", "pin-project", "postcard", "proptest", @@ -2328,7 +2293,6 @@ dependencies = [ "regex", "reloadable-state", "reqwest", - "ring", "rustls", "rustls-cert-file-reader", "rustls-cert-reloadable-resolver", @@ -2336,8 +2300,6 @@ dependencies = [ "rustls-webpki", "serde", "serde_json", - "smallvec", - "socket2", "stun-rs", "testresult", "thiserror 2.0.7", @@ -2693,21 +2655,6 @@ dependencies = [ "netlink-packet-utils", ] -[[package]] -name = "netlink-packet-route" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "483325d4bfef65699214858f097d504eb812c38ce7077d165f301ec406c3066e" -dependencies = [ - "anyhow", - "bitflags 2.6.0", - "byteorder", - "libc", - "log", - "netlink-packet-core", - "netlink-packet-utils", -] - [[package]] name = "netlink-packet-utils" version = "0.5.2" @@ -3724,7 +3671,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ - "hostname 0.3.1", + "hostname", "quick-error", ] @@ -5254,16 +5201,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core 0.52.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows" version = "0.58.0" diff --git a/iroh-net-report/Cargo.toml b/iroh-net-report/Cargo.toml index ceea716e63..b2cabb734f 100644 --- a/iroh-net-report/Cargo.toml +++ b/iroh-net-report/Cargo.toml @@ -32,7 +32,7 @@ rand = "0.8" reqwest = { version = "0.12", default-features = false } rustls = { version = "0.23", default-features = false } surge-ping = "0.8.0" -thiserror = "1" +thiserror = "2" tokio = { version = "1", default-features = false, features = ["sync", "time", "macros", "rt"] } tokio-util = { version = "0.7.12", default-features = false } tracing = "0.1" @@ -41,7 +41,6 @@ url = { version = "2.4" } [dev-dependencies] iroh-relay = { path = "../iroh-relay", features = ["test-utils", "server"] } iroh-test = { path = "../iroh-test" } -once_cell = "1.18.0" pretty_assertions = "1.4" testresult = "0.4.0" tokio = { version = "1", default-features = false, features = ["test-util"] } diff --git a/iroh-net-report/src/dns.rs b/iroh-net-report/src/dns.rs index 9ac16fc1a9..325d4bbf83 100644 --- a/iroh-net-report/src/dns.rs +++ b/iroh-net-report/src/dns.rs @@ -182,18 +182,19 @@ async fn stagger_call Fut, Fut: Future>>( #[cfg(test)] pub(crate) mod tests { - use std::{net::Ipv6Addr, sync::atomic::AtomicUsize}; - - use once_cell::sync::Lazy; + use std::{ + net::Ipv6Addr, + sync::{atomic::AtomicUsize, OnceLock}, + }; use super::*; - static DNS_RESOLVER: Lazy = - Lazy::new(|| create_default_resolver().expect("unable to create DNS resolver")); + static DNS_RESOLVER: OnceLock = OnceLock::new(); /// Get a DNS resolver suitable for testing. pub fn resolver() -> &'static TokioResolver { - Lazy::force(&DNS_RESOLVER) + DNS_RESOLVER + .get_or_init(|| create_default_resolver().expect("unable to create DNS resolver")) } /// Deprecated IPv6 site-local anycast addresses still configured by windows. diff --git a/iroh-relay/Cargo.toml b/iroh-relay/Cargo.toml index c03b2b63ac..531114913b 100644 --- a/iroh-relay/Cargo.toml +++ b/iroh-relay/Cargo.toml @@ -15,7 +15,6 @@ workspace = true [dependencies] anyhow = { version = "1" } -base64 = "0.22.1" bytes = "1.7" clap = { version = "4", features = ["derive"], optional = true } derive_more = { version = "1.0.0", features = [ @@ -32,16 +31,13 @@ futures-util = "0.3" governor = "0.7.0" hickory-proto = { version = "=0.25.0-alpha.4" } hickory-resolver = "=0.25.0-alpha.4" -hostname = "0.4" http = "1" http-body-util = "0.1.0" hyper = { version = "1", features = ["server", "client", "http1"] } hyper-util = "0.1.1" iroh-base = { version = "0.30.0", path = "../iroh-base", default-features = false, features = ["key", "relay"] } iroh-metrics = { version = "0.30.0", default-features = false } -libc = "0.2.139" num_enum = "0.7" -once_cell = "1.18.0" pin-project = "1" postcard = { version = "1", default-features = false, features = [ "alloc", @@ -57,14 +53,11 @@ reloadable-state = { version = "0.1", optional = true } reqwest = { version = "0.12", default-features = false, features = [ "rustls-tls", ] } -ring = "0.17" rustls = { version = "0.23", default-features = false, features = ["ring"] } rustls-cert-reloadable-resolver = { version = "0.7.1", optional = true } rustls-cert-file-reader = { version = "0.4.1", optional = true } rustls-pemfile = { version = "2.1", optional = true } serde = { version = "1", features = ["derive", "rc"] } -smallvec = "1.11.1" -socket2 = "0.5.3" stun-rs = "0.1.5" thiserror = "2" time = "0.3.20" diff --git a/iroh-relay/src/client.rs b/iroh-relay/src/client.rs index 590b002ce6..22adaa1608 100644 --- a/iroh-relay/src/client.rs +++ b/iroh-relay/src/client.rs @@ -10,9 +10,9 @@ use std::{ time::Duration, }; -use base64::{engine::general_purpose::URL_SAFE, Engine as _}; use bytes::Bytes; use conn::{Conn, ConnBuilder, ConnReader, ConnReceiver, ConnWriter, ReceivedMessage}; +use data_encoding::BASE64URL; use futures_util::StreamExt; use hickory_resolver::TokioResolver as DnsResolver; use http_body_util::Empty; @@ -947,7 +947,7 @@ impl Actor { proxy_url.username(), proxy_url.password().unwrap_or_default() ); - let encoded = URL_SAFE.encode(to_encode); + let encoded = BASE64URL.encode(to_encode.as_bytes()); req_builder = req_builder.header("Proxy-Authorization", format!("Basic {}", encoded)); } let req = req_builder.body(Empty::::new())?; diff --git a/iroh-relay/src/dns.rs b/iroh-relay/src/dns.rs index 81e0739162..f34941b9b5 100644 --- a/iroh-relay/src/dns.rs +++ b/iroh-relay/src/dns.rs @@ -1,21 +1,22 @@ -use std::net::{IpAddr, Ipv6Addr}; +use std::{ + net::{IpAddr, Ipv6Addr}, + sync::OnceLock, +}; use anyhow::Result; use hickory_resolver::{Resolver, TokioResolver}; -use once_cell::sync::Lazy; /// The DNS resolver type used throughout `iroh`. pub(crate) type DnsResolver = TokioResolver; -static DNS_RESOLVER: Lazy = - Lazy::new(|| create_default_resolver().expect("unable to create DNS resolver")); +static DNS_RESOLVER: OnceLock = OnceLock::new(); /// Get a reference to the default DNS resolver. /// /// The default resolver can be cheaply cloned and is shared throughout the running process. /// It is configured to use the system's DNS configuration. pub fn default_resolver() -> &'static DnsResolver { - &DNS_RESOLVER + DNS_RESOLVER.get_or_init(|| create_default_resolver().expect("unable to create DNS resolver")) } /// Deprecated IPv6 site-local anycast addresses still configured by windows. diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml index 39aff890d1..943660ea5c 100644 --- a/iroh/Cargo.toml +++ b/iroh/Cargo.toml @@ -21,7 +21,6 @@ anyhow = { version = "1" } concurrent-queue = "2.5" axum = { version = "0.7", optional = true } backoff = "0.4.0" -base64 = "0.22.1" bytes = "1.7" crypto_box = { version = "0.9.1", features = ["serde", "chacha20"] } data-encoding = "2.2" @@ -41,7 +40,6 @@ futures-sink = "0.3" futures-util = "0.3" governor = "0.7.0" hickory-resolver = { version = "=0.25.0-alpha.4" } -hostname = "0.4" http = "1" http-body-util = "0.1.0" hyper = { version = "1", features = ["server", "client", "http1"] } @@ -49,28 +47,19 @@ hyper-util = "0.1.1" igd-next = { version = "0.15.1", features = ["aio_tokio"] } iroh-base = { version = "0.30.0", default-features = false, features = ["key", "relay"], path = "../iroh-base" } iroh-relay = { version = "0.30", path = "../iroh-relay", default-features = false } -libc = "0.2.139" netdev = "0.31.0" netwatch = { version = "0.2.0" } -num_enum = "0.7" -once_cell = "1.18.0" pin-project = "1" pkarr = { version = "2", default-features = false, features = [ "async", "relay", ] } portmapper = { version = "0.3.0", default-features = false } -postcard = { version = "1", default-features = false, features = [ - "alloc", - "use-std", - "experimental-derive", -] } quinn = { package = "iroh-quinn", version = "0.12.0" } quinn-proto = { package = "iroh-quinn-proto", version = "0.12.0" } quinn-udp = { package = "iroh-quinn-udp", version = "0.5.5" } rand = "0.8" rcgen = "0.13" -regex = { version = "1.7.1", optional = true } reqwest = { version = "0.12", default-features = false, features = [ "rustls-tls", ] } @@ -79,11 +68,8 @@ rustls = { version = "0.23", default-features = false, features = ["ring"] } serde = { version = "1", features = ["derive", "rc"] } smallvec = "1.11.1" strum = { version = "0.26", features = ["derive"] } -socket2 = "0.5.3" stun-rs = "0.1.5" -surge-ping = "0.8.0" thiserror = "2" -time = "0.3.20" tokio = { version = "1", features = [ "io-util", "macros", @@ -125,27 +111,6 @@ tracing-subscriber = { version = "0.3", features = [ indicatif = { version = "0.17", features = ["tokio"], optional = true } parse-size = { version = "=1.0.0", optional = true } # pinned version to avoid bumping msrv to 1.81 -[target.'cfg(all(target_os = "linux", not(target_os = "android")))'.dependencies] -netlink-packet-core = "0.7.0" -netlink-packet-route = "0.21" -netlink-sys = "0.8.6" -rtnetlink = "=0.14.1" # pinned because of https://github.com/rust-netlink/rtnetlink/issues/83 - -[target.'cfg(target_os = "android")'.dependencies] -netlink-packet-core = "0.7.0" -netlink-packet-route = "0.19" # 0.20/21 is blocked on rtnetlink bumping its dependency -netlink-sys = "0.8.6" -rtnetlink = "=0.13.1" # pinned because of https://github.com/rust-netlink/rtnetlink/issues/83 - -[target.'cfg(target_os = "windows")'.dependencies] -wmi = "0.14" -windows = { version = "0.58", features = [ - "Win32_NetworkManagement_IpHelper", - "Win32_Foundation", - "Win32_NetworkManagement_Ndis", - "Win32_Networking_WinSock", -] } - [dev-dependencies] axum = { version = "0.7" } clap = { version = "4", features = ["derive"] } diff --git a/iroh/bench/Cargo.toml b/iroh/bench/Cargo.toml index e50501c3b8..5203c71440 100644 --- a/iroh/bench/Cargo.toml +++ b/iroh/bench/Cargo.toml @@ -24,7 +24,6 @@ tracing-subscriber = { version = "0.3.0", default-features = false, features = [ "time", "local-time", ] } -socket2 = "0.5" futures-lite = "2.5" [features] diff --git a/iroh/src/dns.rs b/iroh/src/dns.rs index 9f39cb4f0f..5aa09b1a5e 100644 --- a/iroh/src/dns.rs +++ b/iroh/src/dns.rs @@ -8,6 +8,7 @@ use std::{ fmt::Write, net::{IpAddr, Ipv6Addr}, + sync::OnceLock, time::Duration, }; @@ -15,27 +16,25 @@ use anyhow::Result; use futures_lite::{Future, StreamExt}; use hickory_resolver::{IntoName, Resolver, TokioResolver}; use iroh_base::{NodeAddr, NodeId}; -use once_cell::sync::Lazy; pub mod node_info; /// The DNS resolver type used throughout `iroh`. pub type DnsResolver = TokioResolver; -static DNS_RESOLVER: Lazy = - Lazy::new(|| create_default_resolver().expect("unable to create DNS resolver")); +static DNS_RESOLVER: OnceLock = OnceLock::new(); /// Get a reference to the default DNS resolver. /// /// The default resolver can be cheaply cloned and is shared throughout the running process. /// It is configured to use the system's DNS configuration. pub fn default_resolver() -> &'static DnsResolver { - &DNS_RESOLVER + resolver() } /// Get the DNS resolver used within iroh. pub fn resolver() -> &'static TokioResolver { - Lazy::force(&DNS_RESOLVER) + DNS_RESOLVER.get_or_init(|| create_default_resolver().expect("unable to create DNS resolver")) } /// Deprecated IPv6 site-local anycast addresses still configured by windows.