addrscope

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 1 Imported by: 3 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func EmbeddedIPv4(a netip.Addr) (netip.Addr, bool)

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

func IsInternal(a netip.Addr) bool

IsInternal reports whether a is internal (see the package comment). An invalid address is internal (fail closed). A zone is ignored.

func IsInternalPrefix

func IsInternalPrefix(p netip.Prefix) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL