Documentation ¶
Index ¶
- Variables
- func Ack(msg *dhcpv4.DHCPv4) bool
- func Decline(msg *dhcpv4.DHCPv4) bool
- func Discover(msg *dhcpv4.DHCPv4) bool
- func GetPeer(ctx context.Context) net.Addr
- func Inform(msg *dhcpv4.DHCPv4) bool
- func Nak(msg *dhcpv4.DHCPv4) bool
- func Offer(msg *dhcpv4.DHCPv4) bool
- func Release(msg *dhcpv4.DHCPv4) bool
- func Request(msg *dhcpv4.DHCPv4) bool
- func WithPeer(ctx context.Context, peer net.Addr) context.Context
- type Config
- type PeerKey
- type Server
Constants ¶
This section is empty.
Variables ¶
var Directives = []string{
"log",
"database",
"interface",
"gotify",
"mqtt",
"option",
"servername",
"next-server",
"lease",
"static",
"range",
}
Directives that we register at caddy
var ( // ErrNoResponse is returned by plugins if no response should be sent to the client // This may be used for DHCPRELEASE messages or by middleware handlers that filtered // the request. It's not an actual error ErrNoResponse = errors.New("no response should be sent") )
Functions ¶
Types ¶
type Config ¶
type Config struct { // IP is the IP address of the interface we are listening on. This is required // to select the right subnet configuration when listening and serving multiple // subnets IP net.IP // Network is the network of the subnet Network net.IPNet // Interface is the network interface where the subnet should be served. This // is required to select the right subnet configuration when listening and serving // multiple subnets Interface net.Interface // Database is the lease database that is queried for new leases and reservations Database lease.Database // Options holds a map of DHCP options that should be set Options map[dhcpv4.OptionCode]dhcpv4.OptionValue // LeaseTime is the default lease time to use for new IP address leases LeaseTime time.Duration // contains filtered or unexported fields }
Config configures a DHCP server subnet
func GetConfig ¶
func GetConfig(c *caddy.Controller) *Config
GetConfig gets the Config that corresponds to c if none exist nil is returned
type PeerKey ¶
type PeerKey struct{}
PeerKey is the key used to associate a net.Addr with a context.Context
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an instance of a server which serves DHCP clients on a particular interface. Each Server may serve multiple IP subnets on the same interface picking the first defined one as the default. The other subnets may be either queried directly by requesting an IP address located there or by the use of DHCP relay agents
func (*Server) Listen ¶
Listen does nothing as TCP is not supported. It implements the caddy.TCPServer interface
func (*Server) ListenPacket ¶
func (s *Server) ListenPacket() (net.PacketConn, error)
ListenPacket starts listening for DHCP request messages via UDP/Raw sockets This implements the caddy.UDPServer interface
func (*Server) OnStartupComplete ¶
func (s *Server) OnStartupComplete()
OnStartupComplete is called when all serves of the same instance have been started. It implements the caddy.AfterStarup interface
func (*Server) Serve ¶
Serve is a NO-OP as TCP is not supported by dhcpserver. It implements the caddy.TCPServer interface
func (*Server) ServePacket ¶
func (s *Server) ServePacket(c net.PacketConn) error
ServePacket starts the server with an existing PacketConn. It blocks until the server stops. This implements the caddy.UDPServer interface