Documentation
¶
Index ¶
- func AddrToInt(address net.IP) *big.Int
- func AddressComesBefore(firstIP, secondIP net.IP) bool
- func BroadcastAddr(network *net.IPNet) net.IP
- func DuplicateAddr(addr net.IP) net.IP
- func DuplicateNetwork(network *net.IPNet) *net.IPNet
- func FindInbetweenSubnets(start, stop net.IP) []*net.IPNet
- func FindUnusedSubnets(aggregate *net.IPNet, subnets ...*net.IPNet) (unused []*net.IPNet)
- func IPv4ClassfulNetwork(address net.IP) *net.IPNet
- func IntToAddr(intAddress *big.Int) net.IP
- func NetworkComesBefore(first, second *net.IPNet) bool
- func NetworkContainsSubnet(network *net.IPNet, subnet *net.IPNet) bool
- func NetworksAreIdentical(first, second *net.IPNet) bool
- func NextAddr(addr net.IP) net.IP
- func NextNetwork(network *net.IPNet) *net.IPNet
- func ParseNetworkCIDR(cidr string) *net.IPNet
- func ShrinkNetwork(network *net.IPNet) *net.IPNet
- func SubnetZeroAddr(address net.IP, network *net.IPNet) net.IP
- type Buffer
- func (b *Buffer) AddressComesBefore(firstIP, secondIP net.IP) bool
- func (b *Buffer) FindInbetweenSubnets(start, stop net.IP) []*net.IPNet
- func (b *Buffer) NetworkComesBefore(first, second *net.IPNet) bool
- func (b *Buffer) NetworkContainsSubnet(network *net.IPNet, subnet *net.IPNet) bool
- func (b *Buffer) SubnetZeroAddr(address net.IP, network *net.IPNet) net.IP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressComesBefore ¶
AddressComesBefore returns a bool with regards to numerical address order. Note that IPv4 addresses come before IPv6 addresses.
func BroadcastAddr ¶
BroadcastAddr returns the broadcast address
func DuplicateAddr ¶
DuplicateAddr creates a new copy of net.IP
func DuplicateNetwork ¶
DuplicateNetwork returns a new copy of *net.IPNet
func FindInbetweenSubnets ¶
FindInbetweenSubnets returns a slice of subnets given a range of IP addresses. Note that the delimiter 'stop' is inclusive. In other words, it will be included in the result.
func FindUnusedSubnets ¶
FindUnusedSubnets returns a slice of unused subnets given the aggregate and sibling subnets
func IPv4ClassfulNetwork ¶
IPv4ClassfulNetwork eithers return the classful network given an IPv4 address or returns nil if given a multicast address or IPv6 address
func NetworkComesBefore ¶
NetworkComesBefore returns a bool with regards to numerical network order. Note that IPv4 networks come before IPv6 networks.
func NetworkContainsSubnet ¶
NetworkContainsSubnet validates that the network is a valid supernet
func NetworksAreIdentical ¶
NetworksAreIdentical returns a bool with regards to the two networks being equal
func NextNetwork ¶
NextNetwork returns the next network of the same size
func ParseNetworkCIDR ¶
ParseNetworkCIDR is a convienence function that will return either the *net.IPNet or nil if the supplied cidr is invalid
func ShrinkNetwork ¶
ShrinkNetwork increases the mask size by one
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func (*Buffer) AddressComesBefore ¶
AddressComesBefore returns a bool with regards to numerical address order. Note that IPv4 addresses come before IPv6 addresses.
func (*Buffer) FindInbetweenSubnets ¶
FindInbetweenSubnets returns a slice of subnets given a range of IP addresses. Note that the delimiter 'stop' is inclusive. In other words, it will be included in the result.
func (*Buffer) NetworkComesBefore ¶
NetworkComesBefore returns a bool with regards to numerical network order. Note that IPv4 networks come before IPv6 networks.
func (*Buffer) NetworkContainsSubnet ¶
NetworkContainsSubnet validates that the network is a valid supernet