dhcpv6

package
v0.0.0-...-7803ee8 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package dhcpv6 provides encoding and decoding of DHCPv6 messages and options.

Index

Constants

View Source
const (
	DefaultClientPort = 546
	DefaultServerPort = 547
)

Default ports

View Source
const MessageHeaderSize = 4
View Source
const RelayHeaderSize = 34

Variables

View Source
var (
	AllDHCPRelayAgentsAndServers = net.ParseIP("ff02::1:2")
	AllDHCPServers               = net.ParseIP("ff05::1:3")
)

Default multicast groups

View Source
var DuidTypeToString = map[DuidType]string{
	DUID_LL:   "DUID-LL",
	DUID_LLT:  "DUID-LLT",
	DUID_EN:   "DUID-EN",
	DUID_UUID: "DUID-UUID",
}

DuidTypeToString maps a DuidType to a name.

View Source
var InterfaceAddresses func(string) ([]net.Addr, error) = interfaceAddresses

InterfaceAddresses is used to fetch addresses of an interface with given name

Functions

func ExtractMAC

func ExtractMAC(packet DHCPv6) (net.HardwareAddr, error)

ExtractMAC looks into the inner most PeerAddr field in the RelayInfo header which contains the EUI-64 address of the client making the request, populated by the dhcp relay, it is possible to extract the mac address from that IP. If that fails, it looks for the MAC addressed embededded in the DUID. Note that this only works with type DuidLL and DuidLLT. If a mac address cannot be found an error will be returned.

func GetGlobalAddr

func GetGlobalAddr(ifname string) (net.IP, error)

GetGlobalAddr returns a global address for the interface

func GetLinkLocalAddr

func GetLinkLocalAddr(ifname string) (net.IP, error)

GetLinkLocalAddr returns a link-local address for the interface

func GetMacAddressFromEUI64

func GetMacAddressFromEUI64(ip net.IP) (net.HardwareAddr, error)

GetMacAddressFromEUI64 will return a valid MAC address ONLY if it's a EUI-48

func GetTime

func GetTime() uint32

GetTime returns a time integer suitable for DUID-LLT, i.e. the current time counted in seconds since January 1st, 2000, midnight UTC, modulo 2^32

func IsUsingUEFI

func IsUsingUEFI(msg *Message) bool

IsUsingUEFI function takes a DHCPv6 message and returns true if the machine trying to netboot is using UEFI of false if it is not.

func OptClientLinkLayerAddress

func OptClientLinkLayerAddress(ht iana.HWType, lla net.HardwareAddr) *optClientLinkLayerAddress

OptClientLinkLayerAddress implements OptionClientLinkLayerAddr option. https://tools.ietf.org/html/rfc6939

func OptInformationRefreshTime

func OptInformationRefreshTime(irt time.Duration) *optInformationRefreshTime

OptInformationRefreshTime implements OptionInformationRefreshTime option. https://tools.ietf.org/html/rfc8415#section-21.23

func WithNetboot

func WithNetboot(d DHCPv6)

WithNetboot adds bootfile URL and bootfile param options to a DHCPv6 packet.

func WithRapidCommit

func WithRapidCommit(d DHCPv6)

WithRapidCommit adds the rapid commit option to a message.

Types

type AddressOptions

type AddressOptions struct {
	Options
}

AddressOptions are options valid for the IAAddress option field.

RFC 8415 Appendix C lists only the Status Code option as valid.

func (AddressOptions) Status

func (ao AddressOptions) Status() *OptStatusCode

Status returns the status code associated with this option.

type DHCPv6

type DHCPv6 interface {
	Type() MessageType
	ToBytes() []byte
	String() string
	Summary() string
	IsRelay() bool

	// GetInnerMessage returns the innermost encapsulated DHCPv6 message.
	//
	// If it is already a message, it will be returned. If it is a relay
	// message, the encapsulated message will be recursively extracted.
	GetInnerMessage() (*Message, error)

	GetOption(code OptionCode) []Option
	GetOneOption(code OptionCode) Option
	AddOption(Option)
	UpdateOption(Option)
}

func DecapsulateRelay

func DecapsulateRelay(l DHCPv6) (DHCPv6, error)

DecapsulateRelay extracts the content of a relay message. It does not recurse if there are nested relay messages. Returns the original packet if is not not a relay message

func DecapsulateRelayIndex

func DecapsulateRelayIndex(l DHCPv6, index int) (DHCPv6, error)

DecapsulateRelayIndex extracts the content of a relay message. It takes an integer as index (e.g. if 0 return the outermost relay, 1 returns the second, etc, and -1 returns the last). Returns the original packet if it is not not a relay message.

func FromBytes

func FromBytes(data []byte) (DHCPv6, error)

FromBytes reads a DHCPv6 message from a byte stream.

func NewRelayReplFromRelayForw

func NewRelayReplFromRelayForw(relay *RelayMessage, msg *Message) (DHCPv6, error)

NewRelayReplFromRelayForw creates a MessageTypeRelayReply based on a MessageTypeRelayForward and replaces the inner message with the passed DHCPv6 message. It copies the OptionInterfaceID and OptionRemoteID if the options are present in the Relay packet.

type Duid

type Duid struct {
	Type                 DuidType
	HwType               iana.HWType // for DUID-LLT and DUID-LL. Ignored otherwise. RFC 826
	Time                 uint32      // for DUID-LLT. Ignored otherwise
	LinkLayerAddr        net.HardwareAddr
	EnterpriseNumber     uint32 // for DUID-EN. Ignored otherwise
	EnterpriseIdentifier []byte // for DUID-EN. Ignored otherwise
	Uuid                 []byte // for DUID-UUID. Ignored otherwise
	Opaque               []byte // for unknown DUIDs
}

Duid is a DHCP Unique Identifier.

func DuidFromBytes

func DuidFromBytes(data []byte) (*Duid, error)

DuidFromBytes parses a Duid from a byte slice.

func (Duid) Equal

func (d Duid) Equal(o Duid) bool

Equal compares two Duid objects.

func (*Duid) Length

func (d *Duid) Length() int

Length returns the DUID length in bytes.

func (*Duid) String

func (d *Duid) String() string

func (*Duid) ToBytes

func (d *Duid) ToBytes() []byte

ToBytes serializes a Duid object.

type DuidType

type DuidType uint16

DuidType is the DUID type as defined in rfc3315.

