server

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package dhcp providers UDP listening and serving functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DHCP

type DHCP struct {
	Conn     net.PacketConn
	Handlers []Handler
	Logger   logr.Logger
}

DHCP represents a DHCPv4 server object.

func NewServer

func NewServer(ifname string, addr *net.UDPAddr, handler ...Handler) (*DHCP, error)

NewServer initializes and returns a new Server object.

func (*DHCP) Close

func (s *DHCP) Close() error

Close sends a termination request to the server, and closes the UDP listener.

func (*DHCP) Serve

func (s *DHCP) Serve(ctx context.Context) error

Serve serves requests.

type Handler

type Handler interface {
	Handle(ctx context.Context, conn *ipv4.PacketConn, d data.Packet)
}

Handler is a type that defines the handler function to be called every time a valid DHCPv4 message is received type Handler func(ctx context.Context, conn net.PacketConn, d data.Packet).

Jump to

Keyboard shortcuts

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