dhcp

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package dhcp contains definitions for scope groups, scopes, etc.

Index

Constants

View Source
const (
	ItemTypeBinary      = "binary"
	ItemTypeBoolean     = "boolean"
	ItemTypeEmpty       = "empty"
	ItemTypeFQDN        = "fqdn"
	ItemTypeInt16       = "int16"
	ItemTypeInt32       = "int32"
	ItemTypeInt8        = "int8"
	ItemTypeIPv4Address = "ipv4_address"
	ItemTypeIPv6Address = "ipv6_address"
	ItemTypeIPv6Prefix  = "ipv6_prefix"
	ItemTypePSID        = "psid"
	ItemTypeString      = "string"
	ItemTypeTuple       = "tuple"
	ItemTypeUint16      = "uint16"
	ItemTypeUint32      = "uint32"
	ItemTypeUint8       = "uint8"
)

List of available types

View Source
const (
	SchemaTypeArray       SchemaType = "array"
	SchemaTypeBinary                 = "binary"
	SchemaTypeBoolean                = "boolean"
	SchemaTypeEmpty                  = "empty"
	SchemaTypeFQDN                   = "fqdn"
	SchemaTypeInt16                  = "int16"
	SchemaTypeInt32                  = "int32"
	SchemaTypeInt8                   = "int8"
	SchemaTypeIPv4Address            = "ipv4_address"
	SchemaTypeIPv6Address            = "ipv6_address"
	SchemaTypeIPv6Prefix             = "ipv6_prefix"
	SchemaTypePSID                   = "psid"
	SchemaTypeRecord                 = "record"
	SchemaTypeString                 = "string"
	SchemaTypeTuple                  = "tuple"
	SchemaTypeUint16                 = "uint16"
	SchemaTypeUint32                 = "uint32"
	SchemaTypeUint8                  = "uint8"
)

List of available types