const (
	DUID_LLT  DuidType = 1
	DUID_EN   DuidType = 2
	DUID_LL   DuidType = 3
	DUID_UUID DuidType = 4
)

DUID types

func (DuidType) String

func (d DuidType) String() string

type Duration

type Duration struct {
	time.Duration
}

Duration is a duration as embedded in IA messages (IAPD, IANA, IATA).

func (Duration) Marshal

func (d Duration) Marshal(buf *uio.Lexer)

Marshal encodes the time in uint32 seconds as defined by RFC 3315 for IANA messages.

func (*Duration) Unmarshal

func (d *Duration) Unmarshal(buf *uio.Lexer)

Unmarshal decodes time from uint32 seconds as defined by RFC 3315 for IANA messages.

type IdentityOptions

type IdentityOptions struct {
	Options
}

IdentityOptions implement the options allowed for IA_NA and IA_TA messages.

The allowed options are identified in RFC 3315 Appendix B.

func (IdentityOptions) Addresses

func (io IdentityOptions) Addresses() []*OptIAAddress

Addresses returns the addresses assigned to the identity.

func (IdentityOptions) OneAddress

func (io IdentityOptions) OneAddress() *OptIAAddress

OneAddress returns one address (of potentially many) assigned to the identity.

func (IdentityOptions) Status

func (io IdentityOptions) Status() *OptStatusCode

Status returns the status code associated with this option.

type Message

type Message struct {
	MessageType   MessageType
	TransactionID TransactionID
	Options       MessageOptions
}

Message represents a DHCPv6 Message as defined by RFC 3315 Section 6.

func MessageFromBytes

func MessageFromBytes(data []byte) (*Message, error)

MessageFromBytes parses a DHCPv6 message from a byte stream.

func NewAdvertiseFromSolicit

func NewAdvertiseFromSolicit(sol *Message, modifiers ...Modifier) (*Message, error)

NewAdvertiseFromSolicit creates a new ADVERTISE packet based on an SOLICIT packet.

func NewMessage

func NewMessage(modifiers ...Modifier) (*Message, error)

NewMessage creates a new DHCPv6 message with default options

func NewReplyFromMessage

func NewReplyFromMessage(msg *Message, modifiers ...Modifier) (*Message, error)

NewReplyFromMessage creates a new REPLY packet based on a Message. The function is to be used when generating a reply to a SOLICIT with rapid-commit, REQUEST, CONFIRM, RENEW, REBIND, RELEASE and INFORMATION-REQUEST packets.

func NewRequestFromAdvertise

func NewRequestFromAdvertise(adv *Message, modifiers ...Modifier) (*Message, error)

NewRequestFromAdvertise creates a new REQUEST packet based on an ADVERTISE packet options.

func NewSolicit

func NewSolicit(hwaddr net.HardwareAddr, modifiers ...Modifier) (*Message, error)

NewSolicit creates a new SOLICIT message, using the given hardware address to derive the IAID in the IA_NA option.

func (*Message) AddOption

func (m *Message) AddOption(option Option)

AddOption adds an option to this message.

func (*Message) GetInnerMessage

func (m *Message) GetInnerMessage() (*Message, error)

GetInnerMessage returns the message itself.

func (*Message) GetOneOption

func (m *Message) GetOneOption(code OptionCode) Option

GetOneOption returns the first associated option with the code from this message.

func (*Message) GetOption

func (m *Message) GetOption(code OptionCode) []Option

GetOption returns the options associated with the code.

func (*Message) IsNetboot

func (m *Message) IsNetboot() bool

IsNetboot returns true if the machine is trying to netboot. It checks if "boot file" is one of the requested options, which is useful for SOLICIT/REQUEST packet types, it also checks if the "boot file" option is included in the packet, which is useful for ADVERTISE/REPLY packet.

func (*Message) IsOptionRequested

func (m *Message) IsOptionRequested(requested OptionCode) bool

IsOptionRequested takes an OptionCode and returns true if that option is within the requested options of the DHCPv6 message.

func (*Message) IsRelay

func (m *Message) IsRelay() bool

IsRelay returns whether this is a relay message or not.

func (*Message) String

func (m *Message) String() string

String returns a short human-readable string for this message.

func (*Message) Summary

func (m *Message) Summary() string

Summary prints all options associated with this message.

func (*Message) ToBytes

func (m *Message) ToBytes() []byte

ToBytes returns the serialized version of this message as defined by RFC 3315, Section 5.

func (Message) Type

func (m Message) Type() MessageType

Type returns this message's message type.

func (*Message) UpdateOption

func (m *Message) UpdateOption(option Option)

UpdateOption updates the existing options with the passed option, adding it at the end if not present already

type MessageOptions

type MessageOptions struct {
	Options
}

MessageOptions are the options that may appear in a normal DHCPv6 message.

RFC 3315 Appendix B lists the valid options that can be used.

func (MessageOptions) ArchTypes

func (mo MessageOptions) ArchTypes() iana.Archs

ArchTypes returns the architecture type option.

func (MessageOptions) BootFileParam

func (mo MessageOptions) BootFileParam() []string

BootFileParam returns the Boot File Param option as defined by RFC 5970.

func (MessageOptions) BootFileURL

func (mo MessageOptions) BootFileURL() string

BootFileURL returns the Boot File URL option as defined by RFC 5970.

func (MessageOptions) ClientID

func (mo MessageOptions) ClientID() *Duid

ClientID returns the client identifier option.

func (MessageOptions) DHCP4oDHCP6Server

func (mo MessageOptions) DHCP4oDHCP6Server() *OptDHCP4oDHCP6Server

DHCP4oDHCP6Server returns the DHCP 4o6 Server Address option as defined by RFC 7341.

func (MessageOptions) DNS

func (mo MessageOptions) DNS() []net.IP

DNS returns the DNS Recursive Name Server option as defined by RFC 3646.

func (MessageOptions) DomainSearchList

func (mo MessageOptions) DomainSearchList() *rfc1035label.Labels

DomainSearchList returns the Domain List option as defined by RFC 3646.

func (MessageOptions) ElapsedTime

func (mo MessageOptions) ElapsedTime() time.Duration

ElapsedTime returns the Elapsed Time option as defined by RFC 3315 Section 22.9.

ElapsedTime returns a duration of 0 if the option is not present.

func (MessageOptions) FQDN

func (mo MessageOptions) FQDN() *OptFQDN

FQDN returns the FQDN option as defined by RFC 4704.

func (MessageOptions) IANA

