Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateIPNets ¶
func GenerateIPNets(ipnets []IPNetRequest, seed int64) []net.IPNet
GenerateIPNets creates an array of random IPv4 net.IPNet objects. The ipnets parameter contains a list with th number of objects for each prefix length to generate.
Types ¶
type IPNetRequest ¶
type IPNetRequest struct { Count int // Number of elements of this type to generate PrefixLen int // Length of the prefix (24, 32)... }
func ParseIPNetsParam ¶
func ParseIPNetsParam(count int, ipnets string) []IPNetRequest
ParseIPNetsParam parses a string containinig a list of prefixes' lengths and their weight (0.0-1.0) and returns a list of IPNetRequest to be used with GenerateIPNets. The ipnets string is formated as "prefix1Length:prefix1Weigth,prefix2Length:prefix2Weigth,..." If the sum of all weights isn't 1.0 the remaining are assigned to the /32 prefix.
Click to show internal directories.
Click to hide internal directories.