Documentation ¶
Overview ¶
Package dhcp implements a DHCP client and server as described in RFC 2131.
Index ¶
Constants ¶
View Source
const ( // ServerPort is the well-known UDP port number for a DHCP server. ServerPort = 67 // ClientPort is the well-known UDP port number for a DHCP client. ClientPort = 68 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a DHCP client.
func NewClient ¶
func NewClient(s *stack.Stack, nicid tcpip.NICID, linkAddr tcpip.LinkAddress, acquiredFunc func(old, new tcpip.Address, cfg Config)) *Client
NewClient creates a DHCP client.
TODO: add s.LinkAddr(nicid) to *stack.Stack.
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, requestedAddr tcpip.Address) (cfg Config, reterr error)
Request executes a DHCP request session.
On success, it adds a new address to this client's TCPIP stack. If the server sets a lease limit a timer is set to automatically renew it.
type Config ¶
type Config struct { Error error ServerAddress tcpip.Address // address of the server SubnetMask tcpip.AddressMask // client address subnet mask Gateway tcpip.Address // client default gateway DNS []tcpip.Address // client DNS server addresses LeaseLength time.Duration // length of the address lease }
Config is standard DHCP configuration.
Click to show internal directories.
Click to hide internal directories.