dhcp

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 6 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
}

Manager runs per-lab DHCP servers keyed by an arbitrary name (lab name).

func NewManager

func NewManager() *Manager

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.

Jump to

Keyboard shortcuts

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