utils_solaris.go 876 B

1234567891011121314151617181920212223242526272829303132
  1. package netutils
  2. // Solaris: TODO
  3. import (
  4. "net"
  5. "github.com/docker/libnetwork/ipamutils"
  6. )
  7. // ElectInterfaceAddresses looks for an interface on the OS with the specified name
  8. // and returns its IPv4 and IPv6 addresses in CIDR form. If the interface does not exist,
  9. // it chooses from a predifined list the first IPv4 address which does not conflict
  10. // with other interfaces on the system.
  11. func ElectInterfaceAddresses(name string) (*net.IPNet, []*net.IPNet, error) {
  12. var (
  13. v4Net *net.IPNet
  14. err error
  15. )
  16. v4Net, err = FindAvailableNetwork(ipamutils.PredefinedBroadNetworks)
  17. if err != nil {
  18. return nil, nil, err
  19. }
  20. return v4Net, nil, nil
  21. }
  22. // FindAvailableNetwork returns a network from the passed list which does not
  23. // overlap with existing interfaces in the system
  24. func FindAvailableNetwork(list []*net.IPNet) (*net.IPNet, error) {
  25. return list[0], nil
  26. }