dhcp

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIP = errors.New("invalid IP address")

Functions

func GetIPs

func GetIPs(iface net.Interface) ([]net.IP, error)

func GetInterfaces

func GetInterfaces() ([]net.Interface, error)

GetInterfaces retrieves all valid interfaces to use for UDP DHCP messaging.

func HwAddrFromBytes

func HwAddrFromBytes(b []byte) []byte

func IPv4

func IPv4(b []byte) net.IP

Types

type DeviceData

type DeviceData struct {
	HWAddr net.HardwareAddr
	IP     net.IP
}

DeviceData is a struct that holds the hardware address and IP address of a device

type RequestData

type RequestData struct {
	ServerData DeviceData
	ClientData DeviceData
	XID        uint32
}

RequestData is a struct that holds the data from the server and client This data is used for DHCP requests and responses

func RequestDataFromPkt

func RequestDataFromPkt(pkt *pkt.Pkt) RequestData

type Server

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

func NewServer

func NewServer(ipAddr string) (*Server, error)

func (*Server) Ack

func (s *Server) Ack(hwAddr net.HardwareAddr, ip net.IP, xid uint32) error

func (*Server) Close

func (l *Server) Close() error

func (*Server) Listen

func (s *Server) Listen() error

func (*Server) Offer

func (l *Server) Offer(hwAddr net.HardwareAddr, ip net.IP, xid uint32) error

func (*Server) OfferRequest

func (s *Server) OfferRequest(hwAddr net.HardwareAddr, ip net.IP, xid uint32) error

func (*Server) Read

func (l *Server) Read() (*pkt.Pkt, error)

func (*Server) ServeAddress

func (s *Server) ServeAddress() string

func (*Server) SniffMac

func (s *Server) SniffMac() (net.HardwareAddr, uint32, error)

func (*Server) WaitRequest

func (s *Server) WaitRequest(hwAddr net.HardwareAddr, ip net.IP, xid uint32) error

func (*Server) Write

func (l *Server) Write(pkt *pkt.Pkt) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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