func (mo MessageOptions) IANA() []*OptIANA

IANA returns all Identity Association for Non-temporary Address options.

func (MessageOptions) IAPD

func (mo MessageOptions) IAPD() []*OptIAPD

IAPD returns all Identity Association for Prefix Delegation options.

func (MessageOptions) IATA

func (mo MessageOptions) IATA() []*OptIATA

IATA returns all Identity Association for Temporary Address options.

func (MessageOptions) InformationRefreshTime

func (mo MessageOptions) InformationRefreshTime(def time.Duration) time.Duration

InformationRefreshTime returns the Information Refresh Time option as defined by RFC 815 Section 21.23.

InformationRefreshTime returns the provided default if no option is present.

func (MessageOptions) OneIANA

func (mo MessageOptions) OneIANA() *OptIANA

OneIANA returns the first IANA option.

func (MessageOptions) OneIAPD

func (mo MessageOptions) OneIAPD() *OptIAPD

OneIAPD returns the first IAPD option.

func (MessageOptions) OneIATA

func (mo MessageOptions) OneIATA() *OptIATA

OneIATA returns the first IATA option.

func (MessageOptions) RequestedOptions

func (mo MessageOptions) RequestedOptions() OptionCodes

RequestedOptions returns the Options Requested Option.

func (MessageOptions) ServerID

func (mo MessageOptions) ServerID() *Duid

ServerID returns the server identifier option.

func (MessageOptions) Status

func (mo MessageOptions) Status() *OptStatusCode

Status returns the status code associated with this option.

func (MessageOptions) UserClasses

func (mo MessageOptions) UserClasses() [][]byte

UserClasses returns a list of user classes.

func (MessageOptions) VendorOpt

func (mo MessageOptions) VendorOpt(enterpriseNumber uint32) Options

VendorOpt returns the vendor options matching the given enterprise number.

RFC 8415 Section 21.17:

Servers and clients MUST NOT send more than one instance of the
Vendor-specific Information option with the same Enterprise Number.

func (MessageOptions) VendorOpts

func (mo MessageOptions) VendorOpts() []*OptVendorOpts

VendorOpts returns the all vendor-specific options.

RFC 8415 Section 21.17:

Multiple instances of the Vendor-specific Information option may appear in
a DHCP message.

type MessageType

type MessageType uint8

MessageType represents the kind of DHCPv6 message.

const (
	// MessageTypeNone is used internally and is not part of the RFC.
	MessageTypeNone               MessageType = 0
	MessageTypeSolicit            MessageType = 1
	MessageTypeAdvertise          MessageType = 2
	MessageTypeRequest            MessageType = 3
	MessageTypeConfirm            MessageType = 4
	MessageTypeRenew              MessageType = 5
	MessageTypeRebind             MessageType = 6
	MessageTypeReply              MessageType = 7
	MessageTypeRelease            MessageType = 8
	MessageTypeDecline            MessageType = 9
	MessageTypeReconfigure        MessageType = 10
	MessageTypeInformationRequest MessageType = 11
	MessageTypeRelayForward       MessageType = 12
	MessageTypeRelayReply         MessageType = 13
	MessageTypeLeaseQuery         MessageType = 14
	MessageTypeLeaseQueryReply    MessageType = 15
	MessageTypeLeaseQueryDone     MessageType = 16
	MessageTypeLeaseQueryData     MessageType = 17

	MessageTypeDHCPv4Query    MessageType = 20
	MessageTypeDHCPv4Response MessageType = 21
)

The DHCPv6 message types defined per RFC 3315, Section 5.3.

func (MessageType) String

func (m MessageType) String() string

String prints the message type name.

type Modifier

type Modifier func(d DHCPv6)

Modifier defines the signature for functions that can modify DHCPv6 structures. This is used to simplify packet manipulation

func WithArchType

func WithArchType(at iana.Arch) Modifier

WithArchType adds an arch type option to the packet

func WithClientID

func WithClientID(duid Duid) Modifier

WithClientID adds a client ID option to a DHCPv6 packet

func WithClientLinkLayerAddress

func WithClientLinkLayerAddress(ht iana.HWType, lla net.HardwareAddr) Modifier

WithClientLinkLayerAddress adds or updates the ClientLinkLayerAddress option with provided HWType and HWAddress on a DHCPv6 packet

func WithDHCP4oDHCP6Server

func WithDHCP4oDHCP6Server(addrs ...net.IP) Modifier

WithDHCP4oDHCP6Server adds or updates an OptDHCP4oDHCP6Server

func WithDNS

func WithDNS(dnses ...net.IP) Modifier

WithDNS adds or updates an OptDNSRecursiveNameServer

func WithDomainSearchList

func WithDomainSearchList(searchlist ...string) Modifier

WithDomainSearchList adds or updates an OptDomainSearchList

func WithFQDN

func WithFQDN(flags uint8, domainname string) Modifier

WithFQDN adds a fully qualified domain name option to the packet

func WithIAID

func WithIAID(iaid [4]byte) Modifier

WithIAID updates an OptIANA option with the provided IAID

func WithIANA

func WithIANA(addrs ...OptIAAddress) Modifier

WithIANA adds or updates an OptIANA option with the provided IAAddress options

func WithIAPD

func WithIAPD(iaid [4]byte, prefixes ...*OptIAPrefix) Modifier

WithIAPD adds or updates an IAPD option with the provided IAID and prefix options to a DHCPv6 packet.

func WithIATA

func WithIATA(addrs ...OptIAAddress) Modifier

WithIATA adds or updates an OptIANA option with the provided IAAddress options

func WithInformationRefreshTime

func WithInformationRefreshTime(irt time.Duration) Modifier

WithInformationRefreshTime adds an optInformationRefreshTime to the DHCPv6 packet using the provided duration

func WithOption

func WithOption(o Option) Modifier

WithOption adds the specific option to the DHCPv6 message.

func WithRequestedOptions

func WithRequestedOptions(codes ...OptionCode) Modifier

WithRequestedOptions adds requested options to the packet

func WithServerID

func WithServerID(duid Duid) Modifier

WithServerID adds a client ID option to a DHCPv6 packet

func WithUserClass

func WithUserClass(uc []byte) Modifier

WithUserClass adds a user class option to the packet

type NetworkInterfaceType

type NetworkInterfaceType uint8

NetworkInterfaceType is the NIC type as defined by RFC 4578 Section 2.2

