Skip to content

Commit ecd8ff3

Browse files
reduce deps, supposedly
1 parent 26e9bab commit ecd8ff3

File tree

4 files changed

+34
-168
lines changed

4 files changed

+34
-168
lines changed

Cargo.lock

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

iroh-netcheck/Cargo.toml

Lines changed: 15 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -10,120 +10,38 @@ rust-version = "1.76"
1010
workspace = true
1111

1212
[dependencies]
13-
cc = "=1.1.31" # enforce cc version, because of https://github.com/rust-lang/cc-rs/issues/1278
14-
15-
anyhow = { version = "1" }
16-
axum = { version = "0.7.4", optional = true }
17-
backoff = "0.4.0"
18-
base64 = "0.22.1"
13+
anyhow = "1"
1914
bytes = "1.7"
20-
clap = { version = "4", features = ["derive"], optional = true }
21-
der = { version = "0.7", features = ["alloc", "derive"] }
22-
derive_more = { version = "1.0.0", features = ["debug", "display", "from", "try_into", "deref"] }
15+
derive_more = { version = "1.0.0", features = ["display"] }
2316
futures-buffered = "0.2.8"
24-
futures-concurrency = "7.6.0"
2517
futures-lite = "2.3"
26-
futures-sink = "0.3.25"
27-
futures-util = "0.3.25"
28-
governor = "0.6.0"
29-
hex = "0.4.3"
30-
hickory-proto = "=0.25.0-alpha.2"
3118
hickory-resolver = "=0.25.0-alpha.2"
32-
hostname = "0.3.1"
33-
http = "1"
34-
http-body-util = "0.1.0"
35-
hyper = { version = "1", features = ["server", "client", "http1"] }
36-
hyper-util = "0.1.1"
37-
igd-next = { version = "0.15.1", features = ["aio_tokio"] }
38-
iroh-base = { version = "0.28.0", features = ["key"] }
19+
iroh-base = { version = "0.28.0", default-features = false, features = ["relay"] }
20+
iroh-metrics = { version = "0.28.0", default-features = false, optional = true }
3921
iroh-relay = { version = "0.28", path = "../iroh-relay" }
40-
libc = "0.2.139"
41-
netdev = "0.30.0"
4222
netwatch = { version = "0.1.0", path = "../net-tools/netwatch" }
43-
num_enum = "0.7"
44-
once_cell = "1.18.0"
45-
parking_lot = "0.12.1"
46-
pin-project = "1"
47-
pkarr = { version = "2", default-features = false, features = ["async", "relay"] }
4823
portmapper = { version = "0.1.0", path = "../net-tools/portmapper" }
49-
postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] }
50-
quinn = { package = "iroh-quinn", version = "0.12.0" }
51-
quinn-proto = { package = "iroh-quinn-proto", version = "0.12.0" }
52-
quinn-udp = { package = "iroh-quinn-udp", version = "0.5.5" }
5324
rand = "0.8"
54-
rcgen = "0.12"
55-
regex = { version = "1.7.1", optional = true }
56-
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }
57-
ring = "0.17"
58-
rustls = { version = "0.23", default-features = false, features = ["ring"] }
59-
serde = { version = "1", features = ["derive", "rc"] }
60-
smallvec = "1.11.1"
61-
socket2 = "0.5.3"
62-
stun-rs = "0.1.5"
25+
reqwest = { version = "0.12", default-features = false }
26+
rustls = { version = "0.23", default-features = false }
6327
surge-ping = "0.8.0"
6428
thiserror = "1"
65-
time = "0.3.20"
66-
tokio = { version = "1", features = ["io-util", "macros", "sync", "rt", "net", "fs", "io-std", "signal", "process"] }
67-
tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "ring"] }
68-
tokio-stream = { version = "0.1.15" }
69-
tokio-tungstenite = "0.21"
70-
tokio-tungstenite-wasm = "0.3"
71-
tokio-util = { version = "0.7.12", features = ["io-util", "io", "codec", "rt"] }
29+
tokio = { version = "1", default-features = false }
30+
tokio-util = { version = "0.7.12", default-features = false }
7231
tracing = "0.1"
73-
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }
74-
tungstenite = "0.21"
75-
url = { version = "2.4", features = ["serde"] }
76-
watchable = "1.1.2"
77-
webpki = { package = "rustls-webpki", version = "0.102" }
78-
webpki-roots = "0.26"
79-
x509-parser = "0.16"
80-
z32 = "1.0.3"
81-
82-
# metrics
83-
iroh-metrics = { version = "0.28.0", default-features = false }
84-
strum = { version = "0.26.2", features = ["derive"] }
85-
86-
# local-swarm-discovery
87-
swarm-discovery = { version = "0.2.1", optional = true }
88-
89-
# dht_discovery
90-
genawaiter = { version = "0.99.1", features = ["futures03"], optional = true }
91-
92-
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
93-
netlink-packet-core = "0.7.0"
94-
netlink-packet-route = "0.17.0"
95-
netlink-sys = "0.8.5"
96-
rtnetlink = "0.13.0"
97-
98-
[target.'cfg(target_os = "windows")'.dependencies]
99-
wmi = "0.13"
100-
windows = { version = "0.51", features = ["Win32_NetworkManagement_IpHelper", "Win32_Foundation", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"] }
32+
url = { version = "2.4" }
10133

10234
[dev-dependencies]
103-
axum = { version = "0.7.4" }
104-
clap = { version = "4", features = ["derive"] }
105-
criterion = "0.5.1"
106-
crypto_box = { version = "0.9.1", features = ["serde", "chacha20"] }
107-
pretty_assertions = "1.4"
108-
rand_chacha = "0.3.1"
109-
tokio = { version = "1", features = ["io-util", "sync", "rt", "net", "fs", "macros", "time", "test-util"] }
110-
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
35+
iroh-relay = { version = "0.28", path = "../iroh-relay", features = ["test-utils", "server"] }
11136
iroh-test = "0.28.0"
112-
serde_json = "1.0.107"
37+
once_cell = "1.18.0"
38+
pretty_assertions = "1.4"
11339
testresult = "0.4.0"
114-
mainline = "2.0.1"
115-
iroh-relay = { version = "0.28", path = "../iroh-relay", features = ["test-utils", "server"] }
116-
117-
118-
[build-dependencies]
119-
duct = "0.13.6"
40+
tokio = { version = "1", default-features = false, features = ["test-util"] }
12041

12142
[features]
122-
default = ["metrics", "discovery-pkarr-dht"]
123-
metrics = ["iroh-metrics/metrics"]
124-
test-utils = ["iroh-relay/test-utils", "iroh-relay/server", "dep:axum"]
125-
discovery-local-network = ["dep:swarm-discovery"]
126-
discovery-pkarr-dht = ["pkarr/dht", "dep:genawaiter"]
43+
default = ["metrics"]
44+
metrics = ["dep:iroh-metrics"]
12745

12846
[package.metadata.docs.rs]
12947
all-features = true

iroh-netcheck/src/lib.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use anyhow::{anyhow, Context as _, Result};
1717
use bytes::Bytes;
1818
use hickory_resolver::TokioAsyncResolver as DnsResolver;
1919
use iroh_base::relay_map::{RelayMap, RelayNode, RelayUrl};
20+
#[cfg(feature = "metrics")]
2021
use iroh_metrics::inc;
2122
use iroh_relay::protos::stun;
2223
use netwatch::{IpFamily, UdpSocket};
@@ -29,12 +30,13 @@ use tracing::{debug, error, info_span, trace, warn, Instrument};
2930

3031
pub mod defaults;
3132
mod dns;
33+
#[cfg(feature = "metrics")]
3234
mod metrics;
3335
mod ping;
3436
mod reportgen;
3537

38+
#[cfg(feature = "metrics")]
3639
pub use metrics::Metrics;
37-
use Metrics as NetcheckMetrics;
3840

3941
const FULL_REPORT_INTERVAL: Duration = Duration::from_secs(5 * 60);
4042

@@ -356,7 +358,8 @@ impl Addr {
356358
payload,
357359
from_addr: src,
358360
}) {
359-
inc!(NetcheckMetrics, stun_packets_dropped);
361+
#[cfg(feature = "metrics")]
362+
inc!(Metrics, stun_packets_dropped);
360363
warn!("dropping stun packet from {}", src);
361364
}
362365
}
@@ -512,9 +515,11 @@ impl Actor {
512515
self.reports.last = None; // causes ProbePlan::new below to do a full (initial) plan
513516
self.reports.next_full = false;
514517
self.reports.last_full = now;
515-
inc!(NetcheckMetrics, reports_full);
518+
#[cfg(feature = "metrics")]
519+
inc!(Metrics, reports_full);
516520
}
517-
inc!(NetcheckMetrics, reports);
521+
#[cfg(feature = "metrics")]
522+
inc!(Metrics, reports);
518523

