Documentation ¶
Overview ¶
Package rfc4193 implements Unique Local IPv6 Unicast Address prefix generation, as described in RFC 4193.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prefix ¶
type Prefix struct { // Local indicates if the prefix is locally assigned. Local bool // GlobalID stores an identifier for a globally unique prefix. GlobalID [5]byte // SubnetID identifies an individual /64 subnet within a Prefix. SubnetID uint16 // contains filtered or unexported fields }
A Prefix represents a Local IPv6 Unicast Address prefix, as described in RFC 4193, section 3.1.
func Generate ¶
func Generate(mac net.HardwareAddr) (*Prefix, error)
Generate produces a /48 Prefix by using mac (typically the MAC address of a network interface) as a seed. It uses the algorithm specified in RFC 4193, section 3.2.2.
mac must either be nil or a 6-byte EUI-48 format MAC address. If mac is nil, cryptographically-secure random bytes will be used as a seed.
func Parse ¶
Parse parses a /48 or /64 Prefix from a CIDR notation string. If s is not a /48 or /64 IPv6 Unique Local Address prefix, it returns an error.
func (*Prefix) Subnet ¶
Subnet produces a /64 Prefix with the specified subnet ID.
If p is a /48 Prefix, the new /64 Prefix will be a child of that parent /48 Prefix.
If p is a /64 Prefix (typically produced through a previous call to Subnet), the new /64 Prefix will be a sibling /64 Prefix of the source /64 Prefix.