bsdroute

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: 5 Imported by: 0

Documentation

Overview

Package bsdroute implements a producer that utilizes routing information to obtain network interface IP addresses on supported BSD variants.

The package supports any version of Darwin, any version of DragonFly BSD, FreeBSD 7 and above, NetBSD 6 and above, and OpenBSD 5.6 and above.

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 bsdroute.

func (PlatformUnsupportedError) Error

func (PlatformUnsupportedError) Is

func (PlatformUnsupportedError) Is(target error) bool

type ProducerConfig

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

	// PollInterval is the interval between polling routing information for interface addresses.
	// If not positive, it defaults to 90 seconds.
	PollInterval jsonhelper.Duration `json:"poll_interval"`
}

ProducerConfig contains configuration options for the bsdroute producer.

func (*ProducerConfig) NewProducer

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

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

type Source

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

Source obtains the first IPv4 and IPv6 addresses from a network interface, using routing information on supported BSD variants. It only picks the first address of each family.

Source implements producer.Source.

func NewSource

func NewSource(name string) (*Source, error)

NewSource creates a new Source.

func (*Source) Snapshot

func (s *Source) Snapshot(_ context.Context) (producer.Message, error)

Snapshot returns the first IPv4 and IPv6 addresses of the network interface.

Snapshot implements producer.Source.Snapshot.

Jump to

Keyboard shortcuts

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