go/src/net/addrselect.go

func sortByRFC6724(addrs []IPAddr) {}

func sortByRFC6724withSrcs(addrs []IPAddr, srcs []netip.Addr) {}

// srcAddrs tries to UDP-connect to each address to see if it has a
// route. (This doesn't send any packets). The destination port
// number is irrelevant.
func srcAddrs(addrs []IPAddr) []netip.Addr {}

type ipAttr

func ipAttrOf(ip netip.Addr) ipAttr {}

type byRFC6724Info

// compareByRFC6724 compares two byRFC6724Info records and returns an integer
// indicating the order. It follows the algorithm and variable names from
// RFC 6724 section 6. Returns -1 if a is preferred, 1 if b is preferred,
// and 0 if they are equal.
func compareByRFC6724(a, b byRFC6724Info) int {}

type policyTableEntry

type policyTable

var rfc6724policyTable

// Classify returns the policyTableEntry of the entry with the longest
// matching prefix that contains ip.
// The table t must be sorted from largest mask size to smallest.
func (t policyTable) Classify(ip netip.Addr) policyTableEntry {}

type scope

const scopeInterfaceLocal

const scopeLinkLocal

const scopeAdminLocal

const scopeSiteLocal

const scopeOrgLocal

const scopeGlobal

func classifyScope(ip netip.Addr) scope {}

// commonPrefixLen reports the length of the longest prefix (looking
// at the most significant, or leftmost, bits) that the
// two addresses have in common, up to the length of a's prefix (i.e.,
// the portion of the address not including the interface ID).
//
// If a or b is an IPv4 address as an IPv6 address, the IPv4 addresses
// are compared (with max common prefix length of 32).
// If a and b are different IP versions, 0 is returned.
//
// See https://tools.ietf.org/html/rfc6724#section-2.2
func commonPrefixLen(a netip.Addr, b IP) (cpl int) {}