netmaker/netclient/ncutils/iface.go

20 lines
342 B
Go
Raw Normal View History

2022-01-31 23:47:33 +08:00
package ncutils
2022-02-01 04:51:21 +08:00
import (
"net"
2022-02-01 04:51:21 +08:00
)
2022-01-31 23:47:33 +08:00
// StringSliceContains - sees if a string slice contains a string element
func StringSliceContains(slice []string, item string) bool {
for _, s := range slice {
if s == item {
return true
}
}
return false
}
2022-08-23 04:44:04 +08:00
func IpIsPrivate(ipnet net.IP) bool {
return ipnet.IsPrivate() || ipnet.IsLoopback()
}