Explorar el Código

Merge pull request #25 from YungSang/topic

Fix GetInterfaceByIP()
Jonathan Boulle hace 10 años
padre
commit
78e6ed535e
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      pkg/ip/iface.go

+ 1 - 1
pkg/ip/iface.go

@@ -51,7 +51,7 @@ func GetInterfaceByIP(ip net.IP) (*net.Interface, error) {
 
 	for _, iface := range ifaces {
 		addr, err := GetIfaceIP4Addr(&iface)
-		if err != nil && ip.Equal(addr) {
+		if err == nil && ip.Equal(addr) {
 			return &iface, nil
 		}
 	}