From 9ee14ada711b44eb1b7281447ed5863d7c994a8b Mon Sep 17 00:00:00 2001 From: shellrow <81893184+shellrow@users.noreply.github.com> Date: Sat, 29 Jan 2022 18:12:53 +0900 Subject: [PATCH] Update unix.rs --- src/interface/unix.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interface/unix.rs b/src/interface/unix.rs index b7ec31b..a646664 100644 --- a/src/interface/unix.rs +++ b/src/interface/unix.rs @@ -55,7 +55,7 @@ pub fn interfaces() -> Vec { for iface in &mut interfaces { match local_ip { IpAddr::V4(local_ipv4) => { - if iface.ipv4.contains(&local_ipv4) { + if iface.ipv4.iter().any(|x| x.addr == local_ipv4) { match gateway::linux::get_default_gateway(iface.name.clone()) { Ok(gateway) => { iface.gateway = Some(gateway); @@ -65,7 +65,7 @@ pub fn interfaces() -> Vec { } }, IpAddr::V6(local_ipv6) => { - if iface.ipv6.contains(&local_ipv6) { + if iface.ipv6.iter().any(|x| x.addr == local_ipv6) { match gateway::linux::get_default_gateway(iface.name.clone()) { Ok(gateway) => { iface.gateway = Some(gateway);