519524
let actor = reportgen::Client::new(
520525
self.addr(),
@@ -558,12 +563,13 @@ impl Actor {
558563
return;
559564
}
560565

566+
#[cfg(feature = "metrics")]
561567
match &src {
562568
SocketAddr::V4(_) => {
563-
inc!(NetcheckMetrics, stun_packets_recv_ipv4);
569+
inc!(Metrics, stun_packets_recv_ipv4);
564570
}
565571
SocketAddr::V6(_) => {
566-
inc!(NetcheckMetrics, stun_packets_recv_ipv6);
572+
inc!(Metrics, stun_packets_recv_ipv6);
567573
}
568574
}
569575

iroh-netcheck/src/reportgen.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use std::{
2727

2828
use anyhow::{anyhow, bail, Context as _, Result};
2929
use hickory_resolver::TokioAsyncResolver as DnsResolver;
30+
#[cfg(feature = "metrics")]
3031
use iroh_metrics::inc;
3132
use iroh_relay::{http::RELAY_PROBE_PATH, protos::stun};
3233
use netwatch::{interfaces, UdpSocket};
@@ -40,7 +41,8 @@ use tokio_util::task::AbortOnDropHandle;
4041
use tracing::{debug, debug_span, error, info_span, trace, warn, Instrument, Span};
4142
use url::Host;
4243

43-
use super::NetcheckMetrics;
44+
#[cfg(feature = "metrics")]
45+
use crate::Metrics;
4446
use crate::{
4547
self as netcheck,
4648
defaults::DEFAULT_STUN_PORT,
@@ -807,10 +809,12 @@ async fn run_stun_probe(
807809

808810
if matches!(probe, Probe::StunIpv4 { .. }) {
809811
result.ipv4_can_send = true;
810-
inc!(NetcheckMetrics, stun_packets_sent_ipv4);
812+
#[cfg(feature = "metrics")]
813+
inc!(Metrics, stun_packets_sent_ipv4);
811814
} else {
812815
result.ipv6_can_send = true;
813-
inc!(NetcheckMetrics, stun_packets_sent_ipv6);
816+
#[cfg(feature = "metrics")]
817+
inc!(Metrics, stun_packets_sent_ipv6);
814818
}
815819
let (delay, addr) = stun_rx
816820
.await

0 commit comments

Comments
 (0)