docker: github.com/docker/docker/vendor/github.com/docker/libnetwork/netutils Index | Files

package netutils

import "github.com/docker/docker/vendor/github.com/docker/libnetwork/netutils"

Index

Package Files

utils.go utils_linux.go

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")
    // ErrNoDefaultRoute preformatted error
    ErrNoDefaultRoute = errors.New("no default route")
)

func CheckNameserverOverlaps Uses

func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error

CheckNameserverOverlaps checks whether the passed network overlaps with any of the nameservers

func CheckRouteOverlaps Uses

func CheckRouteOverlaps(toCheck *net.IPNet) error

CheckRouteOverlaps checks whether the passed network overlaps with any existing routes

func ElectInterfaceAddresses Uses

func ElectInterfaceAddresses(name string) ([]*net.IPNet, []*net.IPNet, error)

ElectInterfaceAddresses looks for an interface on the OS with the specified name and returns returns all its IPv4 and IPv6 addresses in CIDR notation. If a failure in retrieving the addresses or no IPv4 address is found, an error is returned. If the interface does not exist, it chooses from a predefined list the first IPv4 address which does not conflict with other interfaces on the system.

func FindAvailableNetwork Uses

func FindAvailableNetwork(list []*net.IPNet) (*net.IPNet, error)

FindAvailableNetwork returns a network from the passed list which does not overlap with existing interfaces in the system

func GenerateIfaceName Uses

func GenerateIfaceName(nlh *netlink.Handle, prefix string, len int) (string, error)

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 Uses

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 Uses

func GenerateRandomMAC() net.HardwareAddr

GenerateRandomMAC returns a new 6-byte(48-bit) hardware address (MAC)

func GenerateRandomName Uses

func GenerateRandomName(prefix string, size int) (string, error)

GenerateRandomName returns a new name joined with a prefix. This size specified is used to truncate the randomly generated value

func GetIfaceAddr Uses

func GetIfaceAddr(name string) (net.Addr, []net.Addr, error)

GetIfaceAddr returns the first IPv4 address and slice of IPv6 addresses for the specified network interface

func NetworkOverlaps Uses

func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool

NetworkOverlaps detects overlap between one IPNet and another

func NetworkRange Uses

func NetworkRange(network *net.IPNet) (net.IP, net.IP)

NetworkRange calculates the first and last IP addresses in an IPNet

func ParseAlias Uses

func ParseAlias(val string) (string, string, error)

ParseAlias parses and validates the specified string as an alias format (name:alias)

func ReverseIP Uses

func ReverseIP(IP string) string

ReverseIP accepts a V4 or V6 IP string in the canonical form and returns a reversed IP in the dotted decimal form . This is used to setup the IP to service name mapping in the optimal way for the DNS PTR queries.

func ValidateAlias Uses

func ValidateAlias(val string) (string, error)

ValidateAlias validates that the specified string has a valid alias format (containerName:alias).

Package netutils imports 14 packages (graph). Updated 2019-05-13. Refresh now. Tools for package owners.