Documentation ¶
Index ¶
- Constants
- Variables
- func NewNLListener(log Logger) *nlListener
- type ErrListenFn
- type HandleInputFn
- type InterfaceFilterFn
- type LLDPD
- type Logger
- type Message
- type NormalLoger
- type Option
- func HandleInput(fn HandleInputFn) Option
- func InterfaceFilter(fn InterfaceFilterFn) Option
- func OnListenErr(fn ErrListenFn) Option
- func OnListenSuccess(fn SuccessListenFn) Option
- func PortLookup(fn PortLookupFn) Option
- func SetLogger(log Logger) Option
- func SourceAddress(fn SetSourceAddressFn) Option
- type PortLookupFn
- type SetSourceAddressFn
- type SuccessListenFn
Constants ¶
const ( IF_ADD linkOp = 1 IF_DEL linkOp = 2 )
Variables ¶
var LldpMulticaseAddress = []byte{0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e}
sudo ip maddr add 01:80:c2:00:00:0e dev eth0
Functions ¶
func NewNLListener ¶
func NewNLListener(log Logger) *nlListener
NewNLListener listens on rtnetlink for addition and removal of interfaces and inform users on the Messages channel.
Types ¶
type ErrListenFn ¶
type HandleInputFn ¶
type InterfaceFilterFn ¶
InterfaceFilterFn is the function used to filter interface This function is called once for every interface the daemon can potentially listen on. It should return true if the daemon should listen on the interface.
type LLDPD ¶
type LLDPD struct {
// contains filtered or unexported fields
}
LLDPD is the server for LLDP PDU's It will always listen passively. This means, it will only send LLDP PDU's in response to a received PDU.
func (*LLDPD) CancelListenOn ¶
CancelListenOn will stop listening on the interface
type Logger ¶
type Logger interface { Info(...interface{}) Error(...interface{}) Errorf(string, ...interface{}) }
type NormalLoger ¶
type NormalLoger struct { }
func (*NormalLoger) Error ¶
func (n *NormalLoger) Error(args ...interface{})
func (*NormalLoger) Errorf ¶
func (n *NormalLoger) Errorf(fmt string, args ...interface{})
func (*NormalLoger) Info ¶
func (n *NormalLoger) Info(args ...interface{})
type Option ¶
Option is a functional option handler for LLDPD.
func HandleInput ¶
func HandleInput(fn HandleInputFn) Option
PortLookup allows a user to use a different port description lookup mechanism
func InterfaceFilter ¶
func InterfaceFilter(fn InterfaceFilterFn) Option
InterfaceFilter allows a user to filter interfaces
func OnListenErr ¶
func OnListenErr(fn ErrListenFn) Option
func OnListenSuccess ¶
func OnListenSuccess(fn SuccessListenFn) Option
func PortLookup ¶
func PortLookup(fn PortLookupFn) Option
PortLookup allows a user to use a different port description lookup mechanism
func SourceAddress ¶
func SourceAddress(fn SetSourceAddressFn) Option
SourceAddress sets the ethernet source address to use for LLDP PDU's
type PortLookupFn ¶
PortLookupFn is the function used to respond with a different port description. This function is called once, on first receive of an LLDP PDU on a port and the reply is cached untill restart.
type SetSourceAddressFn ¶
type SetSourceAddressFn func(raw.Interface) ([]byte, lldp.ChassisIDSubtype)