testutils

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsIPNet added in v0.8.2

func ContainsIPNet(addrs []net.IPNet, predicate func(net.IPNet) bool) bool

ContainsIPNet runs a predicate across a net.IPNet slice and returns if any match was found

func MakeIPv4Net added in v0.8.1

func MakeIPv4Net(a, b, c, d byte, ones int) net.IPNet

MakeIPv4Net creates a net.IPNet with the given address and CIDR mask length

func MakeIPv6 added in v0.8.1

func MakeIPv6(left, right []byte) net.IP

MakeIPv6 helps build IPv6 values in a similar method to how the "::" marker in an IPv6 literal works

func MakeIPv6Net added in v0.8.1

func MakeIPv6Net(left, right []byte, ones int) net.IPNet

MakeIPv6Net uses MakeIPv6 to create a net.IPNet with the built IP and the given CIDR mask length

func MustKey

func MustKey(t *testing.T) (key wgtypes.Key)

MustKey uses MustRandBytes to generate a random (not crypto-valid) key

func MustKeyPair

func MustKeyPair(t *testing.T) (privateKey, publicKey wgtypes.Key)

MustKeyPair generates a real pair of private and public keys, panicing (via require) if this fails

func MustRandBytes

func MustRandBytes(t *testing.T, data []byte) []byte

MustRandBytes fills the given slice with random bytes using rand.Read

func RandIPNet added in v0.8.1

func RandIPNet(t *testing.T, size int, left, right []byte, ones int) net.IPNet

RandIPNet generates a random IPNet of the given size, and with optional fixed left/right bytes, and with the given CIDR prefix length

func RandUDP4Addr added in v0.8.1

func RandUDP4Addr(t *testing.T) *net.UDPAddr

RandUDP4Addr generates a random IPv4 UDP address for test purposes

func RandUDP6Addr added in v0.8.1

func RandUDP6Addr(t *testing.T) *net.UDPAddr

RandUDP6Addr generates a random IPv6 UDP address for test purposes

func SortIPNetSlice added in v0.8.1

func SortIPNetSlice(slice []net.IPNet)

SortIPNetSlice sorts a slice of IPNets by their string value. OMG want generics.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL