diff options
Diffstat (limited to 'server/src/network')
| -rw-r--r-- | server/src/network/upnp.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/src/network/upnp.rs b/server/src/network/upnp.rs index 8ad79588..a443a223 100644 --- a/server/src/network/upnp.rs +++ b/server/src/network/upnp.rs @@ -15,11 +15,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use get_if_addrs::get_if_addrs; use igd::{ - aio::{search_gateway, Gateway}, PortMappingProtocol, SearchOptions, + aio::{Gateway, search_gateway}, }; use log::{error, info}; use std::{ @@ -61,11 +61,11 @@ async fn upnp_setup() -> Result<(Gateway, Ipv4Addr)> { info!("IGD address is {}", gateway.addr); for i in get_if_addrs()? { let a = i.addr.ip(); - if !a.is_loopback() { - if let IpAddr::V4(a) = a { - info!("local v4 address is {a}"); - return Ok((gateway, a)); - } + if !a.is_loopback() + && let IpAddr::V4(a) = a + { + info!("local v4 address is {a}"); + return Ok((gateway, a)); } } bail!("no good local address found") |