v4

package
v0.0.0-...-d485828 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MinPackSize = 5*4 +
	2*4 +

	13*4 // minimal DHCPv4 header size

This is the aprox. minimal size of a DHCP packet

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfoV4

type ClientInfoV4 struct {
	IPAddr       net.IP
	IPMask       net.IPMask
	NextServer   net.IP
	BootFileName string
	Timeouts     struct {
		Reservation     time.Duration
		Lease           time.Duration
		T1RenewalTime   time.Duration
		T2RebindingTime time.Duration
	}
	Options struct {
		HostName          string
		DomainName        string
		Routers           []net.IP
		DomainNameServers []net.IP
		NTPServers        []net.IP
	}
}

type DHCPV4Conn

type DHCPV4Conn struct {
	// contains filtered or unexported fields
}

func ListenDHCPv4

func ListenDHCPv4(iface net.Interface, laddr net.IP) (*DHCPV4Conn, error)

func (*DHCPV4Conn) Close

func (c *DHCPV4Conn) Close() error

func (*DHCPV4Conn) ReadFrom

func (c *DHCPV4Conn) ReadFrom() (dhcpv4.DHCPv4, net.IP, net.HardwareAddr, error)

ReadFrom returns the parsed packet, source IP, source MAC, error

func (*DHCPV4Conn) WriteTo

func (c *DHCPV4Conn) WriteTo(pack dhcpv4.DHCPv4, dstIP net.IP, dstMAC net.HardwareAddr) error

type OptRebindingTime

type OptRebindingTime struct {
	RebindingTime uint32
}

OptRebindingTime represents the Rebinding (T1) Time Value option.

func ParseOptRebindingTime

func ParseOptRebindingTime(data []byte) (*OptRebindingTime, error)

ParseOptRebindingTime constructs an OptRebindingTime struct from a sequence of bytes and returns it, or an error.

func (*OptRebindingTime) Code

Code returns the option code.

func (*OptRebindingTime) Length

func (o *OptRebindingTime) Length() int

Length returns the length of the data portion (excluding option code and byte for length, if any).

func (*OptRebindingTime) String

func (o *OptRebindingTime) String() string

String returns a human-readable string for this option.

func (*OptRebindingTime) ToBytes

func (o *OptRebindingTime) ToBytes() []byte

ToBytes returns a serialized stream of bytes for this option.

type OptRenewalTime

type OptRenewalTime struct {
	RenewalTime uint32
}

OptRenewalTime represents the Renewal (T1) Time Value option.

func ParseOptRenewalTime

func ParseOptRenewalTime(data []byte) (*OptRenewalTime, error)

ParseOptRenewalTime constructs an OptRenewalTime struct from a sequence of bytes and returns it, or an error.

func (*OptRenewalTime) Code

func (o *OptRenewalTime) Code() dhcpv4.OptionCode

Code returns the option code.

func (*OptRenewalTime) Length

func (o *OptRenewalTime) Length() int

Length returns the length of the data portion (excluding option code and byte for length, if any).

func (*OptRenewalTime) String

func (o *OptRenewalTime) String() string

String returns a human-readable string for this option.

func (*OptRenewalTime) ToBytes

func (o *OptRenewalTime) ToBytes() []byte

ToBytes returns a serialized stream of bytes for this option.

Jump to

Keyboard shortcuts

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