watchers

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedWatcherType = errors.New("unsupported watcher type")
	ErrMismatchedNlMsgType    = errors.New("mismatched netlink message type")
)
View Source
var (
	LinkWatcher       = newWatcher[LinkEvent]
	RuleWatcher       = newWatcher[RuleEvent]
	ChainWatcher      = newWatcher[ChainEvent]
	SetWatcher        = newWatcher[SetEvent]
	SetElementWatcher = newWatcher[SetElementEvent]
	TableWatcher      = newWatcher[TableEvent]
	NftWatcher        = newWatcher[NftEvent]
)

Functions

This section is empty.

Types

type Action

type Action string
const (
	AddAction Action = "added"
	RmAction  Action = "removed"
)

type ChainEvent

type ChainEvent nftEvent[*nftLib.Chain]

func (ChainEvent) ActionInfo

func (c ChainEvent) ActionInfo() string

type ErrWatcher

type ErrWatcher struct {
	Err error
}

ErrWatcher -

func (ErrWatcher) Cause

func (e ErrWatcher) Cause() error

Cause -

func (ErrWatcher) Error

func (e ErrWatcher) Error() string

Error -

type Link struct {
	Name  string
	Index int
}

type LinkEvent

type LinkEvent event[Link]

func (LinkEvent) ActionInfo

func (l LinkEvent) ActionInfo() string

type NftEvent

type NftEvent event[NftEventFace]

func (NftEvent) ActionInfo

func (t NftEvent) ActionInfo() string

type NftEventFace

type NftEventFace interface {
	ActionInfo() string
	// contains filtered or unexported methods
}

type RuleEvent

type RuleEvent nftEvent[*nftLib.Rule]

func (RuleEvent) ActionInfo

func (r RuleEvent) ActionInfo() string

type SetElementEvent

type SetElementEvent nftEvent[*nlparser.SetElems]

func (SetElementEvent) ActionInfo

func (t SetElementEvent) ActionInfo() string

type SetEvent

type SetEvent nftEvent[*nftLib.Set]

func (SetEvent) ActionInfo

func (s SetEvent) ActionInfo() string

type TableEvent

type TableEvent nftEvent[*nftLib.Table]

func (TableEvent) ActionInfo

func (t TableEvent) ActionInfo() string

type Watcher

type Watcher[T watcherT] interface {
	Close() error
	Stream(ctx context.Context) <-chan WatcherEvent[T]
}

Watcher is an interface for a watcher that can stream events of type T. T is a type that implements the watcherT interface, which can be either Link or Rule.

type WatcherEvent

type WatcherEvent[T watcherT] struct {
	Evt T
	Err error
}

Jump to

Keyboard shortcuts

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