// AddrFrom16 returns the IPv6 address given by the bytes in addr. // An IPv4-mapped IPv6 address is left as an IPv6 address. // (Use Unmap to convert them if needed.) func AddrFrom16(addr [16]byte) Addr


// AddrFrom4 returns the address of the IPv4 address given by the bytes in addr. func AddrFrom4(addr [4]byte) Addr


// AddrFromSlice parses the 4- or 16-byte byte slice as an IPv4 or IPv6 address. // Note that a net.IP can be passed directly as the []byte argument. // If slice's length is not 4 or 16, AddrFromSlice returns Addr{}, false. func AddrFromSlice(slice []byte) (ip Addr, ok bool)


// AddrPortFrom returns an AddrPort with the provided IP and port. // It does not allocate. func AddrPortFrom(ip Addr, port uint16) AddrPort


// IPv4Unspecified returns the IPv4 unspecified address "". func IPv4Unspecified() Addr


// IPv6LinkLocalAllNodes returns the IPv6 link-local all nodes multicast // address ff02::1. func IPv6LinkLocalAllNodes() Addr


// IPv6LinkLocalAllRouters returns the IPv6 link-local all routers multicast // address ff02::2. func IPv6LinkLocalAllRouters() Addr


// IPv6Loopback returns the IPv6 loopback address ::1. func IPv6Loopback() Addr


// IPv6Unspecified returns the IPv6 unspecified address "::". func IPv6Unspecified() Addr


// MustParseAddr calls ParseAddr(s) and panics on error. // It is intended for use in tests with hard-coded strings. func MustParseAddr(s string) Addr


// MustParseAddrPort calls ParseAddrPort(s) and panics on error. // It is intended for use in tests with hard-coded strings. func MustParseAddrPort(s string) AddrPort


// MustParsePrefix calls ParsePrefix(s) and panics on error. // It is intended for use in tests with hard-coded strings. func MustParsePrefix(s string) Prefix


// ParseAddr parses s as an IP address, returning the result. The string // s can be in dotted decimal (""), IPv6 ("2001:db8::68"), // or IPv6 with a scoped addressing zone ("fe80::1cc0:3e8c:119f:c2e1%ens18"). func ParseAddr(s string) (Addr, error)


// ParseAddrPort parses s as an AddrPort. // // It doesn't do any name resolution: both the address and the port // must be numeric. func ParseAddrPort(s string) (AddrPort, error)


// ParsePrefix parses s as an IP address prefix. // The string can be in the form "" or "2001:db8::/32", // the CIDR notation defined in RFC 4632 and RFC 4291. // IPv6 zones are not permitted in prefixes, and an error will be returned if a // zone is present. // // Note that masked address bits are not zeroed. Use Masked for that. func ParsePrefix(s string) (Prefix, error)


// PrefixFrom returns a Prefix with the provided IP address and bit // prefix length. // // It does not allocate. Unlike Addr.Prefix, PrefixFrom does not mask // off the host bits of ip. // // If bits is less than zero or greater than ip.BitLen, Prefix.Bits // will return an invalid value -1. func PrefixFrom(ip Addr, bits int) Prefix