server

package
v0.0.0-...-5902f04 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACKReply

type ACKReply struct {
	Lease   *Lease
	Options dhcp.Options
}

func (*ACKReply) MergeOptions

func (r *ACKReply) MergeOptions(options dhcp.Options) dhcp.Options

func (*ACKReply) Packet

func (r *ACKReply) Packet(p dhcp.Packet, reqType dhcp.MessageType, h *Handler, req []byte) dhcp.Packet

type CIDRDecoder

type CIDRDecoder []byte

func (*CIDRDecoder) Decode

func (cidr *CIDRDecoder) Decode(s string) error

type Config

type Config struct {
	Interface      *string
	Server_IP_Addr string `required:"true"`
	Options        OptionsDecoder
	Start_IP_Addr  string        `required:"true"`
	Lease_Range    int           `required:"true"`
	Lease_Duration time.Duration `default:"1h"`
}

func NewConfig

func NewConfig() (*Config, error)

func (*Config) Server

func (c *Config) Server(change func(*Lease) Reply) *Server

type DomainNameDecoder

type DomainNameDecoder []byte

func (*DomainNameDecoder) Decode

func (d *DomainNameDecoder) Decode(s string) error

type Handler

type Handler struct {
	ServerIPAddr net.IP
	Options      dhcp.Options
	Leases       Leases
	Change       func(*Lease) Reply
}

func (*Handler) ServeDHCP

func (h *Handler) ServeDHCP(p dhcp.Packet, msgType dhcp.MessageType, options dhcp.Options) (replyPacket dhcp.Packet)

type IPDecoder

type IPDecoder net.IP

func (*IPDecoder) Decode

func (ip *IPDecoder) Decode(s string) error

type Lease

type Lease struct {
	CHAddr net.HardwareAddr
	IPAddr net.IP
	Expiry time.Time
}

type Leases

type Leases struct {
	StartIPAddr net.IP
	Range       int
	Duration    time.Duration
	Table       []*Lease
}

func (*Leases) Delete

func (l *Leases) Delete(addr net.HardwareAddr)

func (*Leases) Get

func (l *Leases) Get(addr net.HardwareAddr) *Lease

func (*Leases) Initialize

func (l *Leases) Initialize()

type NAKReply

type NAKReply struct {
}

func (*NAKReply) MergeOptions

func (r *NAKReply) MergeOptions(_ dhcp.Options) dhcp.Options

func (*NAKReply) Packet

func (r *NAKReply) Packet(p dhcp.Packet, msgType dhcp.MessageType, h *Handler, _ []byte) dhcp.Packet

type OptionsDecoder

type OptionsDecoder dhcp.Options

func (*OptionsDecoder) Decode

func (o *OptionsDecoder) Decode(s string) error

type Reply

type Reply interface {
	Packet(dhcp.Packet, dhcp.MessageType, *Handler, []byte) dhcp.Packet
	MergeOptions(dhcp.Options) dhcp.Options
}

type Server

type Server struct {
	Handler   *Handler
	Interface *string
}

func New

func New(change func(*Lease) Reply) (*Server, error)

func (*Server) Listen

func (s *Server) Listen() error

Jump to

Keyboard shortcuts

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