filter out point-to-point interface when fetching ip
@@ -109,10 +109,10 @@ func IP() (ip string, err error) {
return "", fmt.Errorf("No IP addresses found.")
}
-// filterInterface removes interface that's not up or is a loopback
+// filterInterface removes interface that's not up or is a loopback/p2p
func filterInterface(interfaces []net.Interface) (i []net.Interface) {
for _, v := range interfaces {
- if !(v.Flags&net.FlagUp == 0) && v.Flags&net.FlagLoopback == 0 {
+ if (v.Flags&net.FlagUp != 0) && (v.Flags&net.FlagLoopback == 0) && (v.Flags&net.FlagPointToPoint == 0) {
i = append(i, v)
}
}
