lldp

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chassis

type Chassis struct {
	Type  LinkType
	Value string
}

Chassis of a lldp Neighbor

func (Chassis) String

func (c Chassis) String() string

type Client

type Client struct {
	Source    *gopacket.PacketSource
	Handle    *pcap.Handle
	Interface *net.Interface
}

Client consumes lldp messages.

func NewClient

func NewClient(ifi string) (*Client, error)

NewClient create a new lldp client.

func (*Client) Close

func (l *Client) Close()

Close the lldp client

func (*Client) Neighbors

func (l *Client) Neighbors(neighChan chan Neighbor)

Neighbors search on a interface for neighbors announced via lldp

type Daemon

type Daemon struct {
	SystemName        string
	SystemDescription string
	Interface         *net.Interface
	PacketConn        net.PacketConn
	Interval          time.Duration
	LLDPMessage       []byte
}

Daemon is a lldp daemon

func NewDaemon

func NewDaemon(systemName, systemDescription, interfaceName string, interval time.Duration) (*Daemon, error)

NewDaemon create a new LLDPD instance for the given interface

func (*Daemon) Start

func (l *Daemon) Start()

Start spawn a goroutine which sends LLDP PDU's every interval given.

type LinkType

type LinkType string

LinkType can be Interface or Mac

var (
	// Interface LinkType
	Interface LinkType = "Interface"
	// Mac LinkType
	Mac LinkType = "Mac"
)

type Neighbor

type Neighbor struct {
	Name        string
	Description string
	Interface   string
	Chassis     Chassis
	Port        Port
}

Neighbor is the direct ethernet neighbor

func (Neighbor) String

func (n Neighbor) String() string

type Port

type Port struct {
	Type  LinkType
	Value string
}

Port of a lldp Neighbor

func (Port) String

func (p Port) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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