nl

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//IgnoreLinks does not send 'Links'
	IgnoreLinks scopeOfUpdates

	//IgnoreAddress does not send 'Adresses'
	IgnoreAddress
)

Variables

View Source
var (
	// ErrUnexpectedlyStopped it setds when 'netlink' unextectedly fails
	ErrUnexpectedlyStopped = errors.New("net-watcher is stopped unexpectedly")

	// ErrUnsupportedOption used unsupported option
	ErrUnsupportedOption = errors.New("net-watcher unsupported option")
)

Functions

This section is empty.

Types

type AddrUpdateMsg

type AddrUpdateMsg struct {
	WID       WatcherID
	Address   net.IPNet
	LinkIndex int
	Deleted   bool
}

AddrUpdateMsg address update message

func (AddrUpdateMsg) MarshalJSON

func (m AddrUpdateMsg) MarshalJSON() ([]byte, error)

MarshalJSON impl 'json.Marshaler'

func (AddrUpdateMsg) String

func (m AddrUpdateMsg) String() string

String impl 'stringer'

type ErrMsg

type ErrMsg struct {
	WID WatcherID
	Err error
}

ErrMsg ...

func (ErrMsg) Cause

func (e ErrMsg) Cause() error

Cause -

func (ErrMsg) Error

func (e ErrMsg) Error() string

Error impl 'error'

func (ErrMsg) MarshalJSON

func (e ErrMsg) MarshalJSON() ([]byte, error)

MarshalJSON impl 'json.Marshaler'

func (ErrMsg) String

func (e ErrMsg) String() string

String impl 'stringer'

type Link = netlink.Link

Link is type alias

type LinkUpdateMsg

type LinkUpdateMsg struct {
	WID     WatcherID
	Link    Link
	Deleted bool
}

LinkUpdateMsg network link update message

func (LinkUpdateMsg) MarshalJSON

func (m LinkUpdateMsg) MarshalJSON() ([]byte, error)

MarshalJSON impl 'json.Marshaler'

func (LinkUpdateMsg) String

func (m LinkUpdateMsg) String() string

String impl 'stringer'

type NetlinkWatcher

type NetlinkWatcher interface {
	Stream() <-chan []WatcherMsg
	Close() error
}

NetlinkWatcher netlink watch streamer

func NewNetlinkWatcher

func NewNetlinkWatcher(opts ...WatcherOption) (NetlinkWatcher, error)

NewNetlinkWatcher creates NetlinkWatcher instance

type WatcherID

type WatcherID = string

WatcherID is a watcher ID

type WatcherMsg

type WatcherMsg interface {
	// contains filtered or unexported methods
}

WatcherMsg abstract message def

type WatcherOption

type WatcherOption interface {
	// contains filtered or unexported methods
}

WatcherOption ...

type WithID

type WithID struct {
	WatcherOption
	WatcherID
}

WithID sets ID to watcher

type WithLinger

type WithLinger struct {
	WatcherOption
	Linger time.Duration
}

WithLinger - every packet accumulates updates during some duration then it sends to consumer

type WithNetns

type WithNetns struct {
	WatcherOption
	Netns string
}

WithNetns select net NS(by name) for watching

Jump to

Keyboard shortcuts

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