Documentation
¶
Overview ¶
Package mapcidr implements methods to allow working with CIDRs.
Index ¶
- func AddressCount(cidr string) (uint64, error)
- func AddressCountIpnet(network *net.IPNet) uint64
- func AddressRange(network *net.IPNet) (net.IP, net.IP, error)
- func IPAddresses(cidr string) ([]string, error)
- func IPAddressesIPnet(ipnet *net.IPNet) (ips []string)
- func IPToInteger(ip net.IP) (*big.Int, int, error)
- func IntegerToIP(ipInt *big.Int, bits int) net.IP
- func SplitByNumber(iprange string, number int) ([]*net.IPNet, error)
- func SplitIPNetByNumber(ipnet *net.IPNet, number int) ([]*net.IPNet, error)
- func SplitIPNetIntoN(iprange *net.IPNet, n int) ([]*net.IPNet, error)
- func SplitN(iprange string, n int) ([]*net.IPNet, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressCount ¶
AddressCount returns the number of IP addresses in a range
func AddressCountIpnet ¶
AddressCountIpnet returns the number of IP addresses in an IPNet structure
func AddressRange ¶
AddressRange returns the first and last addresses in the given CIDR range.
func IPAddresses ¶ added in v0.0.2
IPAddresses returns all the IP addresses in a CIDR
func IPAddressesIPnet ¶ added in v0.0.2
IPAddressesIPnet returns all IP addresses in an IPNet.
func IPToInteger ¶ added in v0.0.2
IPToInteger converts an IP address to its integer representation. It supports both IPv4 as well as IPv6 addresses.
func IntegerToIP ¶ added in v0.0.2
IntegerToIP converts an Integer IP address to net.IP format.
func SplitByNumber ¶
SplitByNumber splits the given cidr into subnets with the closest number of hosts per subnet.
func SplitIPNetByNumber ¶ added in v0.0.2
SplitIPNetByNumber splits an IPNet into subnets with the closest n umber of hosts per subnet.
func SplitIPNetIntoN ¶ added in v0.0.2
SplitIPNetIntoN attempts to split a ipnet in the exact number of subnets
Types ¶
This section is empty.