Skip to content

Commit

Permalink
improve searching of local network containing the given ip address
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-zuyev committed Jun 24, 2021
1 parent afa596d commit 2c28736
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func inspect(addr string) (*Parameters, error) {
if err != nil {
return nil, fmt.Errorf("failed listing network interfaces: %w", err)
}

ifLoop:
for _, iface := range ifaces {
ifAddrs, err := iface.Addrs()
if err != nil {
Expand All @@ -114,7 +116,7 @@ func inspect(addr string) (*Parameters, error) {
n.IfaceMAC = iface.HardwareAddr.String()
n.Gateway = n.IfaceIPv4
network = lan
break
break ifLoop
}
}
}
Expand Down

0 comments on commit 2c28736

Please sign in to comment.