package client6

import "github.com/insomniacslk/dhcp/dhcpv6/client6"

Index

Constants

const (
	DefaultWriteTimeout       = 3 * time.Second // time to wait for write calls
	DefaultReadTimeout        = 3 * time.Second // time to wait for read calls
	DefaultInterfaceUpTimeout = 3 * time.Second // time to wait before a network interface goes up
	MaxUDPReceivedPacketSize  = 8192            // arbitrary size. Theoretically could be up to 65kb
)

Client constants

Types

type Client

type Client struct {
	ReadTimeout   time.Duration
	WriteTimeout  time.Duration
	LocalAddr     net.Addr
	RemoteAddr    net.Addr
	SimulateRelay bool
	RelayOptions  dhcpv6.Options // These options will be added to relay message if SimulateRelay is true
}

Client implements a DHCPv6 client

func NewClient

func NewClient() *Client

NewClient returns a Client with default settings

func (*Client) Exchange

func (c *Client) Exchange(ifname string, modifiers ...dhcpv6.Modifier) ([]dhcpv6.DHCPv6, error)

Exchange executes a 4-way DHCPv6 request (Solicit, Advertise, Request, Reply). The modifiers will be applied to the Solicit and Request packets. A common use is to make sure that the Solicit packet has the right options, see modifiers.go

func (*Client) Request

func (c *Client) Request(ifname string, advertise *dhcpv6.Message, modifiers ...dhcpv6.Modifier) (dhcpv6.DHCPv6, dhcpv6.DHCPv6, error)

Request sends a Request built from an Advertise. It returns the Request, a Reply (if not nil), and an error if any. The modifiers will be applied to the Request before sending it, see modifiers.go

func (*Client) Solicit

func (c *Client) Solicit(ifname string, modifiers ...dhcpv6.Modifier) (dhcpv6.DHCPv6, dhcpv6.DHCPv6, error)

Solicit sends a Solicit, returns the Solicit, an Advertise (if not nil), and an error if any. The modifiers will be applied to the Solicit before sending it, see modifiers.go

Source Files

client.go

Version
v0.0.0-20250109001534-8abf58130905 (latest)
Published
Jan 9, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
2 months ago

Tools for package owners.