package dhcp4client
import "github.com/d2g/dhcp4client"
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 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 New(options ...func(*Client) error) (*Client, error)
- 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 ¶
const (
MaxDHCPLen = 576
)
Functions ¶
func Broadcast ¶
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 IgnoreServers ¶
func MathGenerateXID ¶
func MathGenerateXID(b []byte)
func NewInetSock ¶
func SetLocalAddr ¶
func SetRemoteAddr ¶
func Timeout ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func (*Client) Close ¶
Close Connections
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) GetOffer ¶
Retreive Offer... Wait for the offer for a specific Discovery Packet.
func (*Client) Release ¶
Release a lease backed on the Acknowledgement Packet. Returns Any Errors
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) Request ¶
Lets do a Full DHCP Request.
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.
func (*Client) SetOption ¶
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
Source Files ¶
client.go generatexid.go inetsock.go
- Version
- v1.0.0 (latest)
- Published
- Jun 22, 2018
- Platform
- js/wasm
- Imports
- 10 packages
- Last checked
- 2 months ago –
Tools for package owners.