Skip to content

Commit

Permalink
fix(iroh-relay): Respect enable_stun setting in iroh-relay::Config (
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
matheus23 authored Nov 1, 2024
1 parent f0590be commit 2507e62
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions iroh-net/src/bin/iroh-relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,9 @@ async fn build_relay_config(cfg: Config) -> Result<iroh_relay::ServerConfig<std:
};
Ok(iroh_relay::ServerConfig {
relay: Some(relay_config),
stun: Some(stun_config),
stun: Some(stun_config).filter(|_| cfg.enable_stun),
#[cfg(feature = "metrics")]
metrics_addr: if cfg.enable_metrics {
Some(cfg.metrics_bind_addr())
} else {
None
},
metrics_addr: Some(cfg.metrics_bind_addr()).filter(|_| cfg.enable_metrics),
})
}

Expand Down

0 comments on commit 2507e62

Please sign in to comment.