netbox

package
v0.0.0-...-23a3be6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingPrefix   = errors.New("missing prefix config")
	ErrMissingEndpoint = errors.New("missing endpoint config")
	ErrMissingToken    = errors.New("missing token config")

	ErrPrefixNotFound       = errors.New("prefix not found")
	ErrIPNotFound           = errors.New("ip not found")
	ErrUnexpectedStatusCode = errors.New("unexpected status code")
)

Functions

func NewAllocator

func NewAllocator(opts ...Option) (netalloc.Allocator, error)

Types

type Allocator

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

func (*Allocator) Alloc

func (a *Allocator) Alloc() (*net.IPAddr, error)

func (*Allocator) AllocCIDR

func (a *Allocator) AllocCIDR() (cidr string, err error)

func (*Allocator) CIDR

func (a *Allocator) CIDR(ip *net.IPAddr) string

func (*Allocator) Free

func (a *Allocator) Free(ip *net.IPAddr) error

func (*Allocator) FreeCIDR

func (a *Allocator) FreeCIDR(cidr string) (err error)

func (*Allocator) SetStore

func (a *Allocator) SetStore(_ netalloc.Store)

SetStore is a no-op

type Option

type Option func(*Allocator)

func WithEndpoint

func WithEndpoint(endpoint string) Option

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

func WithInsecureClient

func WithInsecureClient(insecure bool) Option

func WithPrefix

func WithPrefix(prefix string) Option

func WithToken

func WithToken(token string) Option

Jump to

Keyboard shortcuts

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