ipdb

package
v0.0.0-...-11e78ec Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPDB

type IPDB struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(network net.IP, netmask net.IPMask) (*IPDB, error)

func (*IPDB) AddPermanentClient

func (ix *IPDB) AddPermanentClient(ip net.IP, duid d.Duid) error

AddPermanentClient injects a new client and marks it as permanent. While the lease may expire, the ip<>duid mapping will not.

func (*IPDB) DisableDynamic

func (ix *IPDB) DisableDynamic()

DisableDynamic configures ipdb to only hand out pre-configured (or still existing) leases. No search will be performed for dynamic leases.

func (*IPDB) FindIP

func (ix *IPDB) FindIP(ctx context.Context, isFree func(context.Context, net.IP) bool, ip net.IP, duid d.Duid) (net.IP, error)

FindIP attempts to find an IP for given duid, having a bias for the suggested IP.

func (*IPDB) InManagedRange

func (ix *IPDB) InManagedRange(ip net.IP) bool

InManagedRange returns 'true' if given ip is in the network range we manage.

func (*IPDB) LookupClientByDuid

func (ix *IPDB) LookupClientByDuid(duid d.Duid) (net.IP, error)

func (*IPDB) SetDynamicRange

func (ix *IPDB) SetDynamicRange(begin, end net.IP) error

SetDynamicRange configures the pool range to find dynamic IPs.

func (*IPDB) UpdateClient

func (ix *IPDB) UpdateClient(ip net.IP, duid d.Duid, ttl time.Duration) error

SetClient updates the state of a client, inserting it if needed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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