nl

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 13 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 Addr added in v1.12.0

type Addr = netlink.Addr

Addr is type alias

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 LinkLister added in v1.12.0

type LinkLister interface {
	List(context.Context) ([]Link, error)
	Addrs(context.Context, Link) ([]Addr, error)
	Close() error
}

LinkLister -

func NewLinkLister added in v1.12.0

func NewLinkLister(ctx context.Context, opts ...linkListerOpt) (LinkLister, error)

NewLinkLister -

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 WithNetnsName added in v1.12.0

type WithNetnsName struct {
	WatcherOption

	Netns string
	// contains filtered or unexported fields
}

WithNetnsName 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