// ParseCIDRs parses a list of cidrs and return error if any is invalid. // order is maintained func ParseCIDRs(cidrsString []string) ([]*net.IPNet, error) { … } // ParsePort parses a string representing an IP port. If the string is not a // valid port number, this returns an error. func ParsePort(port string, allowZero bool) (int, error) { … } // BigForIP creates a big.Int based on the provided net.IP func BigForIP(ip net.IP) *big.Int { … } // AddIPOffset adds the provided integer offset to a base big.Int representing a net.IP // NOTE: If you started with a v4 address and overflow it, you get a v6 result. func AddIPOffset(base *big.Int, offset int) net.IP { … } // RangeSize returns the size of a range in valid addresses. // returns the size of the subnet (or math.MaxInt64 if the range size would overflow int64) func RangeSize(subnet *net.IPNet) int64 { … } // GetIndexedIP returns a net.IP that is subnet.IP + index in the contiguous IP space. func GetIndexedIP(subnet *net.IPNet, index int) (net.IP, error) { … }