Skip to content

De-aggregates an IP address range into a list of network prefixes (CIDR blocks)

License

Notifications You must be signed in to change notification settings

BourgeoisBear/range2cidr

Repository files navigation

range2cidr

GoDoc

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()
}