netlink

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPlatformUnsupported = PlatformUnsupportedError{}

Functions

This section is empty.

Types

type PlatformUnsupportedError

type PlatformUnsupportedError struct{}

PlatformUnsupportedError is returned when the platform is not supported by netlink.

func (PlatformUnsupportedError) Error

func (PlatformUnsupportedError) Is

func (PlatformUnsupportedError) Is(target error) bool

type Producer

type Producer struct {
	// contains filtered or unexported fields
}

Producer monitors the IP addresses of a network interface using Linux's netlink interface, and broadcasts IP address change notifications to subscribers.

Producer implements producerpkg.Producer.

func (*Producer) Run

func (p *Producer) Run(ctx context.Context)

Run initiates the monitoring process for IP address changes.

Run implements producerpkg.Producer.Run.

func (*Producer) Subscribe

func (p *Producer) Subscribe() <-chan producerpkg.Message

Subscribe returns a channel for receiving updates on IP address changes.

Subscribe implements producerpkg.Producer.Subscribe.

type ProducerConfig

type ProducerConfig struct {
	// Interface is the name of the network interface to monitor.
	Interface string `json:"interface"`

	// FromAddrLookupMain controls whether to add policy routing rules to let
	// packets originating from the interface addresses use the main routing table.
	//
	// This option is useful when a VPN connection is the default route, and the
	// physical interface still needs to handle incoming connections.
	FromAddrLookupMain bool `json:"from_addr_lookup_main"`
}

ProducerConfig contains configuration options for the netlink producer.

func (*ProducerConfig) NewProducer

func (cfg *ProducerConfig) NewProducer(logger *tslog.Logger) (*Producer, error)

NewProducer creates a new producer that monitors the IP addresses of a network interface.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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