From c6c9a79cc9410fe59318daf28682a495a6fd642d Mon Sep 17 00:00:00 2001 From: Corentin Barreau Date: Fri, 6 Dec 2024 17:09:20 +0100 Subject: [PATCH] fix: typo in iface filtering --- random_local_ip.go | 2 +- random_local_ip_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/random_local_ip.go b/random_local_ip.go index 8c4f31d..9e6c99d 100644 --- a/random_local_ip.go +++ b/random_local_ip.go @@ -49,7 +49,7 @@ func (c *CustomHTTPClient) getAvailableIPs(IPv6AnyIP bool) (IPs []net.IP, err er newIPv4 := make([]net.IPNet, 0) newIPv6 := make([]net.IPNet, 0) for _, iface := range interfaces { - if strings.Contains(iface.Name, "docker") || strings.Contains(iface.Flags.String(), "pointopoint") || !strings.Contains(iface.Flags.String(), "up") { + if strings.Contains(iface.Name, "docker") || strings.Contains(iface.Flags.String(), "pointtopoint") || !strings.Contains(iface.Flags.String(), "up") { continue } diff --git a/random_local_ip_test.go b/random_local_ip_test.go index a7b2f98..4eb7cd5 100644 --- a/random_local_ip_test.go +++ b/random_local_ip_test.go @@ -361,7 +361,7 @@ func TestGetAvailableIPsAnyIP(t *testing.T) { newIPv4 := make([]net.IPNet, 0) newIPv6 := make([]net.IPNet, 0) for _, iface := range interfaces { - if strings.Contains(iface.Name, "docker") || !strings.Contains(iface.Flags.String(), "broadcast") || !strings.Contains(iface.Flags.String(), "up") { + if strings.Contains(iface.Name, "docker") || strings.Contains(iface.Flags.String(), "pointtopoint") || !strings.Contains(iface.Flags.String(), "up") { continue } else { t.Logf("Interface: %v", iface.Name)