device

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeviceExists       = errors.New("device exists")
	ErrDeviceDoesNotExist = errors.New("device does not exists")

	EmptyDevice = Device{}
)

Functions

func DateTimeFmt

func DateTimeFmt(t time.Time) string

func SortDevicesByAddr

func SortDevicesByAddr(devs []Device)

Types

type Device

type Device struct {
	Name         string
	Addr         netip.Addr
	MAC          net.HardwareAddr
	DiscoveredAt time.Time
	DiscoveredBy DiscoverySource

	Meta            Meta
	Server          Server
	PerformancePing Pinger
	SNMP            SNMP
	// contains filtered or unexported fields
}

func (Device) DiscoveredAtString

func (d Device) DiscoveredAtString() string

func (Device) FirstSeenString

func (d Device) FirstSeenString() string

func (Device) IsServer

func (d Device) IsServer() bool

func (Device) IsUpdated

func (d Device) IsUpdated() bool

func (Device) LastPingMaximumString

func (d Device) LastPingMaximumString() string

func (Device) LastPingMeanString

func (d Device) LastPingMeanString() string

func (Device) LastSeenDurString

func (d Device) LastSeenDurString(f func(time.Time) time.Duration) string

func (Device) LastSeenString

func (d Device) LastSeenString() string

func (Device) Merge

func (d Device) Merge(in Device) Device

func (*Device) SetUpdated

func (d *Device) SetUpdated()

func (Device) String

func (d Device) String() string

func (*Device) UpdateFromPingStats

func (d *Device) UpdateFromPingStats(stats nettools.Icmp4EchoResponseStatistics, ts time.Time)

type DeviceFilter

type DeviceFilter func(Device) bool

DeviceFilter defines a function used to select a set of required devices.

type DiscoverySource

type DiscoverySource string

type EventDeviceAdded

type EventDeviceAdded Device

func (EventDeviceAdded) String

func (nd EventDeviceAdded) String() string

type EventDeviceDiscovered

type EventDeviceDiscovered Device
var EmptyDiscoveredDevice EventDeviceDiscovered

func (EventDeviceDiscovered) String

func (dd EventDeviceDiscovered) String() string

type EventDeviceUpdated

type EventDeviceUpdated Device

func (EventDeviceUpdated) String

func (ude EventDeviceUpdated) String() string

type Meta

type Meta struct {
	DnsName      string
	Manufacturer string
	Tags         []tags.Tag
}

type Pinger

type Pinger struct {
	FirstSeen  time.Time
	LastSeen   time.Time
	Mean       time.Duration
	Maximum    time.Duration
	LastFailed bool
}

type SNMP

type SNMP struct {
	Name               string
	Description        string
	Community          string
	Port               int
	LastSNMPCheck      time.Time
	HasArpTable        bool
	LastArpTableScan   time.Time
	HasInterfaces      bool
	LastInterfacesScan time.Time
}

type Server

type Server struct {
	Ports    []int
	LastScan time.Time
}

Jump to

Keyboard shortcuts

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