Documentation ¶
Overview ¶
Aggregate() merges a list of IP ranges into a minimal set of covering ranges.
Deaggregate() breaks a single IP range into a list of covering network prefixes.
A number of address helper functions are exposed for convenience.
This library usually operates on addresses as [16]byte values, as returned by netip.Addr.As16().
To convert a netip.Addr into [16]byte:
addr.As16()
To unmap an address back into IPv4 format:
if addr.Is4In6() { return addr.Unmap() }
The last step is crucial if you want results in v4 format instead of 4in6.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cmp ¶ added in v0.0.2
compare two IPs. the result will be 0 if (a == b), -1 if (a < b), and +1 if (a > b).
func Uint32ToV4 ¶
Types ¶
type Range ¶ added in v0.0.2
type Range struct {
A, Z [16]byte
}
func RangeFromAddrs ¶ added in v0.0.2
convert first, last addresses to a Range struct
func RangeFromPrefix ¶ added in v0.0.2
convert network prefix to a Range struct
func (Range) Deaggregate ¶ added in v0.0.2
de-aggregate a range of IP addresses into a list of covering network prefixes.