View Source
const (
	// PingCheckProbationPeriodDefault is a default value in minutes for the probation_period in the ping check config
	PingCheckProbationPeriodDefault = 60

	// PingCheckNumPingsDefault is a default value for the num_pings in the ping check config
	PingCheckNumPingsDefault = 1

	// PingCheckWaitTimeDefault is a default value in milliseconds for the wait_time in the ping check config
	PingCheckWaitTimeDefault = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressDetails

type AddressDetails struct {
	Name   string `json:"name,omitempty"`
	Prefix string `json:"prefix,omitempty"`
}

AddressDetails scope address details

type Identifier

type Identifier struct {
	Type  IdentifierType `json:"type,omitempty"`
	Value string         `json:"value,omitempty"`
}

Identifier is a reservation identifier

type IdentifierType

type IdentifierType string

IdentifierType is a type of the reservation identifier

const (
	HWAddressType IdentifierType = "hw-address"
	CircuitIDType IdentifierType = "circuit-id"
	DUIDType      IdentifierType = "duid"
	ClientIDType  IdentifierType = "client-id"
)

List of available Identifier types

type ItemType

type ItemType string

ItemType defines the type of the item as a string

type Option

type Option struct {
	Name        string      `json:"name"`
	Value       interface{} `json:"value"`
	AlwaysSend  *bool       `json:"always_send,omitempty"`
	Encapsulate *string     `json:"encapsulate,omitempty"`
}

Option encapsulates DHCPv4 and DHCPv6 option information.

Serialized:

'{"name": "dhcpv4/routers", "value": ["127.0.0.1"]}'
'{"name": "dhcpv4/boot-file-name", "value": "/bootfilename"}'
'{"name": "dhcpv6/dns-servers", "value": ["2001:db8::cafe"]}'

type OptionDef

type OptionDef struct {
	Space        *string         `json:"space,omitempty"`
	FriendlyName string          `json:"friendly_name"`
	Description  string          `json:"description"`
	Code         int             `json:"code"`
	Encapsulate  *string         `json:"encapsulate,omitempty"`
	Schema       OptionDefSchema `json:"schema"`
}

OptionDef configures a custom option definition https://ftp.isc.org/isc/kea/1.4.0/doc/kea-guide.html#dhcp4-custom-options

type OptionDefSchema

type OptionDefSchema struct {
	Fields             []OptionDefSchemaItems `json:"fields"`
	Items              *string                `json:"items,omitempty"`
	MultipleFinalValue *bool                  `json:"multiple_final_value,omitempty"`
	Type               SchemaType             `json:"type"`
}

OptionDefSchema is a schema of the option def which describes the value that option can hold

type OptionDefSchemaItems

type OptionDefSchemaItems struct {
	Name string   `json:"name"`
	Type ItemType `json:"type"`
}

OptionDefSchemaItems is generated from https://apispec.ns1.com/v1/dhcp/schemas/option-definition-fields.json#/properties/schema/properties/fields/items

type OptionSet

type OptionSet []Option

OptionSet is a convenience type for marshalling an array of options to and from a JSON field.

type PingCheckConf

type PingCheckConf struct {
	Enabled         bool   `json:"enabled,omitempty"`
	NumPings        *int   `json:"num_pings,omitempty"`
	ProbationPeriod *int   `json:"probation_period,omitempty"`
	Type            string `json:"type,omitempty"`
	WaitTime        *int   `json:"wait_time,omitempty"`
}

PingCheckConf represents config for a ping check in a scope group

type Reservation

type Reservation struct {
	ID             *int            `json:"id,omitempty"`
	IDAddress      *int            `json:"address_id,omitempty"`
	IDScopeGroup   *int            `json:"scope_group_id,omitempty"`
	Mac            string          `json:"mac,omitempty"`
	AddressDetails *AddressDetails `json:"address_details,omitempty"`
	Identifier     *Identifier     `json:"identifier,omitempty"`
	Options        OptionSet       `json:"options"`
	DHCPv6         *bool           `json:"dhcpv6,omitempty"`
	ClientClasses  []string        `json:"client_classes,omitempty"`
	NextServer     string          `json:"next_server,omitempty"`
	BootFileName   string          `json:"boot_file_name,omitempty"`
	ServerHostname string          `json:"server_hostname,omitempty"`

	Tags        map[string]string `json:"tags,omitempty"`
	LocalTags   []string          `json:"local_tags,omitempty"`
	BlockedTags []string          `json:"blocked_tags,omitempty"`
}

Reservation contains reservation related data

type SchemaType

type SchemaType string

SchemaType defines the type of the schema as a string

type Scope

type Scope struct {
	ID                   int             `json:"id,omitempty"`
	IDAddress            *int            `json:"address_id,omitempty"`
	IDScopeGroup         *int            `json:"scope_group_id,omitempty"`
	Options              OptionSet       `json:"options,omitempty"`
	AddressDetails       *AddressDetails `json:"address_details,omitempty"`
	ValidLifetimeSecs    *int            `json:"valid_lifetime_secs,omitempty"`
	ClientClass          *string         `json:"client_class,omitempty"`
	RequireClientClasses *[]string       `json:"require_client_classes,omitempty"`
	MatchClientID        []byte          `json:"match_client_id,omitempty"`
	Relays               []string        `json:"relays,omitempty"`
	PingCheckEnabled     *bool           `json:"ping_check_enabled,omitempty"`
	NextServer           *string         `json:"next_server,omitempty"`
	BootFileName         *string         `json:"boot_file_name,omitempty"`
	ServerHostname       *string         `json:"server_hostname,omitempty"`
	Stateless            *bool           `json:"stateless,omitempty"`

	Tags        map[string]string `json:"tags,omitempty"`
	BlockedTags []string          `json:"blocked_tags,omitempty"`
	LocalTags   []string          `json:"local_tags,omitempty"`
}

Scope contains scope related data

type ScopeGroup

type ScopeGroup struct {
	ID             *int           `json:"id,omitempty"`
	Name           string         `json:"name,omitempty"`
	IDDHCPService  *int           `json:"dhcp_service_id,omitempty"`
	DHCP4          SettingsV4     `json:"dhcpv4,omitempty"`
	DHCP6          SettingsV6     `json:"dhcpv6,omitempty"`
	NetworkID      *int           `json:"network_id,omitempty"`
	ReverseDNS     *bool          `json:"reverse_dns,omitempty"`
	ClientClassIds []int          `json:"client_class_ids,omitempty"`
	PingCheck      *PingCheckConf `json:"ping_check,omitempty"`

	Tags        map[string]string `json:"tags,omitempty"`
	LocalTags   []string          `json:"local_tags"`
	BlockedTags []string          `json:"blocked_tags"`

	// TemplateConfig is read-only field
	TemplateConfig []string `json:"template_config,omitempty"`
	Template       *string  `json:"template,omitempty"`
}

ScopeGroup wraps an NS1 /dhcp/scopegroup resource.

type Settings

type Settings struct {
	// Enabled indicates whether v4 or v6 is enabled
	Enabled *bool `json:"enabled,omitempty"`

	// ValidLifetimeSecs how long leases given out by the server are valid
	ValidLifetimeSecs *int `json:"valid_lifetime_secs,omitempty"`

	// RenewTimerSecs length of DHCP T1 timer
	RenewTimerSecs *int `json:"renew_timer_secs,omitempty"`

	// RebindTimerSecs length of DHCP T2 timer
	RebindTimerSecs *int `json:"rebind_timer_secs,omitempty"`

	// EchoClientID https://tools.ietf.org/html/rfc6842
	EchoClientID *bool `json:"echo_client_id,omitempty"`

	// Options base dhcp options -- will be combined with later levels; should effectively be unique by option name
	Options OptionSet `json:"options"`

	SynthesizeDNSRecords *SynthesizeDNSRecords `json:"nsone-ddns,omitempty"`

	QualifyingSuffix *string `json:"qualifying_suffix,omitempty"`
	GeneratedPrefix  *string `json:"generated_prefix,omitempty"`

	// DeclineProbationPeriod how long lease will stay unavailable for assignment after DHCPDECLINE
	DeclineProbationPeriod *int `json:"decline_probation_period,omitempty"`

	// ReclaimTimerWaitTime interval between reclamation cycles in seconds
	ReclaimTimerWaitTime *int `json:"reclaim_timer_wait_time,omitempty"`

	// FlushReclaimedTimerWaitTime how often the server initiates lease reclamation in seconds
	FlushReclaimedTimerWaitTime *int `json:"flush_reclaimed_timer_wait_time,omitempty"`

	// HoldReclaimedTime how long the lease should be kept after it is reclaimed in seconds
	HoldReclaimedTime *int `json:"hold_reclaimed_time,omitempty"`

	// MaxReclaimLeases maximum number of leases to process at once (zero is unlimited)
	MaxReclaimLeases *int `json:"max_reclaim_leases,omitempty"`

	// MaxReclaimTime upper limit to the length of time a lease reclamation procedure can take
	// (in milliseconds)
	MaxReclaimTime *int `json:"max_reclaim_time,omitempty"`

	// UnwarnedReclaimCycles how many consecutive cycles must end with remaining leases before a warning
	// is printed
	UnwarnedReclaimCycles *int `json:"unwarned_reclaim_cycles,omitempty"`
}

Settings encapsulates common values between SettingsV4 and SettingsV6

type SettingsV4

type SettingsV4 struct {
	Settings

	MatchClientID *bool   `json:"match_client_id"`
	NextServer    *string `json:"next_server"`
	BootFileName  *string `json:"boot_file_name"`
}

SettingsV4 defines those DHCPv4 settings which we expose to the user

type SettingsV6

type SettingsV6 struct {
	Settings

	// https://tools.ietf.org/html/rfc3315
	PreferredLifetimeSecs *int `json:"preferred_lifetime_secs,omitempty"`
}

SettingsV6 defines those DHCPv6 settings which we expose to the user

type SynthesizeDNSRecords

type SynthesizeDNSRecords struct {
	Enabled bool `json:"enabled,omitempty"`
}

SynthesizeDNSRecords ddns configuration

Jump to

Keyboard shortcuts

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