Skip to content

Commit c81fe21

Browse files
ramfox“ramfox”
andauthored
chore: add test-utils cfg for insecure_cert call in the transfer example (#3458)
also, upgrade netwatch, portmapper, and n0-snafu deps --------- Co-authored-by: “ramfox” <“[email protected]”>
1 parent 4583b12 commit c81fe21

File tree

6 files changed

+87
-44
lines changed

6 files changed

+87
-44
lines changed

Cargo.lock

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

iroh-base/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ postcard = { version = "1", default-features = false, features = ["alloc", "use-
2424
rand_core = { version = "0.6.4", optional = true }
2525
serde = { version = "1", features = ["derive", "rc"] }
2626
snafu = { version = "0.8.5", features = ["rust_1_81"], optional = true }
27-
n0-snafu = "0.2.0"
27+
n0-snafu = "0.2.2"
2828
nested_enum_utils = "0.2.0"
2929

3030
[dev-dependencies]

iroh-dns-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ humantime-serde = "1.1.1"
3131
iroh-metrics = { version = "0.35", features = ["service"] }
3232
lru = "0.13"
3333
n0-future = "0.1.2"
34-
n0-snafu = "0.2.0"
34+
n0-snafu = "0.2.2"
3535
pkarr = { version = "3.7", features = ["relays", "dht"], default-features = false }
3636
rcgen = "0.13"
3737
redb = "=2.4.0" # 2.5.0 has MSRV 1.85

iroh-relay/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ data-encoding = "2.6.0"
7272
lru = "0.13"
7373
z32 = "1.0.3"
7474
snafu = { version = "0.8.5", features = ["rust_1_81"] }
75-
n0-snafu = "0.2.0"
75+
n0-snafu = "0.2.2"
7676
nested_enum_utils = "0.2.0"
7777

7878
# server feature

iroh/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ http = "1"
4040
iroh-base = { version = "0.91.2", default-features = false, features = ["key", "relay"], path = "../iroh-base" }
4141
iroh-relay = { version = "0.91", path = "../iroh-relay", default-features = false }
4242
n0-future = "0.1.2"
43-
n0-snafu = "0.2.1"
43+
n0-snafu = "0.2.2"
4444
n0-watcher = "0.3"
4545
nested_enum_utils = "0.2.1"
46-
netwatch = { version = "0.8" }
46+
netwatch = { version = "0.9" }
4747
pin-project = "1"
4848
pkarr = { version = "3.7", default-features = false, features = [
4949
"relays",
@@ -102,13 +102,12 @@ tracing-subscriber = { version = "0.3", features = [
102102
indicatif = { version = "0.18", features = ["tokio"], optional = true }
103103
parse-size = { version = "=1.0.0", optional = true, features = ['std'] } # pinned version to avoid bumping msrv to 1.81
104104

105-
106105
# non-wasm-in-browser dependencies
107106
[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies]
108107
hickory-resolver = "0.25.1"
109108
igd-next = { version = "0.16", features = ["aio_tokio"] }
110109
netdev = { version = "0.36.0" }
111-
portmapper = { version = "0.8", default-features = false }
110+
portmapper = { version = "0.9", default-features = false }
112111
quinn = { package = "iroh-quinn", version = "0.14.0", default-features = false, features = ["runtime-tokio", "rustls-ring"] }
113112
tokio = { version = "1", features = [
114113
"io-util",

iroh/examples/transfer.rs

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const DEV_DNS_SERVER: &str = "127.0.0.1:5300";
4040
///
4141
/// --relay-only needs the `test-utils` feature
4242
///
43+
/// --dev needs the `test-utils` feature
44+
///
4345
/// --mdns needs the `discovery-local-network` feature
4446
///
4547
/// To enable all features, run the example with --all-features:
@@ -128,7 +130,6 @@ struct EndpointArgs {
128130
/// Do not resolve node info via DNS.
129131
#[clap(long)]
130132
no_dns_resolve: bool,
131-
#[cfg(feature = "discovery-local-network")]
132133
#[clap(long)]
133134
/// Enable mDNS discovery.
134135
mdns: bool,
@@ -192,8 +193,18 @@ impl EndpointArgs {
192193
}
193194
};
194195
builder = builder.secret_key(secret_key);
196+
195197
if Env::Dev == self.env {
196-
builder = builder.insecure_skip_relay_cert_verify(true);
198+
#[cfg(feature = "test-utils")]
199+
{
200+
builder = builder.insecure_skip_relay_cert_verify(true);
201+
}
202+
#[cfg(not(feature = "test-utils"))]
203+
{
204+
snafu::whatever!(
205+
"Must have the `test-utils` feature enabled when using the `--env=dev` flag"
206+
)
207+
}
197208
}
198209

199210
let relay_mode = if self.no_relay {
@@ -219,14 +230,30 @@ impl EndpointArgs {
219230
builder = builder.add_discovery(DnsDiscovery::builder(domain));
220231
}
221232

222-
#[cfg(feature = "discovery-local-network")]
223233
if self.mdns {
224-
builder = builder.discovery_local_network();
234+
#[cfg(feature = "discovery-local-network")]
235+
{
236+
builder = builder.discovery_local_network();
237+
}
238+
#[cfg(not(feature = "discovery-local-network"))]
239+
{
240+
snafu::whatever!(
241+
"Must have the `test-utils` feature enabled when using the `--relay-only` flag"
242+
);
243+
}
225244
}
226245

227-
#[cfg(feature = "test-utils")]
228246
if self.relay_only {
229-
builder = builder.path_selection(iroh::endpoint::PathSelection::RelayOnly)
247+
#[cfg(feature = "test-utils")]
248+
{
249+
builder = builder.path_selection(iroh::endpoint::PathSelection::RelayOnly)
250+
}
251+
#[cfg(not(feature = "test-utils"))]
252+
{
253+
snafu::whatever!(
254+
"Must have the `discovery-local-network` enabled when using the `--mdns` flag"
255+
);
256+
}
230257
}
231258

232259
if let Some(host) = self.dns_server {

0 commit comments

Comments
 (0)