const (
	NII_LANDESK_NOPXE   NetworkInterfaceType = 0
	NII_PXE_GEN_I       NetworkInterfaceType = 1
	NII_PXE_GEN_II      NetworkInterfaceType = 2
	NII_UNDI_NOEFI      NetworkInterfaceType = 3
	NII_UNDI_EFI_GEN_I  NetworkInterfaceType = 4
	NII_UNDI_EFI_GEN_II NetworkInterfaceType = 5
)

see rfc4578

func (NetworkInterfaceType) String

func (nit NetworkInterfaceType) String() string

type Opt4RD

type Opt4RD Options

Opt4RD represents a 4RD option. It is only a container for 4RD_*_RULE options

func ParseOpt4RD

func ParseOpt4RD(data []byte) (*Opt4RD, error)

ParseOpt4RD builds an Opt4RD structure from a sequence of bytes. The input data does not include option code and length bytes

func (*Opt4RD) Code

func (op *Opt4RD) Code() OptionCode

Code returns the Option Code for this option

func (*Opt4RD) String

func (op *Opt4RD) String() string

String returns a human-readable representation of the option

func (*Opt4RD) ToBytes

func (op *Opt4RD) ToBytes() []byte

ToBytes serializes this option

type Opt4RDMapRule

type Opt4RDMapRule struct {
	// Prefix4 is the IPv4 prefix mapped by this rule
	Prefix4 net.IPNet
	// Prefix6 is the IPv6 prefix mapped by this rule
	Prefix6 net.IPNet
	// EABitsLength is the number of bits of an address used in constructing the mapped address
	EABitsLength uint8
	// WKPAuthorized determines if well-known ports are assigned to addresses in an A+P mapping
	// It can only be set if the length of Prefix4 + EABits > 32
	WKPAuthorized bool
}

Opt4RDMapRule represents a 4RD Mapping Rule option The option is described in https://tools.ietf.org/html/rfc7600#section-4.9 The 4RD mapping rules are described in https://tools.ietf.org/html/rfc7600#section-4.2

func ParseOpt4RDMapRule

func ParseOpt4RDMapRule(data []byte) (*Opt4RDMapRule, error)

ParseOpt4RDMapRule builds an Opt4RDMapRule structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*Opt4RDMapRule) Code

func (op *Opt4RDMapRule) Code() OptionCode

Code returns the option code representing this option

func (*Opt4RDMapRule) String

func (op *Opt4RDMapRule) String() string

String returns a human-readable description of this option

func (*Opt4RDMapRule) ToBytes

func (op *Opt4RDMapRule) ToBytes() []byte

ToBytes serializes this option

type Opt4RDNonMapRule

type Opt4RDNonMapRule struct {
	// HubAndSpoke is whether the network topology is hub-and-spoke or meshed
	HubAndSpoke bool
	// TrafficClass is an optional 8-bit tunnel traffic class identifier
	TrafficClass *uint8
	// DomainPMTU is the Path MTU for this 4RD domain
	DomainPMTU uint16
}

Opt4RDNonMapRule represents 4RD parameters other than mapping rules

func ParseOpt4RDNonMapRule

func ParseOpt4RDNonMapRule(data []byte) (*Opt4RDNonMapRule, error)

ParseOpt4RDNonMapRule builds an Opt4RDNonMapRule structure from a sequence of bytes. The input data does not include option code and length bytes

func (*Opt4RDNonMapRule) Code

func (op *Opt4RDNonMapRule) Code() OptionCode

Code returns the option code for this option

func (*Opt4RDNonMapRule) String

func (op *Opt4RDNonMapRule) String() string

String returns a human-readable description of this option

func (*Opt4RDNonMapRule) ToBytes

func (op *Opt4RDNonMapRule) ToBytes() []byte

ToBytes serializes this option

type OptDHCP4oDHCP6Server

type OptDHCP4oDHCP6Server struct {
	DHCP4oDHCP6Servers []net.IP
}

OptDHCP4oDHCP6Server represents a OptionDHCP4oDHCP6Server option

This module defines the OptDHCP4oDHCP6Server structure. https://www.ietf.org/rfc/rfc7341.txt

func ParseOptDHCP4oDHCP6Server

func ParseOptDHCP4oDHCP6Server(data []byte) (*OptDHCP4oDHCP6Server, error)

ParseOptDHCP4oDHCP6Server builds an OptDHCP4oDHCP6Server structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptDHCP4oDHCP6Server) Code

func (op *OptDHCP4oDHCP6Server) Code() OptionCode

Code returns the option code

func (*OptDHCP4oDHCP6Server) String

func (op *OptDHCP4oDHCP6Server) String() string

func (*OptDHCP4oDHCP6Server) ToBytes

func (op *OptDHCP4oDHCP6Server) ToBytes() []byte

ToBytes returns the option serialized to bytes.

type OptDHCPv4Msg

type OptDHCPv4Msg struct {
	Msg *dhcpv4.DHCPv4
}

OptDHCPv4Msg represents a OptionDHCPv4Msg option

This module defines the OptDHCPv4Msg structure. https://www.ietf.org/rfc/rfc7341.txt

func ParseOptDHCPv4Msg

func ParseOptDHCPv4Msg(data []byte) (*OptDHCPv4Msg, error)

ParseOptDHCPv4Msg builds an OptDHCPv4Msg structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptDHCPv4Msg) Code

func (op *OptDHCPv4Msg) Code() OptionCode

Code returns the option code

func (*OptDHCPv4Msg) String

func (op *OptDHCPv4Msg) String() string

func (*OptDHCPv4Msg) ToBytes

func (op *OptDHCPv4Msg) ToBytes() []byte

ToBytes returns the option serialized to bytes.

type OptFQDN

type OptFQDN struct {
	Flags      uint8
	DomainName *rfc1035label.Labels
}

OptFQDN implements OptionFQDN option.

https://tools.ietf.org/html/rfc4704

func ParseOptFQDN

func ParseOptFQDN(data []byte) (*OptFQDN, error)

ParseOptFQDN deserializes from bytes to build a OptFQDN structure.

func (*OptFQDN) Code

func (op *OptFQDN) Code() OptionCode

Code returns the option code.

func (*OptFQDN) String

func (op *OptFQDN) String() string

func (*OptFQDN) ToBytes

func (op *OptFQDN) ToBytes() []byte

ToBytes serializes the option and returns it as a sequence of bytes

type OptIAAddress

