Documentation
¶
Overview ¶
Package addrscope is the one definition of an internal network address: an address a scanner that serves several organizations from an operator's network must never reach. The platform checks job targets with it, and the sensor checks every address it connects to with the same function, so the two never disagree about what is internal.
Internal means any address that is not ordinary public unicast:
- IPv4: 0.0.0.0/8 ("this network"), 10.0.0.0/8, 100.64.0.0/10 (CGNAT), 127.0.0.0/8, 169.254.0.0/16 (link-local, cloud metadata), 172.16.0.0/12, 192.0.0.0/24 (IETF protocol assignments), 192.168.0.0/16, 198.18.0.0/15 (benchmarking), 224.0.0.0/4 (multicast), 240.0.0.0/4 (reserved) and 255.255.255.255;
- IPv6: ::/128, ::1/128, fe80::/10, fc00::/7 (unique local, which holds the metadata address fd00:ec2::254), ff00::/8 (multicast), and fec0::/10 (deprecated site-local);
- an IPv6 address that carries an IPv4 address is judged by that IPv4 address: IPv4-mapped (::ffff:0:0/96), IPv4-compatible (::/96), NAT64 (64:ff9b::/96 and the local-use 64:ff9b:1::/48), 6to4 (2002::/16) and Teredo (2001::/32, client address obfuscated). A gateway in the path would otherwise turn 64:ff9b::a00:1 into 10.0.0.1.
Documentation ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, 2001:db8::/32) are not routable on the internet and are not listed as internal: examples and tests use them as public addresses.
Names are never resolved here: resolve first, then check every answer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmbeddedIPv4 ¶
EmbeddedIPv4 returns the IPv4 address an IPv6 address carries through NAT64, 6to4, Teredo or IPv4-compatible notation (IPv4-mapped addresses are unmapped by IsInternal before this).
func IsInternal ¶
IsInternal reports whether a is internal (see the package comment). An invalid address is internal (fail closed). A zone is ignored.
func IsInternalPrefix ¶
IsInternalPrefix reports whether any address of p is internal: p overlaps an internal range or is (or lies inside) an IPv6 range that carries IPv4. An invalid prefix is internal (fail closed).
Types ¶
This section is empty.