Documentation
¶
Index ¶
- Constants
- Variables
- type APILease
- type APILeaseInfo
- type APILeasesDeleteInput
- type APILeasesGetInput
- type APILeasesGetOutput
- type APILeasesPutInput
- type APILeasesWOLInput
- type APIRoleConfigInput
- type APIRoleConfigOutput
- type APIScope
- type APIScopeStatistics
- type APIScopesDeleteInput
- type APIScopesGetInput
- type APIScopesGetOutput
- type APIScopesImportInput
- type APIScopesImportOutput
- type APIScopesImporterType
- type APIScopesPutInput
- type DHCPImporter
- type Handler4
- type IPAM
- type InternalIPAM
- func (i *InternalIPAM) FreeIP(ip netip.Addr)
- func (i *InternalIPAM) GetSubnetMask() net.IPMask
- func (i *InternalIPAM) IsIPFree(ip netip.Addr, identifier *string) bool
- func (i *InternalIPAM) NextFreeAddress(identifier string) *netip.Addr
- func (i *InternalIPAM) UpdateConfig(s *Scope) error
- func (i *InternalIPAM) UsableSize() *big.Int
- func (i *InternalIPAM) UseIP(ip netip.Addr, identifier string)
- type Lease
- type Request4
- type Role
- func (r *Role) APILeasesDelete() usecase.Interactor
- func (r *Role) APILeasesGet() usecase.Interactor
- func (r *Role) APILeasesPut() usecase.Interactor
- func (r *Role) APILeasesWOL() usecase.Interactor
- func (r *Role) APIRoleConfigGet() usecase.Interactor
- func (r *Role) APIRoleConfigPut() usecase.Interactor
- func (r *Role) APIScopesDelete() usecase.Interactor
- func (r *Role) APIScopesGet() usecase.Interactor
- func (r *Role) APIScopesImport() usecase.Interactor
- func (r *Role) APIScopesPut() usecase.Interactor
- func (r *Role) DeviceIdentifier(m *dhcpv4.DHCPv4) string
- func (r *Role) FindLease(req *Request4) *Lease
- func (r *Role) Handle4(re *Request4) *dhcpv4.DHCPv4deprecated
- func (r *Role) HandleDHCPDecline4(req *Request4) *dhcpv4.DHCPv4
- func (r *Role) HandleDHCPDiscover4(req *Request4) *dhcpv4.DHCPv4
- func (r *Role) HandleDHCPRelease4(req *Request4) *dhcpv4.DHCPv4
- func (r *Role) HandleDHCPRequest4(req *Request4) *dhcpv4.DHCPv4
- func (r *Role) Handler4() *handler4
- func (r *Role) NewLease(identifier string) *Lease
- func (r *Role) NewRequest4(dhcp *dhcpv4.DHCPv4) *Request4
- func (r *Role) NewScope(name string) *Scope
- func (r *Role) Start(ctx context.Context, config []byte) error
- func (r *Role) Stop()
- type RoleConfig
- type Scope
- type ScopeDNS
Constants ¶
View Source
const InternalIPAMType = "internal"
View Source
const MaxDatagram = 1 << 16
MaxDatagram is the maximum length of message that can be received.
Variables ¶
View Source
var ErrNilResponse = errors.New("no DHCP response")
Functions ¶
This section is empty.
Types ¶
type APILease ¶
type APILease struct {
Info *APILeaseInfo `json:"info"`
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"`
Expiry int64 `json:"expiry"`
Description string `json:"description" required:"true"`
}
type APILeaseInfo ¶ added in v0.3.13
type APILeaseInfo struct {
Vendor string `json:"vendor"`
}
type APILeasesDeleteInput ¶
type APILeasesGetInput ¶
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"`
Expiry int64 `json:"expiry"`
Description string `json:"description"`
}
type APILeasesWOLInput ¶
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 {
IPAM map[string]string `json:"ipam" required:"true"`
DNS *ScopeDNS `json:"dns"`
Name string `json:"scope" required:"true"`
SubnetCIDR string `json:"subnetCidr" required:"true"`
Options []*types.DHCPOption `json:"options" required:"true"`
TTL int64 `json:"ttl" required:"true"`
Default bool `json:"default" required:"true"`
Hook string `json:"hook" required:"true"`
Statistics APIScopeStatistics `json:"statistics" required:"true"`
}
type APIScopeStatistics ¶ added in v0.11.0
type APIScopesDeleteInput ¶
type APIScopesDeleteInput struct {
Scope string `query:"scope" required:"true"`
}
type APIScopesGetInput ¶ added in v0.4.6
type APIScopesGetInput struct {
Name string `query:"name" description:"Optionally get DHCP Scope by name"`
}
type APIScopesGetOutput ¶
type APIScopesGetOutput struct {
Scopes []*APIScope `json:"scopes" required:"true"`
Statistics APIScopeStatistics `json:"statistics" required:"true"`
}
type APIScopesImportInput ¶ added in v0.24.0
type APIScopesImportInput struct {
Type APIScopesImporterType `json:"type"`
Payload string `json:"payload"`
Scope string `query:"scope"`
}
type APIScopesImportOutput ¶ added in v0.24.0
type APIScopesImportOutput struct {
Successful bool `json:"successful"`
}
type APIScopesImporterType ¶ added in v0.24.0
type APIScopesImporterType string
func (APIScopesImporterType) Enum ¶ added in v0.24.0
func (APIScopesImporterType) Enum() []interface{}
type APIScopesPutInput ¶
type APIScopesPutInput struct {
IPAM map[string]string `json:"ipam"`
DNS *ScopeDNS `json:"dns"`
Name string `query:"scope" required:"true" maxLength:"255"`
SubnetCIDR string `json:"subnetCidr" required:"true" maxLength:"40"`
Options []*types.DHCPOption `json:"options" required:"true"`
TTL int64 `json:"ttl" required:"true"`
Default bool `json:"default" required:"true"`
Hook string `json:"hook" required:"true"`
}
type DHCPImporter ¶ added in v0.24.0
type IPAM ¶
type IPAM interface {
// Return the next free IP address, could be sequential or random
NextFreeAddress(identifier string) *netip.Addr
// Check if IP address is in usage (should also check if IP is in specified range and subnet)
// Can optionally also check if the IP address is pingable
// `identifier` might be given as well for a device that could request an address
// that it had already taken
IsIPFree(addr netip.Addr, identifier *string) bool
// Get the subnet mask of the scope
GetSubnetMask() net.IPMask
// Mark an IP as used
UseIP(addr netip.Addr, identifier string)
// Mark an IP as unused
FreeIP(ip netip.Addr)
// Update config when scope is updated
UpdateConfig(s *Scope) error
// Amount of usable IPs excluding any exclusions
UsableSize() *big.Int
}
type InternalIPAM ¶
type InternalIPAM struct {
Start netip.Addr
End netip.Addr
SubnetCIDR netip.Prefix
// contains filtered or unexported fields
}
func NewInternalIPAM ¶
func NewInternalIPAM(role *Role, s *Scope) (*InternalIPAM, error)
func (*InternalIPAM) FreeIP ¶ added in v0.28.0
func (i *InternalIPAM) FreeIP(ip netip.Addr)
func (*InternalIPAM) GetSubnetMask ¶
func (i *InternalIPAM) GetSubnetMask() net.IPMask
func (*InternalIPAM) IsIPFree ¶
func (i *InternalIPAM) IsIPFree(ip netip.Addr, identifier *string) bool
func (*InternalIPAM) NextFreeAddress ¶
func (i *InternalIPAM) NextFreeAddress(identifier string) *netip.Addr
Return the next free IP in the range defined by `.Start` and `.End`, inclusive. Any returned address is _not_ marked as used, as this is up to the caller of the function Might return `nil` if no more free IP Address is available
func (*InternalIPAM) UpdateConfig ¶ added in v0.9.0
func (i *InternalIPAM) UpdateConfig(s *Scope) error
func (*InternalIPAM) UsableSize ¶ added in v0.11.0
func (i *InternalIPAM) UsableSize() *big.Int
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"`
// Set to -1 for a reservation
Expiry int64 `json:"expiry"`
Description string `json:"description"`
// contains filtered or unexported fields
}
func (*Lease) IsReservation ¶ added in v0.6.18
type Request4 ¶
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
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) APIScopesImport ¶ added in v0.24.0
func (r *Role) APIScopesImport() usecase.Interactor
func (*Role) APIScopesPut ¶
func (r *Role) APIScopesPut() usecase.Interactor
func (*Role) HandleDHCPRelease4 ¶ added in v0.18.0
type RoleConfig ¶
type Scope ¶
type Scope struct {
DNS *ScopeDNS `json:"dns"`
IPAM map[string]string `json:"ipam"`
Name string `json:"-"`
SubnetCIDR string `json:"subnetCidr"`
Options []*types.DHCPOption `json:"options"`
TTL int64 `json:"ttl"`
Default bool `json:"default"`
Hook string `json:"hook"`
// contains filtered or unexported fields
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.