Skip to content

Commit

Permalink
fix: exclude down & non-broadcast iface
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinB committed Dec 6, 2024
1 parent 207ca8b commit 963f065
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion random_local_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
if strings.Contains(iface.Name, "docker") || !strings.Contains(iface.Flags.String(), "broadcast") || !strings.Contains(iface.Flags.String(), "up") {
continue
}

Expand Down

0 comments on commit 963f065

Please sign in to comment.