server4

package
v0.0.0-...-81b9770 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIPv4UDPConn

func NewIPv4UDPConn(iface string, addr *net.UDPAddr) (*net.UDPConn, error)

NewIPv4UDPConn returns a UDP connection bound to both the interface and port given based on a IPv4 DGRAM socket. The UDP connection allows broadcasting.

The interface must already be configured.

Types

type Handler

type Handler func(conn net.PacketConn, peer net.Addr, m *dhcpv4.DHCPv4)

Handler is a type that defines the handler function to be called every time a valid DHCPv4 message is received

type Server

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

Server represents a DHCPv4 server object

func NewServer

func NewServer(ifname string, addr *net.UDPAddr, handler Handler, opt ...ServerOpt) (*Server, error)

NewServer initializes and returns a new Server object

func (*Server) Close

func (s *Server) Close() error

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

func (*Server) Serve

func (s *Server) Serve() error

Serve serves requests.

type ServerOpt

type ServerOpt func(s *Server)

ServerOpt adds optional configuration to a server.

func WithConn

func WithConn(c net.PacketConn) ServerOpt

WithConn configures the server with the given connection.

Jump to

Keyboard shortcuts

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