worker

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAddressInfo

type IPAddressInfo struct {
	Address netip.Addr
	Hw      net.HardwareAddr
	// contains filtered or unexported fields
}

func NewIPAddressInfo

func NewIPAddressInfo(hw net.HardwareAddr, addr netip.Addr, ttl time.Duration, onExpiration func(*IPAddressInfo, int)) *IPAddressInfo

func (*IPAddressInfo) Clear

func (i *IPAddressInfo) Clear()

func (*IPAddressInfo) Extend

func (i *IPAddressInfo) Extend(ttl time.Duration)

func (*IPAddressInfo) GetAddress

func (i *IPAddressInfo) GetAddress() netip.Addr

func (*IPAddressInfo) GetExpiration

func (i *IPAddressInfo) GetExpiration() time.Time

func (*IPAddressInfo) IsStillValid

func (i *IPAddressInfo) IsStillValid() bool

type IPAddressSet

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

func NewIPAddressSet

func NewIPAddressSet() *IPAddressSet

func (*IPAddressSet) Add

func (s *IPAddressSet) Add(hw net.HardwareAddr, addr netip.Addr, ttl time.Duration, onExpiration func(*IPAddressInfo, int)) bool

Add an IPv6 address to the set with a TTL (in seconds).

func (*IPAddressSet) Contains

func (s *IPAddressSet) Contains(addr netip.Addr) bool

Check if an IPv6 address exists in the set and is not expired.

func (*IPAddressSet) PrettyPrint

func (s *IPAddressSet) PrettyPrint(tabSize int) string

func (*IPAddressSet) Remove

func (s *IPAddressSet) Remove(addr netip.Addr)

Remove an IPv6 address from the set.

type InvalidInterfaceError added in v0.1.2

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

func (*InvalidInterfaceError) Error added in v0.1.2

func (e *InvalidInterfaceError) Error() string

type Table

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

func NewTable

func NewTable() *Table

func (*Table) Add

func (t *Table) Add(hw net.HardwareAddr, addr netip.Addr, ttl time.Duration, onExpiration func(*IPAddressInfo, int)) bool

Add macs address to the set with a TTL (in seconds).

func (*Table) Contains

func (t *Table) Contains(hw net.HardwareAddr) bool

Check if an MAC address exists in the set and is not expired.

func (*Table) Filter

func (t *Table) Filter(hws []net.HardwareAddr, prefixes []netip.Prefix) []*IPAddressInfo

func (*Table) PrettyPrint

func (t *Table) PrettyPrint(tabSize int) string

func (*Table) Remove

func (t *Table) Remove(hw net.HardwareAddr)

Remove an MACs address from the set.

type Worker

type Worker struct {
	Table *Table
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(table *Table, ttl time.Duration, logger *zap.SugaredLogger) *Worker

func (*Worker) Start

func (w *Worker) Start() error

func (*Worker) StartInterface

func (w *Worker) StartInterface(iface *net.Interface) error

func (*Worker) StartInterfaceAddr

func (w *Worker) StartInterfaceAddr(iface net.Interface, addr netip.Addr)

Jump to

Keyboard shortcuts

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