aboutsummaryrefslogtreecommitdiff
path: root/src/config/runtime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/runtime.rs')
-rw-r--r--src/config/runtime.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/config/runtime.rs b/src/config/runtime.rs
index 50624de..f2d2a12 100644
--- a/src/config/runtime.rs
+++ b/src/config/runtime.rs
@@ -1,7 +1,7 @@
use std::fs::File;
use std::io::Read;
-use std::time::Duration;
use std::net::{SocketAddr, ToSocketAddrs};
+use std::time::Duration;
use anyhow::{anyhow, bail, Result};
@@ -165,7 +165,12 @@ impl RuntimeConfigStun {
pub(super) fn new(opts: &ConfigOptsBase) -> Result<Self> {
let mut stun_server_v4 = None;
let mut stun_server_v6 = None;
- for addr in opts.stun_server.as_deref().unwrap_or(super::STUN_SERVER).to_socket_addrs()? {
+ for addr in opts
+ .stun_server
+ .as_deref()
+ .unwrap_or(super::STUN_SERVER)
+ .to_socket_addrs()?
+ {
if addr.is_ipv4() {
stun_server_v4 = Some(addr);
}
@@ -177,8 +182,10 @@ impl RuntimeConfigStun {
let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into());
Ok(Self {
- stun_server_v4: stun_server_v4.ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?,
- stun_server_v6: stun_server_v6.ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?,
+ stun_server_v4: stun_server_v4
+ .ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?,
+ stun_server_v6: stun_server_v6
+ .ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?,
refresh_time,
})
}