Documentation ¶
Index ¶
- Constants
- func Broadcast(b bool) func(*Client) error
- func Connection(conn ConnectionInt) func(*Client) error
- func CryptoGenerateXID(b []byte)
- func GenerateXID(g func([]byte)) func(*Client) error
- func HardwareAddr(h net.HardwareAddr) func(*Client) error
- func IgnoreServers(s []net.IP) func(*Client) error
- func MathGenerateXID(b []byte)
- func NewInetSock(options ...func(*inetSock) error) (*inetSock, error)
- func NewPacketSock(ifindex int, srcPort, dstPort uint16) (*packetSock, error)
- func SetLocalAddr(l net.UDPAddr) func(*inetSock) error
- func SetRemoteAddr(r net.UDPAddr) func(*inetSock) error
- func Timeout(t time.Duration) func(*Client) error
- type Client
- func (c *Client) Close() error
- func (c *Client) DeclinePacket(acknowledgement *dhcp4.Packet) dhcp4.Packet
- func (c *Client) DiscoverPacket() dhcp4.Packet
- func (c *Client) GetAcknowledgement(requestPacket *dhcp4.Packet) (dhcp4.Packet, error)
- func (c *Client) GetOffer(discoverPacket *dhcp4.Packet) (dhcp4.Packet, error)
- func (c *Client) Release(acknowledgement dhcp4.Packet) error
- func (c *Client) ReleasePacket(acknowledgement *dhcp4.Packet) dhcp4.Packet
- func (c *Client) Renew(acknowledgement dhcp4.Packet) (bool, dhcp4.Packet, error)
- func (c *Client) RenewalRequestPacket(acknowledgement *dhcp4.Packet) dhcp4.Packet
- func (c *Client) Request() (bool, dhcp4.Packet, error)
- func (c *Client) RequestPacket(offerPacket *dhcp4.Packet) dhcp4.Packet
- func (c *Client) SendDecline(acknowledgementPacket *dhcp4.Packet) (dhcp4.Packet, error)
- func (c *Client) SendDiscoverPacket() (dhcp4.Packet, error)
- func (c *Client) SendPacket(packet dhcp4.Packet) error
- func (c *Client) SendRequest(offerPacket *dhcp4.Packet) (dhcp4.Packet, error)
- func (c *Client) SetOption(options ...func(*Client) error) error
- type ConnectionInt
- type TimeoutError
Constants ¶
View Source
const ( DefaultSrcPort = 68 DefaultDstPort = 67 )
View Source
const (
MaxDHCPLen = 576
)
Variables ¶
This section is empty.
Functions ¶
func Connection ¶
func Connection(conn ConnectionInt) func(*Client) error
func CryptoGenerateXID ¶
func CryptoGenerateXID(b []byte)
func GenerateXID ¶
func HardwareAddr ¶
func HardwareAddr(h net.HardwareAddr) func(*Client) error
func MathGenerateXID ¶
func MathGenerateXID(b []byte)
func NewInetSock ¶
func NewPacketSock ¶
func SetLocalAddr ¶
func SetRemoteAddr ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DeclinePacket ¶
Create Decline Packet
func (*Client) DiscoverPacket ¶
Create Discover Packet
func (*Client) GetAcknowledgement ¶
Retreive Acknowledgement Wait for the offer for a specific Request Packet.
func (*Client) ReleasePacket ¶
Create Release Packet For a Release
func (*Client) Renew ¶
Renew a lease backed on the Acknowledgement Packet. Returns Sucessfull, The AcknoledgementPacket, Any Errors
func (*Client) RenewalRequestPacket ¶
Create Request Packet For a Renew
func (*Client) RequestPacket ¶
Create Request Packet
func (*Client) SendDecline ¶
Send Decline to the received acknowledgement.
func (*Client) SendDiscoverPacket ¶
Send the Discovery Packet to the Broadcast Channel
func (*Client) SendPacket ¶
Send a DHCP Packet.
func (*Client) SendRequest ¶
Send Request Based On the offer Received.
type ConnectionInt ¶
type ConnectionInt interface { Close() error Write(packet []byte) error ReadFrom() ([]byte, net.IP, error) SetReadTimeout(t time.Duration) error }
Abstracts the type of underlying socket used
type TimeoutError ¶
TimeoutError records a timeout when waiting for a DHCP packet.
func (*TimeoutError) Error ¶
func (te *TimeoutError) Error() string
Click to show internal directories.
Click to hide internal directories.