Skip to content

Commit 2507e62

Browse files
authored
fix(iroh-relay): Respect enable_stun setting in iroh-relay::Config (#2879)
## Description Previously, the `Config::enable_stun` value was written but never read, so you couldn't actually disable stun using your iroh config. ## Breaking Changes - For anyone deploying their relay server: The relay server now *actually* respects the `enable_stun` config value. If you set it to `false` previously, that did not have an effect, but now *will* have an effect. ## Notes & Open Questions LMK if you hate my `Option::filter` fuckery :P ## Change checklist - [x] 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.~~ - [x] All breaking changes documented.
1 parent f0590be commit 2507e62

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

iroh-net/src/bin/iroh-relay.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,9 @@ async fn build_relay_config(cfg: Config) -> Result<iroh_relay::ServerConfig<std:
424424
};
425425
Ok(iroh_relay::ServerConfig {
426426
relay: Some(relay_config),
427-
stun: Some(stun_config),
427+
stun: Some(stun_config).filter(|_| cfg.enable_stun),
428428
#[cfg(feature = "metrics")]
429-
metrics_addr: if cfg.enable_metrics {
430-
Some(cfg.metrics_bind_addr())
431-
} else {
432-
None
433-
},
429+
metrics_addr: Some(cfg.metrics_bind_addr()).filter(|_| cfg.enable_metrics),
434430
})
435431
}
436432

0 commit comments

Comments
 (0)