Skip to content

Commit

Permalink
fix!: cleanup dead and unused dependencies (#3070)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
dignifiedquire authored Dec 24, 2024
1 parent 1cd0e96 commit a37dcfc
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 128 deletions.
67 changes: 2 additions & 65 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions iroh-net-report/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"] }
Expand Down
13 changes: 7 additions & 6 deletions iroh-net-report/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,19 @@ async fn stagger_call<T, F: Fn() -> Fut, Fut: Future<Output = Result<T>>>(

#[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<TokioResolver> =
Lazy::new(|| create_default_resolver().expect("unable to create DNS resolver"));
static DNS_RESOLVER: OnceLock<TokioResolver> = 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.
Expand Down
7 changes: 0 additions & 7 deletions iroh-relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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",
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions iroh-relay/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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::<Bytes>::new())?;
Expand Down
11 changes: 6 additions & 5 deletions iroh-relay/src/dns.rs
Original file line number Diff line number Diff line change
@@ -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<TokioResolver> =
Lazy::new(|| create_default_resolver().expect("unable to create DNS resolver"));
static DNS_RESOLVER: OnceLock<TokioResolver> = 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.
Expand Down
Loading

0 comments on commit a37dcfc

Please sign in to comment.