Documentation
¶
Index ¶
- Variables
- func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error
- func CheckRouteOverlaps(toCheck *net.IPNet) error
- func GenerateRandomMAC() net.HardwareAddr
- func GenerateRandomName(prefix string, size int) (string, error)
- func GetIfaceAddr(name string) (net.Addr, []net.Addr, error)
- func IsRunningInContainer() bool
- func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool
- func NetworkRange(network *net.IPNet) (net.IP, net.IP)
- func SetupTestNetNS(t *testing.T) func()
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") // ErrNoDefaultRoute preformatted error ErrNoDefaultRoute = errors.New("no default route") )
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 GenerateRandomMAC ¶
func GenerateRandomMAC() net.HardwareAddr
GenerateRandomMAC returns a new 6-byte(48-bit) hardware address (MAC)
func GenerateRandomName ¶
GenerateRandomName returns a new name joined with a prefix. This size specified is used to truncate the randomly generated value
func GetIfaceAddr ¶
GetIfaceAddr returns the first IPv4 address and slice of IPv6 addresses for the specified network interface
func IsRunningInContainer ¶
func IsRunningInContainer() bool
IsRunningInContainer returns whether the test is running inside a container.
func NetworkOverlaps ¶
NetworkOverlaps detects overlap between one IPNet and another
func NetworkRange ¶
NetworkRange calculates the first and last IP addresses in an IPNet
func SetupTestNetNS ¶
SetupTestNetNS joins a new network namespace, and returns its associated teardown function.
Example usage:
defer SetupTestNetNS(t)()
Types ¶
This section is empty.