dhcp

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateRanges

func ValidateRanges(ranges []Range) error

Types

type Config

type Config struct {
	Iface   string
	Subnet  string
	Gateway string
	DNS     string
	BindIP  string
	Ranges  []Range
}

Config describes a DHCP server for one network interface. Subnet and Gateway are derived from the lab's allocated CIDR by the caller. DNS is optional — omit to suppress the DNS option in responses. BindIP is used as the DHCP Server Identifier (option 54) in replies; the socket itself always binds 0.0.0.0:67 — binding the unicast address would stop broadcast DISCOVERs (dst 255.255.255.255) from ever reaching the server. Per-lab isolation on a shared pod comes from SO_BINDTODEVICE (server4 sets it from Iface) plus SO_REUSEADDR.

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Changes added in v1.1.0

func (m *Manager) Changes() <-chan StateChange

func (*Manager) Close added in v1.1.0

func (m *Manager) Close()

func (*Manager) Drop added in v1.1.0

func (m *Manager) Drop(name string)

func (*Manager) Healthy added in v1.1.0

func (m *Manager) Healthy(name string) bool

func (*Manager) Start

func (m *Manager) Start(name string, cfg Config) error

func (*Manager) Stop

func (m *Manager) Stop(name string)

type Range

type Range struct {
	Start int32
	End   int32
}

Range is an inclusive host-offset interval in a lab /24.

type StateChange added in v1.1.0

type StateChange struct {
	Name    string
	Running bool
	Err     error
}

Jump to

Keyboard shortcuts

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