ipallocator

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPAllocatorPrefix     = "/ipalloc"
	IPAllocatorLockPrefix = "/ipalloc-lock"
)

Variables

This section is empty.

Functions

func New

func New(config *config.Config, store store.Store, locker lock.Locker) *allocator

Types

type AllocateIPOpts

type AllocateIPOpts struct {
	AddressRange string
	// If set, will try to allocate this precise IP, error if already taken
	Address string
}

type IPAllocator

type IPAllocator interface {
	InitializePool(ctx context.Context, id string, addressRange string) (RangeAddresser, error)
	AllocateIP(ctx context.Context, id string, opts AllocateIPOpts) (string, error)
	ReleaseIP(ctx context.Context, id string, address string) error
	ReleasePool(ctx context.Context, id string) error
}

type RangeAddresser

type RangeAddresser interface {
	GetAddressRange() string
}

Jump to

Keyboard shortcuts

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