type OptIAAddress struct {
	IPv6Addr          net.IP
	PreferredLifetime time.Duration
	ValidLifetime     time.Duration
	Options           AddressOptions
}

OptIAAddress represents an OptionIAAddr.

This module defines the OptIAAddress structure. https://www.ietf.org/rfc/rfc3633.txt

func ParseOptIAAddress

func ParseOptIAAddress(data []byte) (*OptIAAddress, error)

ParseOptIAAddress builds an OptIAAddress structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptIAAddress) Code

func (op *OptIAAddress) Code() OptionCode

Code returns the option's code

func (*OptIAAddress) String

func (op *OptIAAddress) String() string

func (*OptIAAddress) ToBytes

func (op *OptIAAddress) ToBytes() []byte

ToBytes serializes the option and returns it as a sequence of bytes

type OptIANA

type OptIANA struct {
	IaId    [4]byte
	T1      time.Duration
	T2      time.Duration
	Options IdentityOptions
}

OptIANA implements the identity association for non-temporary addresses option.

This module defines the OptIANA structure. https://www.ietf.org/rfc/rfc3633.txt

func ParseOptIANA

func ParseOptIANA(data []byte) (*OptIANA, error)

ParseOptIANA builds an OptIANA structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptIANA) Code

func (op *OptIANA) Code() OptionCode

func (*OptIANA) String

func (op *OptIANA) String() string

func (*OptIANA) ToBytes

func (op *OptIANA) ToBytes() []byte

ToBytes serializes IANA to DHCPv6 bytes.

type OptIAPD

type OptIAPD struct {
	IaId    [4]byte
	T1      time.Duration
	T2      time.Duration
	Options PDOptions
}

OptIAPD implements the identity association for prefix delegation option defined by RFC 3633, Section 9.

func ParseOptIAPD

func ParseOptIAPD(data []byte) (*OptIAPD, error)

ParseOptIAPD builds an OptIAPD structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptIAPD) Code

func (op *OptIAPD) Code() OptionCode

Code returns the option code

func (*OptIAPD) String

func (op *OptIAPD) String() string

String returns a string representation of the OptIAPD data

func (*OptIAPD) ToBytes

func (op *OptIAPD) ToBytes() []byte

ToBytes serializes the option and returns it as a sequence of bytes

type OptIAPrefix

type OptIAPrefix struct {
	PreferredLifetime time.Duration
	ValidLifetime     time.Duration
	Prefix            *net.IPNet
	Options           PrefixOptions
}

OptIAPrefix implements the IAPrefix option.

This module defines the OptIAPrefix structure. https://www.ietf.org/rfc/rfc3633.txt

func ParseOptIAPrefix

func ParseOptIAPrefix(data []byte) (*OptIAPrefix, error)

ParseOptIAPrefix an OptIAPrefix structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptIAPrefix) Code

func (op *OptIAPrefix) Code() OptionCode

func (*OptIAPrefix) String

func (op *OptIAPrefix) String() string

func (*OptIAPrefix) ToBytes

func (op *OptIAPrefix) ToBytes() []byte

ToBytes marshals this option according to RFC 3633, Section 10.

type OptIATA

type OptIATA struct {
	IaId    [4]byte
	Options IdentityOptions
}

OptIATA implements the identity association for non-temporary addresses option.

This module defines the OptIATA structure. https://www.ietf.org/rfc/rfc8415.txt

func ParseOptIATA

func ParseOptIATA(data []byte) (*OptIATA, error)

ParseOptIATA builds an OptIATA structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptIATA) Code

func (op *OptIATA) Code() OptionCode

Code returns the option code for an IA_TA

func (*OptIATA) String

func (op *OptIATA) String() string

func (*OptIATA) ToBytes

func (op *OptIATA) ToBytes() []byte

ToBytes serializes IATA to DHCPv6 bytes.

type OptNetworkInterfaceID

type OptNetworkInterfaceID struct {
	Typ NetworkInterfaceType

	// Revision number
	Major, Minor uint8
}

OptNetworkInterfaceID implements the NIC ID option for network booting as defined by RFC 4578 Section 2.2 and RFC 5970 Section 3.4.

func (*OptNetworkInterfaceID) Code

Code implements Option.Code.

func (*OptNetworkInterfaceID) FromBytes

func (op *OptNetworkInterfaceID) FromBytes(data []byte) error

FromBytes builds an OptNetworkInterfaceID structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptNetworkInterfaceID) String

func (op *OptNetworkInterfaceID) String() string

func (*OptNetworkInterfaceID) ToBytes

func (op *OptNetworkInterfaceID) ToBytes() []byte

ToBytes implements Option.ToBytes.

type OptRemoteID

type OptRemoteID struct {
	EnterpriseNumber uint32
	RemoteID         []byte
}

OptRemoteID implemens the Remote ID option as defined by RFC 4649.

func ParseOptRemoteID

func ParseOptRemoteID(data []byte) (*OptRemoteID, error)

ParseOptRemoteId builds an OptRemoteId structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptRemoteID) Code

func (*OptRemoteID) Code() OptionCode

Code implements Option.Code.

func (*OptRemoteID) String

func (op *OptRemoteID) String() string

func (*OptRemoteID) ToBytes

func (op *OptRemoteID) ToBytes() []byte

ToBytes serializes this option to a byte stream.

type OptStatusCode

type OptStatusCode struct {
	StatusCode    iana.StatusCode
	StatusMessage string
}

OptStatusCode represents a DHCPv6 Status Code option

This module defines the OptStatusCode structure. https://www.ietf.org/rfc/rfc3315.txt

func ParseOptStatusCode

func ParseOptStatusCode(data []byte) (*OptStatusCode, error)

ParseOptStatusCode builds an OptStatusCode structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptStatusCode) Code

func (op *OptStatusCode) Code() OptionCode

Code returns the option code.

func (*OptStatusCode) String

func (op *OptStatusCode) String() string

String returns a human-readable option.

func (*OptStatusCode) ToBytes

func (op *OptStatusCode) ToBytes() []byte

ToBytes serializes the option and returns it as a sequence of bytes.

type OptUserClass

type OptUserClass struct {
	UserClasses [][]byte
}

OptUserClass represent a DHCPv6 User Class option

This module defines the OptUserClass structure. https://www.ietf.org/rfc/rfc3315.txt

func ParseOptUserClass

func ParseOptUserClass(data []byte) (*OptUserClass, error)

ParseOptUserClass builds an OptUserClass structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptUserClass) Code

