server

package
v0.0.0-...-996c443 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxDatagram = 1 << 16
)
View Source
const (
	MetadataServiceIP string = "169.254.169.254/32"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Lease

type Lease struct {
	Timestamp  *time.Time
	Expiration *time.Time
	Hostname   string
	IPNet      *net.IPNet
	Mtu        *int32
}

type LogHandler

type LogHandler struct {
	slog.Handler
}

func (LogHandler) Handle

func (h LogHandler) Handle(ctx context.Context, r slog.Record) error

type Prefix

type Prefix struct {
	Prefix        string
	Domain        string
	Routers       []net.IP
	StaticRoutes  []*dhcpv4.Route
	LeaseDuration time.Duration
	NameServers   []net.IP
	NTPServers    []net.IP

	IPRanges        []int32
	MetadataService bool
	// contains filtered or unexported fields
}

func (*Prefix) DeclineLease

func (p *Prefix) DeclineLease(ctx context.Context, mac string) bool

func (*Prefix) DelLease

func (p *Prefix) DelLease(ctx context.Context, mac string) bool

func (*Prefix) GetLease

func (p *Prefix) GetLease(ctx context.Context, mac string) *Lease

func (*Prefix) LoadLeases

func (p *Prefix) LoadLeases(ctx context.Context) error

func (*Prefix) NewLeaseFromAssignedIP

func (p *Prefix) NewLeaseFromAssignedIP(ctx context.Context, mac string) *Lease

func (*Prefix) NewLeaseFromDevice

func (p *Prefix) NewLeaseFromDevice(ctx context.Context, mac string) *Lease

func (*Prefix) NewLeaseFromIPRanges

func (p *Prefix) NewLeaseFromIPRanges(ctx context.Context, mac string) *Lease

func (*Prefix) WriteLeases

func (p *Prefix) WriteLeases(ctx context.Context) error

type Server

type Server struct {
	DryRun     bool
	LeasesPath string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(port int) *Server

func (*Server) ListInterfaces

func (s *Server) ListInterfaces(ctx context.Context)

func (*Server) LoadLeases

func (s *Server) LoadLeases(ctx context.Context)

func (*Server) Serve

func (s *Server) Serve(ctx context.Context)

func (*Server) UpdatePrefixes

func (s *Server) UpdatePrefixes(ctx context.Context)

func (*Server) WriteLeases

func (s *Server) WriteLeases(ctx context.Context)

Jump to

Keyboard shortcuts

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