dhcp

package
v0.0.0-...-5c345c6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2016 License: MIT Imports: 15 Imported by: 0

README

dhcp

dhcp

Usage

type Addresses
type Addresses struct {
	MAC string `json:"mac"`
	IP  string `json:"ip"`
}

Addresses specifies the argument to all endpoints

type Config
type Config struct {
	*provider.Config
}

Config holds all configuration for the provider.

func NewConfig
func NewConfig(flagSet *pflag.FlagSet, v *viper.Viper) *Config

NewConfig creates a new instance of Config.

func (*Config) DNSServers
func (c *Config) DNSServers() []net.IP

DNSServers returns the dns server addresses

func (*Config) Gateway
func (c *Config) Gateway() net.IP

Gateway returns the default gateway address

func (*Config) LeaseDuration
func (c *Config) LeaseDuration() time.Duration

LeaseDuration returns the client lease duration

func (*Config) LoadConfig
func (c *Config) LoadConfig() error

LoadConfig loads and validates the KV provider config.

func (*Config) Network
func (c *Config) Network() *net.IPNet

Network returns the ip range

func (*Config) Validate
func (c *Config) Validate() error

Validate returns whether the config is valid, containing necessary values.

type DHCP
type DHCP struct {
}

DHCP is a provider of dhcp functionality.

func New
func New(config *Config, tracker *acomm.Tracker) (*DHCP, error)

New creates a new instance of DHCP.

func (*DHCP) RegisterTasks
func (d *DHCP) RegisterTasks(server *provider.Server)

RegisterTasks registers all of DHCP's task handlers with the server.

type Lease
type Lease struct {
	DNS      []net.IP      `json:"dns"`
	Duration time.Duration `json:"duration"`
	Gateway  net.IP        `json:"gateway"`
	Net      net.IPNet     `json:"net"`
}

Lease specifies the dhcp lease returned from the "dhcp-offer-lease" endpoint.

type Mock
type Mock struct {
	RandIP func() net.IP
	Config *Config
	sync.Mutex
}

Mock is a mock dhcp provider.

func NewMock
func NewMock() *Mock

NewMock creates a new Mock.

func (*Mock) Expire
func (m *Mock) Expire(mac string)

Expire will remove an entry from memory as if the ephemeral key expired.

func (*Mock) RegisterTasks
func (m *Mock) RegisterTasks(server *provider.Server)

RegisterTasks registers all of Mock's task handlers with the server.

-- Generated with godocdown

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addresses

type Addresses struct {
	MAC string `json:"mac"`
	IP  string `json:"ip"`
}

Addresses specifies the argument to all endpoints

type Config

type Config struct {
	*provider.Config
	// contains filtered or unexported fields
}

Config holds all configuration for the provider.

func NewConfig

func NewConfig(flagSet *pflag.FlagSet, v *viper.Viper) *Config

NewConfig creates a new instance of Config.

func (*Config) DNSServers

func (c *Config) DNSServers() []net.IP

DNSServers returns the dns server addresses

func (*Config) Gateway

func (c *Config) Gateway() net.IP

Gateway returns the default gateway address

func (*Config) LeaseDuration

func (c *Config) LeaseDuration() time.Duration

LeaseDuration returns the client lease duration

func (*Config) LoadConfig

func (c *Config) LoadConfig() error

LoadConfig loads and validates the KV provider config.

func (*Config) Network

func (c *Config) Network() *net.IPNet

Network returns the ip range

func (*Config) Validate

func (c *Config) Validate() error

Validate returns whether the config is valid, containing necessary values.

type DHCP

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

DHCP is a provider of dhcp functionality.

func New

func New(config *Config, tracker *acomm.Tracker) (*DHCP, error)

New creates a new instance of DHCP.

func (*DHCP) RegisterTasks

func (d *DHCP) RegisterTasks(server *provider.Server)

RegisterTasks registers all of DHCP's task handlers with the server.

type Lease

type Lease struct {
	DNS      []net.IP      `json:"dns"`
	Duration time.Duration `json:"duration"`
	Gateway  net.IP        `json:"gateway"`
	Net      net.IPNet     `json:"net"`
}

Lease specifies the dhcp lease returned from the "dhcp-offer-lease" endpoint.

type Mock

type Mock struct {
	RandIP func() net.IP
	Config *Config
	sync.Mutex
	// contains filtered or unexported fields
}

Mock is a mock dhcp provider.

func NewMock

func NewMock() *Mock

NewMock creates a new Mock.

func (*Mock) Expire

func (m *Mock) Expire(mac string)

Expire will remove an entry from memory as if the ephemeral key expired.

func (*Mock) RegisterTasks

func (m *Mock) RegisterTasks(server *provider.Server)

RegisterTasks registers all of Mock's task handlers with the server.

Jump to

Keyboard shortcuts

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