package netx import ( "net/netip" "go4.org/netipx" ) const ( ip4in6Legacy96 string = "::" ip4in6Modern96 string = "::ffff:" ) var ( // IPv4 documentation prefixes (RFC 5737) ipDoc4pfxs []netip.Prefix = []netip.Prefix{ netip.MustParsePrefix("192.0.2.0/24"), netip.MustParsePrefix("198.51.100.0/24"), netip.MustParsePrefix("203.0.113.0/24"), } ipDoc4 *netipx.IPSet = MustIPSetFromNative(nil, ipDoc4pfxs, nil) // IPv6 documentation prefixes (RFC 3849, RFC 9637) ipDoc6pfxs []netip.Prefix = []netip.Prefix{ netip.MustParsePrefix("2001:db8::/32"), netip.MustParsePrefix("3fff::/20"), } ipDoc6 *netipx.IPSet = MustIPSetFromNative(nil, ipDoc6pfxs, nil) // combined documentation prefixes ipDoc *netipx.IPSet = MustIPSetCombined( []*netipx.IPSet{ ipDoc4, ipDoc6, }, ) // CGNAT/LSN (RFC 6598) cgnat4 netip.Prefix = netip.MustParsePrefix("100.64.0.0/10") // IPv4-Compatible IPv6 Address, RFC 4291 § 2.5.5.1 ip4in6Legacy netip.Prefix = netip.MustParsePrefix(ip4in6Legacy96 + "/96") // IPv4-Mapped IPv6 Address, RFC 4291 § 2.5.5.2 ip4in6Modern netip.Prefix = netip.MustParsePrefix(ip4in6Modern96 + "0:0/96") // both ip4in6 *netipx.IPSet = MustIPSetFromNative( nil, []netip.Prefix{ ip4in6Legacy, ip4in6Modern, }, nil, ) )