dhclient

package
Version: v0.0.0-...-c97c800 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package dhclient provides a unified interface for interfacing with both DHCPv4 and DHCPv6 clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure4

func Configure4(iface netlink.Link, packet *dhcp4.Packet) error

Configure4 adds IP addresses, routes, and DNS servers to the system.

func Configure6

func Configure6(iface netlink.Link, packet *dhcp6.Packet, iana *dhcp6opts.IANA) error

Configure6 adds IPv6 addresses, routes, and DNS servers to the system.

func IfUp

func IfUp(ifname string) (netlink.Link, error)

IfUp ensures the given network interface is up and returns the link object.

func WriteDNSSettings

func WriteDNSSettings(ips []net.IP) error

WriteDNSSettings writes the given IPs as nameservers to resolv.conf.

Types

type Packet4

type Packet4 struct {
	P *dhcp4.Packet
}

Packet4 implements convenience functions for DHCPv4 packets.

func NewPacket4

func NewPacket4(p *dhcp4.Packet) *Packet4

NewPacket4 wraps a DHCPv4 packet with some convenience methods.

func (*Packet4) Boot

func (p *Packet4) Boot() (url.URL, error)

Boot returns the boot file assigned.

func (*Packet4) DNS

func (p *Packet4) DNS() []net.IP

DNS returns DNS IPs assigned.

func (*Packet4) Gateway

func (p *Packet4) Gateway() net.IP

Gateway returns the gateway IP assigned.

OptionRouter is used as opposed to GIAddr, which seems unused by most DHCP servers?

func (*Packet4) Lease

func (p *Packet4) Lease() *net.IPNet

Lease returns the IPNet assigned.

type Packet6

type Packet6 struct {
	// contains filtered or unexported fields
}

Packet6 implements Packet for IPv6 DHCP.

func NewPacket6

func NewPacket6(p *dhcp6.Packet, ianaLease *dhcp6opts.IANA) *Packet6

NewPacket6 wraps a DHCPv6 packet with some convenience methods.

func (*Packet6) Boot

func (p *Packet6) Boot() (url.URL, string, error)

Boot returns the boot file URL and parameters assigned.

TODO: RFC 5970 is helpfully avoidant of where these options are used. Are they added to the packet? Are they added to an IANA? It *seems* like it's in the packet.

func (*Packet6) DNS

func (p *Packet6) DNS() []net.IP

DNS returns DNS servers assigned.

func (*Packet6) Lease

func (p *Packet6) Lease() *dhcp6opts.IAAddr

Lease returns lease information assigned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL