finished ipv6 reservations

This commit is contained in:
brent saner
2025-02-02 11:09:52 -05:00
parent 30355294c0
commit 64b669edc3
4 changed files with 50 additions and 3 deletions

View File

@@ -5,8 +5,37 @@ import (
)
var (
ReservedNets map[netip.Prefix]string
ReservedNets map[netip.Prefix]string
// Up to date as of Feb 2, 2025
reservedNetsOrig map[string]string = map[string]string{
// IPv6
// https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
"::/128": "Unspecified Address (RFC 4291 § 2.5.2)",
"::1/128": "Loopback Address (RFC 4291 § 2.5.3)",
"ff00::/8": "Multicast (RFC 4291 § 2.7)",
"::ffff:0:0/96": "IPv4-mapped Address (RFC 4291 § 2.5.5)",
"64:ff9b::/96": "IPv4-IPv6 Translation (RFC 6052)",
"64:ff9b:1::/48": "IPv4-IPv6 Translation (RFC 8215)",
"100::/64": "Discard-Only Address Block (RFC 6666)",
"2001::/23": "IETF Protocol Assignments (RFC 2928, IANA IPv6 Special Registry)",
"2001::/32": "TEREDO (RFC 4380)",
"2001:1::1/128": "Port Control Protocol Anycast (RFC 7723)",
"2001:1::2/128": "Traversal Using Relays around NAT Anycast (RFC 8155)",
"2001:1::3/128": "DNS-SD Service Registration Protocol Anycast (draft-ietf-dnssd-srp-25)",
"2001:2::/48": "Benchmarking (RFC 5180, Errata 1752)",
"2001:3::/32": "AMT (RFC 7450)",
"2001:4:112::/48": "AS112-v6 (RFC 7535)",
"2001:20::/28": "ORCHIDv2 (RFC 7343)",
"2001:30::/28": "Drone Remote ID Protocol Entity Tags (DETs) Prefix (RFC 9374)",
"2001:db8::/32": "Documentation (RFC 3849)",
"2002::/16": "6to4 (RFC 3056)",
"2620:4f:8000::/48": "Direct Delegation AS112 Service (RFC 7534)",
"3fff::/20": "Documentation (RFC 9637)",
"5f00::/16": "Segment Routing (SRv6) SIDs (RFC 9602)",
"fc00::/7": "Unique-Local Addressing (RFC 4193)", // private/LAN
"fe80::/10": "Link-Local Unicast (RFC 4291 § 2.5.6)",
// IPv4
// https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml#iana-ipv4-special-registry-1
"": "",
}
)

View File

@@ -149,6 +149,24 @@ func AddrInvert(ip netip.Addr) (inverted netip.Addr) {
return
}
/*
CheckReserved checks nets for any reserved prefixes, either directly or included within the prefix depending on recurse.
excludePrivate indicates if LAN networks should be considered as "reserved" or not.
Any found will be returned in reservations.
If no reserved networks are found, reservations will be nil.
Note that prefix-specific broadcasts (e.g. x.255.255.255/8, x.x.x.255/24, ::/64, x:ffff:ffff:ffff:ffff/64, etc.)
will *not* be considered as "reserved" as they are considered normal addresses expected for functionality.
*/
func CheckReserved(nets []*netip.Prefix, recurse, excludePrivate bool) (reservations map[netip.Prefix]string, err error) {
// TODO
return
}
// Contain takes the results of a NetSplitter and returns a StructuredResults.
func Contain(origPfx *netip.Prefix, nets []*netip.Prefix, remaining *netipx.IPSet, splitter NetSplitter) (s *StructuredResults, err error) {