iface.go 342 B

12345678910111213141516171819
  1. package ncutils
  2. import (
  3. "net"
  4. )
  5. // StringSliceContains - sees if a string slice contains a string element
  6. func StringSliceContains(slice []string, item string) bool {
  7. for _, s := range slice {
  8. if s == item {
  9. return true
  10. }
  11. }
  12. return false
  13. }
  14. func IpIsPrivate(ipnet net.IP) bool {
  15. return ipnet.IsPrivate() || ipnet.IsLoopback()
  16. }