plugin

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package plugin implements a coredhcp plugin that retrieves IP lease information from the hollow ecosystem and uses it in the DHCP reply. The data will be pulled from both serverservice and instanceservice attributes.

Example config:

server6:

listen: '[::]547'
- example:
- server_id: LL aa:bb:cc:dd:ee:ff
- hollow: https://hollow.sh

This will send requests to https://hollow.sh/api/<path>. OIDC environment is read from the environment. The follow environment variables are expected:

HOLLOWDHCP_OIDC_ISSUER
HOLLOWDHCP_OIDC_CLIENT_ID
HOLLOWDHCP_OIDC_CLIENT_SECRET
HOLLOWDHCP_OIDC_AUDIENCE

Index

Constants

View Source
const DHCPAttributeNamespace string = "sh.hollow.dhcpserver.lease"

DHCPAttributeNamespace is the namespace that is searched to find lease information

Variables

View Source
var (
	// ErrNoLeaseFound is the error returned when a dhcp lease for the mac address can not be found
	ErrNoLeaseFound = errors.New("no dhcp lease found for MAC address")
	// ErrDuplicateLeaseFound is the error returned when multiple dhcp leases for the sane mac addresses are found
	ErrDuplicateLeaseFound = errors.New("multiple dhcp leases found for MAC address")
)
View Source
var Plugin = plugins.Plugin{
	Name:   "hollow",
	Setup6: setup6,
	Setup4: setup4,
}

Plugin wraps plugin registration information

Functions

This section is empty.

Types

type ErrInvalidArgCount

type ErrInvalidArgCount struct {
	Expected int
	Provided int
}

ErrInvalidArgCount is the error returned when the number of arguments provided don't match the expected length

func (*ErrInvalidArgCount) Error

func (e *ErrInvalidArgCount) Error() string

Error returns the ErrInvalidArgCount in string format

type ErrMissingEnvVariable

type ErrMissingEnvVariable struct {
	EnvVar string
}

ErrMissingEnvVariable is returned when an environment variable isn't provided

func (*ErrMissingEnvVariable) Error

func (e *ErrMissingEnvVariable) Error() string

Error returns the ErrMissingEnvVariable in string format

type LeaseData

type LeaseData struct {
	V4Leases []V4Lease `json:"ipv4,omitempty"`
	V6Leases []V6Lease `json:"ipv6,omitempty"`
}

LeaseData represents the structure of the attribute data of lease information. It can hold multiple V4 and V6 leases.

type V4Lease

type V4Lease struct {
	MacAddress string   `json:"mac_address"`
	CIDR       string   `json:"cidr"`
	Gateway    net.IP   `json:"gateway"`
	Resolvers  []net.IP `json:"resolvers,omitempty"`
	BootServer string   `json:"boot_server,omitempty"`
	BootFile   string   `json:"boot_file,omitempty"`
}

V4Lease represents an IPv4 DHCP lease

type V6Lease

type V6Lease struct {
	MacAddress string   `json:"mac_address"`
	CIDR       string   `json:"cidr"`
	Gateway    net.IP   `json:"gateway"`
	Resolvers  []string `json:"resolvers,omitempty"`
	BootServer string   `json:"boot_server,omitempty"`
	BootFile   string   `json:"boot_file,omitempty"`
}

V6Lease represents an IPv6 DHCP lease

Jump to

Keyboard shortcuts

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