dev

package
v0.0.0-...-82c54c3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDebug

func SetDebug(enable bool)

SetDebug enables or disables debug output

Types

type AddrInfo

type AddrInfo struct {
	TimeInfo
	Addr    gopacket.Endpoint
	Packets int
}

AddrInfo stores an ip or mac address of a device on the network

func (*AddrInfo) String

func (a *AddrInfo) String() string

String converts address info to a string

type AddrMap

type AddrMap struct {
	Name string
	// contains filtered or unexported fields
}

AddrMap stores mappings of ip/mac addresses to address info

func (*AddrMap) Add

func (a *AddrMap) Add(address gopacket.Endpoint) *AddrInfo

Add adds address to the AddrMap and returns the address info

func (*AddrMap) Del

func (a *AddrMap) Del(address gopacket.Endpoint)

Del removes the address info with address

func (*AddrMap) Get

func (a *AddrMap) Get(address gopacket.Endpoint) *AddrInfo

Get returns address info with address

func (*AddrMap) Print

func (a *AddrMap) Print(w io.Writer)

Print prints the address map to w

type DeviceInfo

type DeviceInfo struct {
	TimeInfo
	MAC       gopacket.Endpoint
	VLANs     VNetMap
	VXLANs    VNetMap
	GENEVEs   VNetMap
	Powerline PropInfo
	Bridge    PropInfo
	DHCP      PropInfo
	Router    PropInfo
	Prefixes  PrefixList
	Packets   int
	UCasts    AddrMap
	MCasts    AddrMap
	MACPeers  AddrMap
	IPPeers   AddrMap
}

DeviceInfo is a device found on the network

func (*DeviceInfo) Print

func (d *DeviceInfo) Print(w io.Writer)

Print prints the device to w

type DeviceMap

type DeviceMap struct {
	sync.Mutex
	Packets int
	// contains filtered or unexported fields
}

DeviceMap is the device table definition

func (*DeviceMap) Add

func (d *DeviceMap) Add(linkAddr gopacket.Endpoint) *DeviceInfo

Add adds a device to the device table and returns the new device info entry

func (*DeviceMap) Get

func (d *DeviceMap) Get(linkAddr gopacket.Endpoint) *DeviceInfo

Get returns device information for device with linkAddr

func (*DeviceMap) Print

func (d *DeviceMap) Print(w io.Writer)

Print prints all devices to w

func (*DeviceMap) Reset

func (d *DeviceMap) Reset()

Reset deletes all device information entries

type PrefixInfo

type PrefixInfo struct {
	TimeInfo
	Prefix layers.ICMPv6Option
}

PrefixInfo stores a router's prefix information

func (*PrefixInfo) String

func (p *PrefixInfo) String() string

String converts the prefix to a string

type PrefixList

type PrefixList struct {
	Prefixes []*PrefixInfo
}

PrefixList stores router prefixes

func (*PrefixList) Add

func (p *PrefixList) Add(prefix layers.ICMPv6Option) *PrefixInfo

Add adds a prefix

func (*PrefixList) Clear

func (p *PrefixList) Clear()

Clear deletes all prefixes

func (*PrefixList) Get

func (p *PrefixList) Get() []*PrefixInfo

Get returns all prefixes

func (*PrefixList) Print

func (p *PrefixList) Print(w io.Writer)

Print prints all prefixes

type PropInfo

type PropInfo struct {
	TimeInfo
	Name    string
	Enabled bool
}

PropInfo is a device property

func (*PropInfo) Disable

func (p *PropInfo) Disable()

Disable disables the device property

func (*PropInfo) Enable

func (p *PropInfo) Enable()

Enable enables the device property

func (*PropInfo) IsEnabled

func (p *PropInfo) IsEnabled() bool

IsEnabled checks if device property is enabled

func (*PropInfo) Print

func (p *PropInfo) Print(w io.Writer)

Print prints the property info to w

type TimeInfo

type TimeInfo struct {
	Timestamp time.Time
}

TimeInfo stores a timestamp

func (*TimeInfo) Age

func (t *TimeInfo) Age() float64

Age gets seconds since timestamp

func (*TimeInfo) SetTimestamp

func (t *TimeInfo) SetTimestamp(timestamp time.Time)

SetTimestamp sets the timestamp

type VNetInfo

type VNetInfo struct {
	TimeInfo
	Type    string
	ID      uint32
	Packets int
}

VNetInfo stores virtual network information

func (*VNetInfo) String

func (v *VNetInfo) String() string

String converts vnet info to a string

type VNetMap

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

VNetMap stores mappings from vnet IDs to vnet information

func (*VNetMap) Add

func (v *VNetMap) Add(id uint32) *VNetInfo

Add adds a vnet with id to the mapping and returns the vnet info

func (*VNetMap) Get

func (v *VNetMap) Get(id uint32) *VNetInfo

Get returns the vnet info with id

func (*VNetMap) Len

func (v *VNetMap) Len() int

Len returns the number of vnets in the vnet map

func (*VNetMap) Print

func (v *VNetMap) Print(w io.Writer)

Print prints the vnet map to w

Jump to

Keyboard shortcuts

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