discovery

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArpDiscoverySource     model.DiscoverySource = "ARP"
	PingDiscoverySource    model.DiscoverySource = "PING"
	SNMPDiscoverySource    model.DiscoverySource = "SNMP"
	SNMPArpDiscoverySource model.DiscoverySource = "SNMP_ARP"
)

Variables

View Source
var ErrIPv6ExcludedFromDiscovery = IPv6ExcludedFromDiscovery{}
View Source
var ErrNoDeviceDiscovered = NoDeviceDiscoveredError{}

Functions

func BuildAddrScannerFunc

func BuildAddrScannerFunc(
	funcs []scanfunc,
) func(context.Context, model.Addr) (model.EventDeviceDiscovered, error)

func BuildAddrScanners

func BuildAddrScanners(cfg *Config) []scanfunc

func BuildNetworkScanFunc

func BuildNetworkScanFunc(
	q chan model.Addr,
	status *string,
) func(context.Context, model.Network) (string, error)

func NetworkRescanFilter

func NetworkRescanFilter(cfg *Config) model.NetworkFilter

func SetFlags added in v0.2.0

func SetFlags(fs *pflag.FlagSet, cfg *Config)

func SnmpArpTableRescanFilter

func SnmpArpTableRescanFilter(cfg *SNMPConfig) model.DeviceFilter

func SnmpInterfaceRescanFilter

func SnmpInterfaceRescanFilter(cfg *SNMPConfig) model.DeviceFilter

Types

type ArpConfig added in v0.2.0

type ArpConfig struct {
	Enabled bool
	Timeout time.Duration
}

type Config added in v0.2.0

type Config struct {
	Enabled                 bool
	BootstrapOnFirstRun     bool
	AutoDiscoverNewNetworks bool
	CheckInterval           time.Duration
	NetworkScanInterval     time.Duration
	MaxWorkers              int
	Arp                     *ArpConfig
	Icmp                    *ICMPConfig
	Snmp                    *SNMPConfig
}

type DiscoverDevicesFromSNMPDevice

type DiscoverDevicesFromSNMPDevice struct {
	model.Device
}

type DiscoverNetworksFromSNMPDevice

type DiscoverNetworksFromSNMPDevice struct {
	model.Device
}

type ICMPConfig added in v0.2.0

type ICMPConfig struct {
	Enabled      bool
	Privileged   bool
	Timeout      time.Duration
	PingCount    int
	SleepBetween time.Duration
}

type IPv6ExcludedFromDiscovery

type IPv6ExcludedFromDiscovery struct {
	Network model.Network
}

func IPv6NetworkExcluded

func IPv6NetworkExcluded(n model.Network) IPv6ExcludedFromDiscovery

func (IPv6ExcludedFromDiscovery) Error

func (IPv6ExcludedFromDiscovery) Is

func (e IPv6ExcludedFromDiscovery) Is(target error) bool

type NetworkScannerWorker added in v0.2.0

type NetworkScannerWorker struct {
	In chan model.Network
	*workerpool.Pool[model.Network, string]
}

func NewNetworkScannerWorker added in v0.2.0

func NewNetworkScannerWorker(status *string, devin chan model.Addr) *NetworkScannerWorker

func (*NetworkScannerWorker) Close added in v0.2.0

func (w *NetworkScannerWorker) Close()

func (*NetworkScannerWorker) Run added in v0.2.0

func (w *NetworkScannerWorker) Run(ctx context.Context)

type NoDeviceDiscoveredError

type NoDeviceDiscoveredError struct {
	Addr model.Addr
}

func NoDeviceDiscovered

func NoDeviceDiscovered(addr model.Addr) NoDeviceDiscoveredError

func (NoDeviceDiscoveredError) Error

func (e NoDeviceDiscoveredError) Error() string

func (NoDeviceDiscoveredError) Is

func (e NoDeviceDiscoveredError) Is(target error) bool

type SNMPConfig added in v0.2.0

type SNMPConfig struct {
	Enabled                 bool
	Timeout                 time.Duration
	Community               []string
	Ports                   []int
	ArpTableRescanInterval  time.Duration
	InterfaceRescanInterval time.Duration
}

type Worker added in v0.2.0

type Worker struct {
	In chan model.Addr
	*workerpool.Pool[model.Addr, model.EventDeviceDiscovered]
}

func NewWorker added in v0.2.0

func NewWorker(cfg *Config) *Worker

func (*Worker) Close added in v0.2.0

func (w *Worker) Close()

func (*Worker) Run added in v0.2.0

func (w *Worker) Run(ctx context.Context, max int)

Jump to

Keyboard shortcuts

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