Documentation
¶
Index ¶
- type Addr
- type AddrCollection
- func (c *AddrCollection) Add(addr *Addr) (*Addr, bool)
- func (c *AddrCollection) Contains(addr *Addr) bool
- func (c *AddrCollection) Copy() *AddrCollection
- func (c *AddrCollection) Equal(addrCollection *AddrCollection) bool
- func (c *AddrCollection) Filter4() *AddrCollection
- func (c *AddrCollection) Filter6() *AddrCollection
- func (c *AddrCollection) FilterSubnets(subnets []netip.Prefix) *AddrCollection
- func (c *AddrCollection) FilterValid() *AddrCollection
- func (c *AddrCollection) Get() []*Addr
- func (c *AddrCollection) Join(addrCollection *AddrCollection)
- func (c *AddrCollection) PrettyPrint(prefix string) string
- func (c *AddrCollection) Remove(addr *Addr)
- func (c *AddrCollection) Seen(addr *Addr, source ...string) (*Addr, bool)
- func (c *AddrCollection) Strings() []string
- type AddrExpirationRemainingEvents
- type DiscoveryProtocol
- type HostCounter
- type InterfaceProcesses
- type InvalidInterfaceError
- type Plugin
- type State
- func (s *State) FilterMACs(hws []net.HardwareAddr) *AddrCollection
- func (s *State) GetAll() map[string]*AddrCollection
- func (s *State) PrettyPrint(prefix string, hideSensible bool) string
- func (s *State) Register(hw net.HardwareAddr, ip netip.Addr, source string, lifetime time.Duration, ...) (*Addr, bool)
- func (s *State) Seen(addr *Addr, source ...string) (*Addr, bool)
- func (s *State) SetLogger(l *zap.SugaredLogger)
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addr ¶
type Addr struct {
netip.Addr
Hw net.HardwareAddr
Sources []string
// contains filtered or unexported fields
}
func NewAddr ¶
func NewAddr(hw net.HardwareAddr, addr netip.Addr, source string, lifetime time.Duration, onExpiration func(*Addr, AddrExpirationRemainingEvents)) *Addr
func (*Addr) GetExpiration ¶
type AddrCollection ¶
type AddrCollection struct {
// contains filtered or unexported fields
}
func NewAddrCollection ¶
func NewAddrCollection() *AddrCollection
func (*AddrCollection) Contains ¶
func (c *AddrCollection) Contains(addr *Addr) bool
func (*AddrCollection) Copy ¶ added in v0.2.1
func (c *AddrCollection) Copy() *AddrCollection
func (*AddrCollection) Equal ¶
func (c *AddrCollection) Equal(addrCollection *AddrCollection) bool
func (*AddrCollection) Filter4 ¶
func (c *AddrCollection) Filter4() *AddrCollection
func (*AddrCollection) Filter6 ¶
func (c *AddrCollection) Filter6() *AddrCollection
func (*AddrCollection) FilterSubnets ¶ added in v0.3.0
func (c *AddrCollection) FilterSubnets(subnets []netip.Prefix) *AddrCollection
func (*AddrCollection) FilterValid ¶ added in v0.3.2
func (c *AddrCollection) FilterValid() *AddrCollection
func (*AddrCollection) Get ¶
func (c *AddrCollection) Get() []*Addr
func (*AddrCollection) Join ¶
func (c *AddrCollection) Join(addrCollection *AddrCollection)
func (*AddrCollection) PrettyPrint ¶
func (c *AddrCollection) PrettyPrint(prefix string) string
func (*AddrCollection) Remove ¶
func (c *AddrCollection) Remove(addr *Addr)
func (*AddrCollection) Seen ¶ added in v0.3.3
func (c *AddrCollection) Seen(addr *Addr, source ...string) (*Addr, bool)
func (*AddrCollection) Strings ¶
func (c *AddrCollection) Strings() []string
type AddrExpirationRemainingEvents ¶
type AddrExpirationRemainingEvents int
type DiscoveryProtocol ¶ added in v0.4.0
type DiscoveryProtocol struct {
Name string
Worker worker
}
type HostCounter ¶ added in v0.4.0
type HostCounter interface {
IncrementHostsFound()
}
type InterfaceProcesses ¶ added in v0.4.0
type InterfaceProcesses struct {
InterfaceName string
Address netip.Addr
Protocols []*DiscoveryProtocol
}
type InvalidInterfaceError ¶
type InvalidInterfaceError struct {
// contains filtered or unexported fields
}
func (*InvalidInterfaceError) Error ¶
func (e *InvalidInterfaceError) Error() string
type Plugin ¶ added in v0.4.0
type Plugin interface {
// Name returns the name of the plugin.
Name() string
// Start starts the plugin. It should block until the context is cancelled.
Start(ctx context.Context, state *State, onError func(error)) error
// Stats returns the current statistics for the plugin.
Stats() map[string]any
}
Plugin is the interface that must be implemented by discovery plugins.
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) FilterMACs ¶ added in v0.3.0
func (s *State) FilterMACs(hws []net.HardwareAddr) *AddrCollection
func (*State) GetAll ¶ added in v0.7.0
func (s *State) GetAll() map[string]*AddrCollection
func (*State) Register ¶ added in v0.4.1
func (s *State) Register(hw net.HardwareAddr, ip netip.Addr, source string, lifetime time.Duration, onExpiration func(*Addr, AddrExpirationRemainingEvents)) (*Addr, bool)
Register adds a discovered address to the state. It handles creation of new Addr objects, calling Seen, and logging "host identified" events. If onExpiration is nil, a default handler is used which logs "host expired".
func (*State) SetLogger ¶ added in v0.4.1
func (s *State) SetLogger(l *zap.SugaredLogger)
type Worker ¶
type Worker struct {
*State
// contains filtered or unexported fields
}
func (*Worker) PrettyPrintStats ¶ added in v0.4.0
func (*Worker) RegisterPlugin ¶ added in v0.4.0
Click to show internal directories.
Click to hide internal directories.