Documentation
¶
Index ¶
- Variables
- type Client
- func (client *Client) AddOption(optType layers.DHCPOpt, data []byte)
- func (client *Client) AddParamRequest(dhcpOpt layers.DHCPOpt)
- func (client *Client) Destroy()
- func (client *Client) Disable()
- func (client *Client) Enable(cb OnExchangeCallback)
- func (client *Client) Rebind()
- func (client *Client) Renew()
- type Lease
- type OnBoundCallback
- type OnExchangeCallback
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultParamsRequestList = []layers.DHCPOpt{ layers.DHCPOptSubnetMask, layers.DHCPOptRouter, layers.DHCPOptTimeServer, layers.DHCPOptDNS, layers.DHCPOptDomainName, layers.DHCPOptInterfaceMTU, layers.DHCPOptNTPServers, }
DefaultParamsRequestList is a list of params to be requested from the server
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Hostname string
Iface func() *net.Interface
Lease *Lease // The current lease
OnBound OnBoundCallback // On renew or rebound
OnEexchange OnExchangeCallback
DHCPOptions []Option // List of options to send on discovery and requests
HWAddr net.HardwareAddr // client's hardware address
// contains filtered or unexported fields
}
Client is a DHCP client instance
func NewClient ¶
func NewClient(clientName string, HWAddr net.HardwareAddr, getIface func() *net.Interface, OnBound OnBoundCallback) *Client
NewClient create and return new client
func (*Client) AddParamRequest ¶
AddParamRequest adds an parameter to parameter request list, if not included yet.
func (*Client) Enable ¶
func (client *Client) Enable(cb OnExchangeCallback)
Enable starts the client
type Lease ¶
type Lease struct {
ServerID net.IP
FixedAddress net.IP
Netmask net.IPMask
NextServer net.IP
Broadcast net.IP
Router []net.IP
DNS []net.IP
TimeServer []net.IP
DomainName string
MTU uint16
// Other options
OtherOptions []Option
Bound time.Time
Renew time.Time
Rebind time.Time
Expire time.Time
}
Lease is an assignment by the DHCP server
type OnBoundCallback ¶
type OnBoundCallback func(*Lease)
OnBoundCallback is a function called on certain events
type OnExchangeCallback ¶
type OnExchangeCallback func(error)
OnExchangeCallback is a function called on enabling will end
Click to show internal directories.
Click to hide internal directories.