Documentation ¶
Index ¶
- Variables
- func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error
- func CheckRouteOverlaps(toCheck *net.IPNet) error
- func FindAvailableNetwork(list []*net.IPNet) (*net.IPNet, error)
- func GenerateIfaceName(nlh *netlink.Handle, prefix string, len int) (string, error)
- func GenerateMACFromIP(ip net.IP) net.HardwareAddr
- func GenerateRandomMAC() net.HardwareAddr
- func GenerateRandomName(prefix string, length int) (string, error)
- func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool
- func NetworkRange(network *net.IPNet) (net.IP, net.IP)
- func ReverseIP(IP string) string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNetworkOverlapsWithNameservers preformatted error ErrNetworkOverlapsWithNameservers = errors.New("requested network overlaps with nameserver") // ErrNetworkOverlaps preformatted error ErrNetworkOverlaps = errors.New("requested network overlaps with existing network") )
Functions ¶
func CheckNameserverOverlaps ¶
CheckNameserverOverlaps checks whether the passed network overlaps with any of the nameservers
func CheckRouteOverlaps ¶
CheckRouteOverlaps checks whether the passed network overlaps with any existing routes
func FindAvailableNetwork ¶
FindAvailableNetwork returns a network from the passed list which does not overlap with existing interfaces in the system
func GenerateIfaceName ¶
GenerateIfaceName returns an interface name using the passed in prefix and the length of random bytes. The api ensures that the there are is no interface which exists with that name.
func GenerateMACFromIP ¶
func GenerateMACFromIP(ip net.IP) net.HardwareAddr
GenerateMACFromIP returns a locally administered MAC address where the 4 least significant bytes are derived from the IPv4 address.
func GenerateRandomMAC ¶
func GenerateRandomMAC() net.HardwareAddr
GenerateRandomMAC returns a new 6-byte(48-bit) hardware address (MAC)
func GenerateRandomName ¶
GenerateRandomName returns a string of the specified length, created by joining the prefix to random hex characters. The length must be strictly larger than len(prefix), or an error will be returned.
func NetworkOverlaps ¶
NetworkOverlaps detects overlap between one IPNet and another
func NetworkRange ¶
NetworkRange calculates the first and last IP addresses in an IPNet
Types ¶
This section is empty.