dhcp

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: GPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDatagram = 1 << 16

MaxDatagram is the maximum length of message that can be received.

Variables

This section is empty.

Functions

This section is empty.

Types

type APILease

type APILease struct {
	Identifier       string `json:"identifier" required:"true"`
	Address          string `json:"address" required:"true"`
	Hostname         string `json:"hostname" required:"true"`
	AddressLeaseTime string `json:"addressLeaseTime" required:"true"`
	ScopeKey         string `json:"scopeKey" required:"true"`
	DNSZone          string `json:"dnsZone"`

	Info *APILeaseInfo `json:"info"`
}

type APILeaseInfo added in v0.3.13

type APILeaseInfo struct {
	Vendor string `json:"vendor"`
}

type APILeasesDeleteInput

type APILeasesDeleteInput struct {
	Identifier string `query:"identifier"`
	Scope      string `query:"scope"`
}

type APILeasesGetInput

type APILeasesGetInput struct {
	ScopeName string `query:"scope"`
}

type APILeasesGetOutput

type APILeasesGetOutput struct {
	Leases []*APILease `json:"leases" required:"true"`
}

type APILeasesPutInput

type APILeasesPutInput struct {
	Identifier string `query:"identifier" required:"true" maxLength:"255"`
	Scope      string `query:"scope" required:"true" maxLength:"255"`

	Address          string `json:"address" required:"true" maxLength:"40"`
	Hostname         string `json:"hostname" required:"true" maxLength:"255"`
	AddressLeaseTime string `json:"addressLeaseTime" required:"true" maxLength:"40"`
	DNSZone          string `json:"dnsZone" maxLength:"255"`
}

type APILeasesWOLInput

type APILeasesWOLInput struct {
	Identifier string `query:"identifier" required:"true"`
	Scope      string `query:"scope" required:"true"`
}

type APIRoleConfigInput

type APIRoleConfigInput struct {
	Config RoleConfig `json:"config" required:"true"`
}

type APIRoleConfigOutput

type APIRoleConfigOutput struct {
	Config RoleConfig `json:"config" required:"true"`
}

type APIScope

type APIScope struct {
	Name       string              `json:"scope" required:"true"`
	SubnetCIDR string              `json:"subnetCidr" required:"true"`
	Default    bool                `json:"default" required:"true"`
	Options    []*types.DHCPOption `json:"options" required:"true"`
	TTL        int64               `json:"ttl" required:"true"`
	IPAM       map[string]string   `json:"ipam" required:"true"`
	DNS        *ScopeDNS           `json:"dns"`
}

type APIScopesDeleteInput

type APIScopesDeleteInput struct {
	Scope string `query:"scope" required:"true"`
}

type APIScopesGetOutput

type APIScopesGetOutput struct {
	Scopes []*APIScope `json:"scopes" required:"true"`
}

type APIScopesPutInput

type APIScopesPutInput struct {
	Name string `query:"scope" required:"true" maxLength:"255"`

	SubnetCIDR string              `json:"subnetCidr" required:"true" maxLength:"40"`
	Default    bool                `json:"default" required:"true"`
	Options    []*types.DHCPOption `json:"options" required:"true"`
	TTL        int64               `json:"ttl" required:"true"`
	IPAM       map[string]string   `json:"ipam"`
	DNS        *ScopeDNS           `json:"dns"`
}

type Handler4

type Handler4 func(req *Request4) *dhcpv4.DHCPv4

type IPAM

type IPAM interface {
	NextFreeAddress() *netip.Addr
	IsIPFree(netip.Addr) bool
	GetSubnetMask() net.IPMask
}

type InternalIPAM

type InternalIPAM struct {
	SubnetCIDR netip.Prefix
	Start      netip.Addr
	End        netip.Addr
	// contains filtered or unexported fields
}

func NewInternalIPAM

func NewInternalIPAM(role *Role, s *Scope) (*InternalIPAM, error)

func (*InternalIPAM) GetSubnetMask

func (i *InternalIPAM) GetSubnetMask() net.IPMask

func (*InternalIPAM) IsIPFree

func (i *InternalIPAM) IsIPFree(ip netip.Addr) bool

