Documentation ¶
Overview ¶
Package iana imports the Internet Assigned Numbers Authority (IANA) IP Special Registries as a data structure and implements functions to compare the reserved networks against iplib.Net objects. The IANA registry is used to reserve portions of IP network space for special use, examples being the IPv4 Private Use blocks (10.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) and the IPv6 netblock set aside for documentation purposes (2001:db8::/32).
Note that this package does not contain historical reservations. So IPv6 2001:10::/28 (ORCHIDv1) is listed in the document as "deprecated" and not present in this library.
The data-set for the IANA registries is available from:
- https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
- https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Registry []*Reservation
Registry holds the aggregated network list from IANA's v4 and v6 registries. Only the following fields were imported: Address Block, Name, RFC, Forwardable, Globally Reachable and Reserved-by-Protocol
Functions ¶
func GetRFCsForNetwork ¶
GetRFCsForNetwork returns a list of all RFCs that apply to the given network
func IsForwardable ¶
IsForwardable will return false if the given iplib.Net contains or is contained in a network that is marked not-forwardable in the IANA registry. IANA defines a forwardable network as one where "...a router may forward an IP datagram whose destination address is drawn from the allocated special- purpose address block between external interfaces." The default is 'true'
func IsGlobal ¶
IsGlobal will return false if the given iplib.Net contains or is contained in a network that is marked not-global in the IANA registry. IANA defines a global network as one where "...an IP datagram whose destination address is drawn from the allocated special-purpose address block is forwardable beyond a specified administrative domain." The default is 'true'
func IsReserved ¶
IsReserved will return true if the given iplib.Net contains or is contained in a network that is marked reserved-by-protocol in the IANA registry. IANA defines a reserved network as one where "...the RFC that created the special-purpose address block requires all compliant IP implementations to behave in a special way when processing packets either to or from addresses contained by the address block." The default is 'false'
Types ¶
type Reservation ¶
type Reservation struct { // Network is the reserved network Network iplib.Net // Title is a name given to the reservation Title string // RFC is the list of relevant RFCs RFC []string // true if a router may forward packets bound for this network between // external interfaces Forwardable bool // true if a router may pass packets bound for this network outside of // a private network Global bool // true if an IP implementation must implement this policy in order to // be compliant Reserved bool }
Reservation describes an entry in the IANA IP Special Registry
func GetReservationsForIP ¶
func GetReservationsForIP(ip net.IP) []*Reservation
GetReservationsForIP returns a list of any IANA reserved networks that the supplied IP is part of
func GetReservationsForNetwork ¶
func GetReservationsForNetwork(n iplib.Net) []*Reservation
GetReservationsForNetwork returns a list of any IANA reserved networks that are either part of the supplied network or that the supplied network is part of