func (op *OptUserClass) Code() OptionCode

Code returns the option code

func (*OptUserClass) String

func (op *OptUserClass) String() string

func (*OptUserClass) ToBytes

func (op *OptUserClass) ToBytes() []byte

ToBytes serializes the option and returns it as a sequence of bytes

type OptVendorClass

type OptVendorClass struct {
	EnterpriseNumber uint32
	Data             [][]byte
}

OptVendorClass represents a DHCPv6 Vendor Class option

func ParseOptVendorClass

func ParseOptVendorClass(data []byte) (*OptVendorClass, error)

ParseOptVendorClass builds an OptVendorClass structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptVendorClass) Code

func (op *OptVendorClass) Code() OptionCode

Code returns the option code

func (*OptVendorClass) String

func (op *OptVendorClass) String() string

String returns a string representation of the VendorClass data

func (*OptVendorClass) ToBytes

func (op *OptVendorClass) ToBytes() []byte

ToBytes serializes the option and returns it as a sequence of bytes

type OptVendorOpts

type OptVendorOpts struct {
	EnterpriseNumber uint32
	VendorOpts       Options
}

OptVendorOpts represents a DHCPv6 Status Code option

This module defines the OptVendorOpts structure. https://tools.ietf.org/html/rfc3315#section-22.17

func ParseOptVendorOpts

func ParseOptVendorOpts(data []byte) (*OptVendorOpts, error)

ParseOptVendorOpts builds an OptVendorOpts structure from a sequence of bytes. The input data does not include option code and length bytes.

func (*OptVendorOpts) Code

func (op *OptVendorOpts) Code() OptionCode

Code returns the option code

func (*OptVendorOpts) String

func (op *OptVendorOpts) String() string

String returns a string representation of the VendorOpts data

func (*OptVendorOpts) ToBytes

func (op *OptVendorOpts) ToBytes() []byte

ToBytes serializes the option and returns it as a sequence of bytes

type Option

type Option interface {
	Code() OptionCode
	ToBytes() []byte
	String() string
}

Option is an interface that all DHCPv6 options adhere to.

func OptBootFileParam

func OptBootFileParam(args ...string) Option

OptBootFileParam returns a BootfileParam option as defined in RFC 5970 Section 3.2.

func OptBootFileURL

func OptBootFileURL(url string) Option

OptBootFileURL returns a OptionBootfileURL as defined by RFC 5970.

func OptClientArchType

func OptClientArchType(a ...iana.Arch) Option

OptClientArchType represents an option CLIENT_ARCH_TYPE.

This module defines the OptClientArchType structure. https://www.ietf.org/rfc/rfc5970.txt

func OptClientID

func OptClientID(d Duid) Option

OptClientID represents a Client Identifier option as defined by RFC 3315 Section 22.2.

func OptDNS

func OptDNS(ip ...net.IP) Option

OptDNS returns a DNS Recursive Name Server option as defined by RFC 3646.

func OptDomainSearchList

func OptDomainSearchList(labels *rfc1035label.Labels) Option

OptDomainSearchList returns a DomainSearchList option as defined by RFC 3646.

func OptElapsedTime

func OptElapsedTime(dur time.Duration) Option

OptElapsedTime returns an Elapsed Time option as defined by RFC 3315 Section 22.9.

func OptInterfaceID

func OptInterfaceID(id []byte) Option

OptInterfaceID returns an interface id option as defined by RFC 3315, Section 22.18.

func OptRelayMessage

func OptRelayMessage(msg DHCPv6) Option

OptRelayMessage embeds a message in a relay option.

func OptRequestedOption

func OptRequestedOption(o ...OptionCode) Option

OptRequestedOption implements the requested options option as defined by RFC 3315 Section 22.7.

func OptServerID

func OptServerID(d Duid) Option

OptServerID represents a Server Identifier option as defined by RFC 3315 Section 22.1.

func ParseOption

func ParseOption(code OptionCode, optData []byte) (Option, error)

ParseOption parses data according to the given code.

type OptionCode

type OptionCode uint16

OptionCode is a single byte representing the code for a given Option.