func (*InternalIPAM) NextFreeAddress

func (i *InternalIPAM) NextFreeAddress() *netip.Addr

type Lease

type Lease struct {
	Identifier string `json:"-"`

	Address          string `json:"address"`
	Hostname         string `json:"hostname"`
	AddressLeaseTime string `json:"addressLeaseTime,omitempty"`
	ScopeKey         string `json:"scopeKey"`
	DNSZone          string `json:"dnsZone,omitempty"`
	// contains filtered or unexported fields
}

func (*Lease) Put

func (l *Lease) Put(ctx context.Context, expiry int64, opts ...clientv3.OpOption) error

type Request4

type Request4 struct {
	*dhcpv4.DHCPv4

	Context context.Context
	// contains filtered or unexported fields
}

type Role

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

func New

func New(instance roles.Instance) *Role

func (*Role) APILeasesDelete

func (r *Role) APILeasesDelete() usecase.Interactor

func (*Role) APILeasesGet

func (r *Role) APILeasesGet() usecase.Interactor

func (*Role) APILeasesPut

func (r *Role) APILeasesPut() usecase.Interactor

func (*Role) APILeasesWOL

func (r *Role) APILeasesWOL() usecase.Interactor

func (*Role) APIRoleConfigGet

func (r *Role) APIRoleConfigGet() usecase.Interactor

func (*Role) APIRoleConfigPut

func (r *Role) APIRoleConfigPut() usecase.Interactor

func (*Role) APIScopesDelete

func (r *Role) APIScopesDelete() usecase.Interactor

func (*Role) APIScopesGet

func (r *Role) APIScopesGet() usecase.Interactor

func (*Role) APIScopesPut

func (r *Role) APIScopesPut() usecase.Interactor

func (*Role) DeviceIdentifier

func (r *Role) DeviceIdentifier(m *dhcpv4.DHCPv4) string

func (*Role) FindLease

func (r *Role) FindLease(req *Request4) *Lease

func (*Role) HandleDHCPDecline4

func (r *Role) HandleDHCPDecline4(req *Request4) *dhcpv4.DHCPv4

func (*Role) HandleDHCPDiscover4

func (r *Role) HandleDHCPDiscover4(req *Request4) *dhcpv4.DHCPv4

func (*Role) HandleDHCPRequest4

func (r *Role) HandleDHCPRequest4(req *Request4) *dhcpv4.DHCPv4

func (*Role) Handler4

func (r *Role) Handler4(re *Request4) *dhcpv4.DHCPv4

func (*Role) NewLease

func (r *Role) NewLease(identifier string) *Lease

func (*Role) NewRequest4

func (r *Role) NewRequest4(dhcp *dhcpv4.DHCPv4) *Request4

func (*Role) NewScope

func (r *Role) NewScope(name string) *Scope

func (*Role) Start

func (r *Role) Start(ctx context.Context, config []byte) error

func (*Role) Stop

func (r *Role) Stop()

type RoleConfig

type RoleConfig struct {
	Port                  int `json:"port"`
	LeaseNegotiateTimeout int `json:"leaseNegotiateTimeout"`
}

type Scope

type Scope struct {
	Name string `json:"-"`

	SubnetCIDR string              `json:"subnetCidr"`
	Default    bool                `json:"default"`
	Options    []*types.DHCPOption `json:"options"`
	TTL        int64               `json:"ttl"`
	IPAM       map[string]string   `json:"ipam"`
	DNS        *ScopeDNS           `json:"dns"`
	// contains filtered or unexported fields
}

func (*Scope) Put

func (s *Scope) Put(ctx context.Context, expiry int64, opts ...clientv3.OpOption) error

type ScopeDNS

type ScopeDNS struct {
	Zone              string   `json:"zone"`
	Search            []string `json:"search"`
	AddZoneInHostname bool     `json:"addZoneInHostname"`
}

Directories

Path Synopsis
Updated version of https://github.com/dutchcoders/go-ouitools Package go-oui provides functions to work with MAC and OUI's
Updated version of https://github.com/dutchcoders/go-ouitools Package go-oui provides functions to work with MAC and OUI's

Jump to

Keyboard shortcuts

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