Versions in this module Expand all Collapse all v1 v1.0.0 Mar 15, 2024 Changes in this version + const ErrNotAReversedIP + const ErrNotAReversedSubnet + const IPv4BitLen + const IPv6BitLen + const MaxDomainLabelLen + const MaxDomainNameLen + const MaxServiceLabelLen + func CloneIPs(ips []net.IP) (clone []net.IP) + func CloneURL(u *url.URL) (clone *url.URL) + func IPAndPortFromAddr(addr net.Addr) (ip net.IP, port uint16) + func IPFromReversedAddr(arpa string) (addr netip.Addr, err error) + func IPNetToPrefix(subnet *net.IPNet, fam AddrFamily) (p netip.Prefix, err error) + func IPNetToPrefixNoMapped(subnet *net.IPNet) (p netip.Prefix, err error) + func IPToAddr(ip net.IP, fam AddrFamily) (addr netip.Addr, err error) + func IPToAddrNoMapped(ip net.IP) (addr netip.Addr, err error) + func IPToReversedAddr(ip net.IP) (arpa string, err error) + func IPv4Localhost() (ip netip.Addr) + func IPv4Zero() (ip net.IP) + func IPv4allrouter() (ip net.IP) + func IPv4allsys() (ip net.IP) + func IPv4bcast() (ip net.IP) + func IPv6Localhost() (ip netip.Addr) + func IPv6Zero() (ip net.IP) + func IsImmediateSubdomain(domain, top string) (ok bool) + func IsLocallyServed(ip netip.Addr) (ok bool) + func IsSpecialPurpose(ip netip.Addr) (ok bool) + func IsSubdomain(domain, top string) (ok bool) + func IsValidHostInnerRune(r rune) (ok bool) + func IsValidHostOuterRune(r rune) (ok bool) + func JoinHostPort(host string, port uint16) (hostport string) + func NetAddrToAddrPort(addr net.Addr) (addrPort netip.AddrPort) + func ParseIP(s string) (ip net.IP, err error) + func ParseIPv4(s string) (ip net.IP, err error) + func PrefixFromReversedAddr(arpa string) (p netip.Prefix, err error) + func SplitHost(hostport string) (host string, err error) + func SplitHostPort(hostport string) (host string, port uint16, err error) + func Subdomains(domain string) (sub []string) + func UnembedPrefixes(embed []Prefix) (ps []netip.Prefix) + func ValidateDomainName(name string) (err error) + func ValidateDomainNameLabel(label string) (err error) + func ValidateHostname(name string) (err error) + func ValidateHostnameLabel(label string) (err error) + func ValidateIP(ip net.IP) (err error) + func ValidateMAC(mac net.HardwareAddr) (err error) + func ValidateSRVDomainName(name string) (err error) + func ValidateServiceNameLabel(label string) (err error) + func ValidateTLDLabel(tld string) (err error) + func ZeroPrefix(fam AddrFamily) (n netip.Prefix) + type AddrError struct + Addr string + Err error + Kind AddrKind + func (err *AddrError) Error() (msg string) + func (err *AddrError) Unwrap() (unwrapped error) + type AddrFamily uint16 + const AddrFamilyIPv4 + const AddrFamilyIPv6 + const AddrFamilyNone + func AddrFamilyFromRRType(rr uint16) (fam AddrFamily) + func (f AddrFamily) String() (s string) + type AddrKind = string + const AddrKindARPA + const AddrKindCIDR + const AddrKindDomainName + const AddrKindHostPort + const AddrKindIP + const AddrKindIPPort + const AddrKindIPv4 + const AddrKindMAC + const AddrKindName + const AddrKindSRVName + type HostPort struct + Host string + Port uint16 + func CloneHostPorts(hps []*HostPort) (clone []*HostPort) + func ParseHostPort(addr string) (hp *HostPort, err error) + func (hp *HostPort) Clone() (clone *HostPort) + func (hp *HostPort) UnmarshalText(b []byte) (err error) + func (hp HostPort) MarshalText() (b []byte, err error) + func (hp HostPort) String() (s string) + type LabelError struct + Err error + Kind LabelKind + Label string + func (err *LabelError) Error() (msg string) + func (err *LabelError) Unwrap() (unwrapped error) + type LabelKind = string + const LabelKindDomain + const LabelKindHost + const LabelKindSRV + const LabelKindTLD + type LengthError struct + Allowed []int + Kind string + Length int + Max int + func (err *LengthError) Error() (msg string) + type Prefix struct + func (p *Prefix) UnmarshalText(b []byte) (err error) + type RuneError struct + Kind string + Rune rune + func (err *RuneError) Error() (msg string) + type SliceSubnetSet []netip.Prefix + func (s SliceSubnetSet) Contains(ip netip.Addr) (ok bool) + type SubnetSet interface + Contains func(ip netip.Addr) (ok bool) + type SubnetSetFunc func(ip netip.Addr) (ok bool) + func (f SubnetSetFunc) Contains(ip netip.Addr) (ok bool)