const (
	OptionClientID    OptionCode = 1
	OptionServerID    OptionCode = 2
	OptionIANA        OptionCode = 3
	OptionIATA        OptionCode = 4
	OptionIAAddr      OptionCode = 5
	OptionORO         OptionCode = 6
	OptionPreference  OptionCode = 7
	OptionElapsedTime OptionCode = 8
	OptionRelayMsg    OptionCode = 9

	OptionAuth                           OptionCode = 11
	OptionUnicast                        OptionCode = 12
	OptionStatusCode                     OptionCode = 13
	OptionRapidCommit                    OptionCode = 14
	OptionUserClass                      OptionCode = 15
	OptionVendorClass                    OptionCode = 16
	OptionVendorOpts                     OptionCode = 17
	OptionInterfaceID                    OptionCode = 18
	OptionReconfMessage                  OptionCode = 19
	OptionReconfAccept                   OptionCode = 20
	OptionSIPServersDomainNameList       OptionCode = 21
	OptionSIPServersIPv6AddressList      OptionCode = 22
	OptionDNSRecursiveNameServer         OptionCode = 23
	OptionDomainSearchList               OptionCode = 24
	OptionIAPD                           OptionCode = 25
	OptionIAPrefix                       OptionCode = 26
	OptionNISServers                     OptionCode = 27
	OptionNISPServers                    OptionCode = 28
	OptionNISDomainName                  OptionCode = 29
	OptionNISPDomainName                 OptionCode = 30
	OptionSNTPServerList                 OptionCode = 31
	OptionInformationRefreshTime         OptionCode = 32
	OptionBCMCSControllerDomainNameList  OptionCode = 33
	OptionBCMCSControllerIPv6AddressList OptionCode = 34

	OptionGeoConfCivic                            OptionCode = 36
	OptionRemoteID                                OptionCode = 37
	OptionRelayAgentSubscriberID                  OptionCode = 38
	OptionFQDN                                    OptionCode = 39
	OptionPANAAuthenticationAgent                 OptionCode = 40
	OptionNewPOSIXTimezone                        OptionCode = 41
	OptionNewTZDBTimezone                         OptionCode = 42
	OptionEchoRequest                             OptionCode = 43
	OptionLQQuery                                 OptionCode = 44
	OptionClientData                              OptionCode = 45
	OptionCLTTime                                 OptionCode = 46
	OptionLQRelayData                             OptionCode = 47
	OptionLQClientLink                            OptionCode = 48
	OptionMIPv6HomeNetworkIDFQDN                  OptionCode = 49
	OptionMIPv6VisitedHomeNetworkInformation      OptionCode = 50
	OptionLoSTServer                              OptionCode = 51
	OptionCAPWAPAccessControllerAddresses         OptionCode = 52
	OptionRelayID                                 OptionCode = 53
	OptionIPv6AddressMOS                          OptionCode = 54
	OptionIPv6FQDNMOS                             OptionCode = 55
	OptionNTPServer                               OptionCode = 56
	OptionV6AccessDomain                          OptionCode = 57
	OptionSIPUACSList                             OptionCode = 58
	OptionBootfileURL                             OptionCode = 59
	OptionBootfileParam                           OptionCode = 60
	OptionClientArchType                          OptionCode = 61
	OptionNII                                     OptionCode = 62
	OptionGeolocation                             OptionCode = 63
	OptionAFTRName                                OptionCode = 64
	OptionERPLocalDomainName                      OptionCode = 65
	OptionRSOO                                    OptionCode = 66
	OptionPDExclude                               OptionCode = 67
	OptionVirtualSubnetSelection                  OptionCode = 68
	OptionMIPv6IdentifiedHomeNetworkInformation   OptionCode = 69
	OptionMIPv6UnrestrictedHomeNetworkInformation OptionCode = 70
	OptionMIPv6HomeNetworkPrefix                  OptionCode = 71
	OptionMIPv6HomeAgentAddress                   OptionCode = 72
	OptionMIPv6HomeAgentFQDN                      OptionCode = 73
	OptionRDNSSSelection                          OptionCode = 74
	OptionKRBPrincipalName                        OptionCode = 75
	OptionKRBRealmName                            OptionCode = 76
	OptionKRBDefaultRealmName                     OptionCode = 77
	OptionKRBKDC                                  OptionCode = 78
	OptionClientLinkLayerAddr                     OptionCode = 79
	OptionLinkAddress                             OptionCode = 80
	OptionRadius                                  OptionCode = 81
	OptionSolMaxRT                                OptionCode = 82
	OptionInfMaxRT                                OptionCode = 83
	OptionAddrSel                                 OptionCode = 84
	OptionAddrSelTable                            OptionCode = 85
	OptionV6PCPServer                             OptionCode = 86
	OptionDHCPv4Msg                               OptionCode = 87
	OptionDHCP4oDHCP6Server                       OptionCode = 88
	OptionS46Rule                                 OptionCode = 89
	OptionS46BR                                   OptionCode = 90
	OptionS46DMR                                  OptionCode = 91
	OptionS46V4V6Bind                             OptionCode = 92
	OptionS46PortParams                           OptionCode = 93
	OptionS46ContMapE                             OptionCode = 94
	OptionS46ContMapT                             OptionCode = 95
	OptionS46ContLW                               OptionCode = 96
	Option4RD                                     OptionCode = 97
	Option4RDMapRule                              OptionCode = 98
	Option4RDNonMapRule                           OptionCode = 99
	OptionLQBaseTime                              OptionCode = 100
	OptionLQStartTime                             OptionCode = 101
	OptionLQEndTime                               OptionCode = 102
	OptionCaptivePortal                           OptionCode = 103
	OptionMPLParameters                           OptionCode = 104
	OptionANIAccessTechType                       OptionCode = 105
	OptionANINetworkName                          OptionCode = 106
	OptionANIAccessPointName                      OptionCode = 107
	OptionANIAccessPointBSSID                     OptionCode = 108
	OptionANIOperatorID                           OptionCode = 109
	OptionANIOperatorRealm                        OptionCode = 110
	OptionS46Priority                             OptionCode = 111
	OptionMUDUrlV6                                OptionCode = 112
	OptionV6Prefix64                              OptionCode = 113
	OptionFailoverBindingStatus                   OptionCode = 114
	OptionFailoverConnectFlags                    OptionCode = 115
	OptionFailoverDNSRemovalInfo                  OptionCode = 116
	OptionFailoverDNSHostName                     OptionCode = 117
	OptionFailoverDNSZoneName                     OptionCode = 118
	OptionFailoverDNSFlags                        OptionCode = 119
	OptionFailoverExpirationTime                  OptionCode = 120
	OptionFailoverMaxUnackedBNDUPD                OptionCode = 121
	OptionFailoverMCLT                            OptionCode = 122
	OptionFailoverPartnerLifetime                 OptionCode = 123
	OptionFailoverPartnerLifetimeSent             OptionCode = 124
	OptionFailoverPartnerDownTime                 OptionCode = 125
	OptionFailoverPartnerRawCLTTime               OptionCode = 126
	OptionFailoverProtocolVersion                 OptionCode = 127
	OptionFailoverKeepaliveTime                   OptionCode = 128
	OptionFailoverReconfigureData                 OptionCode = 129
	OptionFailoverRelationshipName                OptionCode = 130
	OptionFailoverServerFlags                     OptionCode = 131
	OptionFailoverServerState                     OptionCode = 132
	OptionFailoverStartTimeOfState                OptionCode = 133
	OptionFailoverStateExpirationTime             OptionCode = 134
	OptionRelayPort                               OptionCode = 135
	OptionV6SZTPRedirect                          OptionCode = 136
	OptionS46BindIPv6Prefix                       OptionCode = 137

	OptionIPv6AddressANDSF OptionCode = 143
)

All DHCPv6 options.

func (OptionCode) String

func (o OptionCode) String() string

String returns the option code name.

type OptionCodes

type OptionCodes []OptionCode

OptionCodes are a collection of option codes.

func (*OptionCodes) Add

func (o *OptionCodes) Add(c OptionCode)

Add adds an option to the list, ignoring duplicates.

func (OptionCodes) Contains

func (o OptionCodes) Contains(c OptionCode) bool

Contains returns whether the option codes contain c.

func (*OptionCodes) FromBytes

func (o *OptionCodes) FromBytes(data []byte) error

FromBytes populates o from binary-encoded data.

func (OptionCodes) String

func (o OptionCodes) String() string

func (OptionCodes) ToBytes

func (o OptionCodes) ToBytes() []byte

ToBytes implements Option.ToBytes.

type OptionGeneric

type OptionGeneric struct {
	OptionCode OptionCode
	OptionData []byte
}

func (*OptionGeneric) Code

