Documentation ¶
Overview ¶
Package addressutil contains helpers working with addresses.
Index ¶
- func CompareAddressStatuses(comparePrefixes func(a, b netip.Prefix) int) func(a, b *network.AddressStatus) int
- func CompareByAlgorithm(algorithm nethelpers.AddressSortAlgorithm) func(a, b netip.Prefix) int
- func ComparePrefixNew(a, b netip.Prefix) int
- func ComparePrefixesLegacy(a, b netip.Prefix) int
- func DeduplicateIPPrefixes(in []netip.Prefix) []netip.Prefix
- func FilterIPs(addrs []netip.Prefix, includeSubnets, excludeSubnets []netip.Prefix) []netip.Prefix
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareAddressStatuses ¶
func CompareAddressStatuses(comparePrefixes func(a, b netip.Prefix) int) func(a, b *network.AddressStatus) int
CompareAddressStatuses compares two address statuses with the prefix comparison func.
The comparison of AddressStatuses sorts by link name and then by address.
func CompareByAlgorithm ¶
func CompareByAlgorithm(algorithm nethelpers.AddressSortAlgorithm) func(a, b netip.Prefix) int
CompareByAlgorithm returns a comparison function based on the given algorithm.
func ComparePrefixNew ¶
ComparePrefixNew compares two prefixes by address family, address, and prefix length.
It prefers more specific prefixes.
func ComparePrefixesLegacy ¶
ComparePrefixesLegacy is the old way to sort prefixes.
It only compares addresses and does not take prefix length into account.
func DeduplicateIPPrefixes ¶
DeduplicateIPPrefixes removes duplicates from the given list of prefixes.
The input list must be sorted. DeduplicateIPPrefixes performs in-place deduplication.
Types ¶
This section is empty.