Skip to content

Commit a37dcfc

Browse files
fix!: cleanup dead and unused dependencies (#3070)
## Description <!-- A summary of what this pull request achieves and a rough list of changes. --> ## Breaking Changes - removed `regex` feature (as the dependency is not used anymore) ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
1 parent 1cd0e96 commit a37dcfc

File tree

9 files changed

+22
-128
lines changed

9 files changed

+22
-128
lines changed

Cargo.lock

Lines changed: 2 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iroh-net-report/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ rand = "0.8"
3232
reqwest = { version = "0.12", default-features = false }
3333
rustls = { version = "0.23", default-features = false }
3434
surge-ping = "0.8.0"
35-
thiserror = "1"
35+
thiserror = "2"
3636
tokio = { version = "1", default-features = false, features = ["sync", "time", "macros", "rt"] }
3737
tokio-util = { version = "0.7.12", default-features = false }
3838
tracing = "0.1"
@@ -41,7 +41,6 @@ url = { version = "2.4" }
4141
[dev-dependencies]
4242
iroh-relay = { path = "../iroh-relay", features = ["test-utils", "server"] }
4343
iroh-test = { path = "../iroh-test" }
44-
once_cell = "1.18.0"
4544
pretty_assertions = "1.4"
4645
testresult = "0.4.0"
4746
tokio = { version = "1", default-features = false, features = ["test-util"] }

iroh-net-report/src/dns.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,19 @@ async fn stagger_call<T, F: Fn() -> Fut, Fut: Future<Output = Result<T>>>(
182182

183183
#[cfg(test)]
184184
pub(crate) mod tests {
185-
use std::{net::Ipv6Addr, sync::atomic::AtomicUsize};
186-
187-
use once_cell::sync::Lazy;
185+
use std::{
186+
net::Ipv6Addr,
187+
sync::{atomic::AtomicUsize, OnceLock},
188+
};
188189

189190
use super::*;
190191

191-
static DNS_RESOLVER: Lazy<TokioResolver> =
192-
Lazy::new(|| create_default_resolver().expect("unable to create DNS resolver"));
192+
static DNS_RESOLVER: OnceLock<TokioResolver> = OnceLock::new();
193193

194194
/// Get a DNS resolver suitable for testing.
195195
pub fn resolver() -> &'static TokioResolver {
196-
Lazy::force(&DNS_RESOLVER)
196+
DNS_RESOLVER
197+
.get_or_init(|| create_default_resolver().expect("unable to create DNS resolver"))
197198
}
198199

199200
/// Deprecated IPv6 site-local anycast addresses still configured by windows.

iroh-relay/Cargo.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ workspace = true
1515

1616
[dependencies]
1717
anyhow = { version = "1" }
18-
base64 = "0.22.1"
1918
bytes = "1.7"
2019
clap = { version = "4", features = ["derive"], optional = true }
2120
derive_more = { version = "1.0.0", features = [
@@ -32,16 +31,13 @@ futures-util = "0.3"
3231
governor = "0.7.0"
3332
hickory-proto = { version = "=0.25.0-alpha.4" }
3433
hickory-resolver = "=0.25.0-alpha.4"
35-
hostname = "0.4"
3634
http = "1"
3735
http-body-util = "0.1.0"
3836
hyper = { version = "1", features = ["server", "client", "http1"] }
3937
hyper-util = "0.1.1"
4038
iroh-base = { version = "0.30.0", path = "../iroh-base", default-features = false, features = ["key", "relay"] }
4139
iroh-metrics = { version = "0.30.0", default-features = false }
42-
libc = "0.2.139"
4340
num_enum = "0.7"
44-
once_cell = "1.18.0"
4541
pin-project = "1"
4642
postcard = { version = "1", default-features = false, features = [
4743
"alloc",
@@ -57,14 +53,11 @@ reloadable-state = { version = "0.1", optional = true }
5753
reqwest = { version = "0.12", default-features = false, features = [
5854
"rustls-tls",
5955
] }
60-
ring = "0.17"
6156
rustls = { version = "0.23", default-features = false, features = ["ring"] }
6257
rustls-cert-reloadable-resolver = { version = "0.7.1", optional = true }
6358
rustls-cert-file-reader = { version = "0.4.1", optional = true }
6459
rustls-pemfile = { version = "2.1", optional = true }
6560
serde = { version = "1", features = ["derive", "rc"] }
66-
smallvec = "1.11.1"
67-
socket2 = "0.5.3"
6861
stun-rs = "0.1.5"
6962
thiserror = "2"
7063
time = "0.3.20"

iroh-relay/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use std::{
1010
time::Duration,
1111
};
1212

13-
use base64::{engine::general_purpose::URL_SAFE, Engine as _};
1413
use bytes::Bytes;
1514
use conn::{Conn, ConnBuilder, ConnReader, ConnReceiver, ConnWriter, ReceivedMessage};
15+
use data_encoding::BASE64URL;
1616
use futures_util::StreamExt;
1717
use hickory_resolver::TokioResolver as DnsResolver;
1818
use http_body_util::Empty;
@@ -947,7 +947,7 @@ impl Actor {
947947
proxy_url.username(),
948948
proxy_url.password().unwrap_or_default()
949949
);
950-
let encoded = URL_SAFE.encode(to_encode);
950+
let encoded = BASE64URL.encode(to_encode.as_bytes());
951951
req_builder = req_builder.header("Proxy-Authorization", format!("Basic {}", encoded));
952952
}
953953
let req = req_builder.body(Empty::<Bytes>::new())?;

iroh-relay/src/dns.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
use std::net::{IpAddr, Ipv6Addr};
1+
use std::{
2+
net::{IpAddr, Ipv6Addr},
3+
sync::OnceLock,
4+
};
25

36
use anyhow::Result;
47
use hickory_resolver::{Resolver, TokioResolver};
5-
use once_cell::sync::Lazy;
68

79
/// The DNS resolver type used throughout `iroh`.
810
pub(crate) type DnsResolver = TokioResolver;
911

10-
static DNS_RESOLVER: Lazy<TokioResolver> =
11-
Lazy::new(|| create_default_resolver().expect("unable to create DNS resolver"));
12+
static DNS_RESOLVER: OnceLock<TokioResolver> = OnceLock::new();
1213

1314
/// Get a reference to the default DNS resolver.
1415
///
1516
/// The default resolver can be cheaply cloned and is shared throughout the running process.
1617
/// It is configured to use the system's DNS configuration.
1718
pub fn default_resolver() -> &'static DnsResolver {
18-
&DNS_RESOLVER
19+
DNS_RESOLVER.get_or_init(|| create_default_resolver().expect("unable to create DNS resolver"))
1920
}
2021

2122
/// Deprecated IPv6 site-local anycast addresses still configured by windows.

0 commit comments

Comments
 (0)