func (og *OptionGeneric) Code() OptionCode

func (*OptionGeneric) String

func (og *OptionGeneric) String() string

func (*OptionGeneric) ToBytes

func (og *OptionGeneric) ToBytes() []byte

type OptionParser

type OptionParser func(code OptionCode, data []byte) (Option, error)

OptionParser is a function signature for option parsing

type Options

type Options []Option

Options is a collection of options.

func (*Options) Add

func (o *Options) Add(option Option)

Add appends one option.

func (*Options) Del

func (o *Options) Del(code OptionCode)

Del deletes all options matching the option code.

func (*Options) FromBytes

func (o *Options) FromBytes(data []byte) error

FromBytes reads data into o and returns an error if the options are not a valid serialized representation of DHCPv6 options per RFC 3315.

func (*Options) FromBytesWithParser

func (o *Options) FromBytesWithParser(data []byte, parser OptionParser) error

FromBytesWithParser parses Options from byte sequences using the parsing function that is passed in as a paremeter

func (Options) Get

func (o Options) Get(code OptionCode) []Option

Get returns all options matching the option code.

func (Options) GetOne

func (o Options) GetOne(code OptionCode) Option

GetOne returns the first option matching the option code.

func (Options) ToBytes

func (o Options) ToBytes() []byte

ToBytes marshals all options to bytes.

func (*Options) Update

func (o *Options) Update(option Option)

Update replaces the first option of the same type as the specified one.

type PDOptions

type PDOptions struct {
	Options
}

PDOptions are options used with the IAPD (prefix delegation) option.

RFC 3633 describes that IA_PD-options may contain the IAPrefix option and the StatusCode option.

func (PDOptions) Prefixes

func (po PDOptions) Prefixes() []*OptIAPrefix

Prefixes are the prefixes associated with this delegation.

func (PDOptions) Status

func (po PDOptions) Status() *OptStatusCode

Status returns the status code associated with this option.

type PrefixOptions

type PrefixOptions struct {
	Options
}

PrefixOptions are the options valid for use with IAPrefix option field.

RFC 3633 states that it's just the StatusCode option.

RFC 8415 Appendix C does not list the Status Code option as valid, but it does say that the previous text in RFC 8415 Section 21.22 supersedes that table. Section 21.22 does mention the Status Code option.

func (PrefixOptions) Status

func (po PrefixOptions) Status() *OptStatusCode

Status returns the status code associated with this option.

type RelayMessage

type RelayMessage struct {
	MessageType MessageType
	HopCount    uint8
	LinkAddr    net.IP
	PeerAddr    net.IP
	Options     RelayOptions
}

RelayMessage is a DHCPv6 relay agent message as defined by RFC 3315 Section 7.

func EncapsulateRelay

func EncapsulateRelay(d DHCPv6, mType MessageType, linkAddr, peerAddr net.IP) (*RelayMessage, error)

EncapsulateRelay creates a RelayMessage message containing the passed DHCPv6 message as payload. The passed message type must be either RELAY_FORW or RELAY_REPL

func RelayMessageFromBytes

func RelayMessageFromBytes(data []byte) (*RelayMessage, error)

RelayMessageFromBytes parses a relay message from a byte stream.

func (*RelayMessage) AddOption

func (r *RelayMessage) AddOption(option Option)

AddOption adds an option to this message.

func (*RelayMessage) GetInnerMessage

func (r *RelayMessage) GetInnerMessage() (*Message, error)

GetInnerMessage recurses into a relay message and extract and return the inner Message. Return nil if none found (e.g. not a relay message).

func (*RelayMessage) GetOneOption

func (r *RelayMessage) GetOneOption(code OptionCode) Option

GetOneOption returns the first associated option with the code from this message.

func (*RelayMessage) GetOption

func (r *RelayMessage) GetOption(code OptionCode) []Option

GetOption returns the options associated with the code.

func (*RelayMessage) IsRelay

func (r *RelayMessage) IsRelay() bool

IsRelay returns whether this is a relay message or not.

func (*RelayMessage) String

func (r *RelayMessage) String() string

String prints a short human-readable relay message.

func (*RelayMessage) Summary

func (r *RelayMessage) Summary() string

Summary prints all options associated with this relay message.

func (*RelayMessage) ToBytes

func (r *RelayMessage) ToBytes() []byte

ToBytes returns the serialized version of this relay message as defined by RFC 3315, Section 7.

func (*RelayMessage) Type

func (r *RelayMessage) Type() MessageType

Type is this relay message's types.

func (*RelayMessage) UpdateOption

func (r *RelayMessage) UpdateOption(option Option)

UpdateOption replaces the first option of the same type as the specified one.

type RelayOptions

type RelayOptions struct {
	Options
}

RelayOptions are the options valid for RelayForw and RelayRepl messages.

RFC 3315 Appendix B defines them to be InterfaceID and RelayMsg options; RFC 4649 also adds the RemoteID option.

func (RelayOptions) ClientLinkLayerAddress

func (ro RelayOptions) ClientLinkLayerAddress() (iana.HWType, net.HardwareAddr)

ClientLinkLayerAddress returns the Hardware Type and Link Layer Address of the requesting client in this relay message.

func (RelayOptions) InterfaceID

func (ro RelayOptions) InterfaceID() []byte

InterfaceID returns the interface ID of this relay message.

func (RelayOptions) RelayMessage

func (ro RelayOptions) RelayMessage() DHCPv6

RelayMessage returns the message embedded.

func (RelayOptions) RemoteID

func (ro RelayOptions) RemoteID() *OptRemoteID

RemoteID returns the remote ID in this relay message.

type TransactionID

type TransactionID [3]byte

TransactionID is a DHCPv6 Transaction ID defined by RFC 3315, Section 6.

func GenerateTransactionID

func GenerateTransactionID() (TransactionID, error)

GenerateTransactionID generates a random 3-byte transaction ID.

func GetTransactionID

func GetTransactionID(packet DHCPv6) (TransactionID, error)

GetTransactionID returns a transactionID of a message or its inner message in case of relay

func (TransactionID) String

func (xid TransactionID) String() string

String prints the transaction ID as a hex value.

Directories

Path Synopsis
Package nclient6 is a minimum-functionality client for DHCPv6.
Package nclient6 is a minimum-functionality client for DHCPv6.
Package server6 is a basic, extensible DHCPv6 server.
Package server6 is a basic, extensible DHCPv6 server.

Jump to

Keyboard shortcuts

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