iface

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

Documentation

Overview

Package iface implements the network interface producer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 the network interface.
	// If not positive, it defaults to 90 seconds.
	PollInterval jsonhelper.Duration `json:"poll_interval"`
}

ProducerConfig contains configuration options for the network interface producer.

func (*ProducerConfig) NewProducer

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

NewProducer creates a new producer.Producer that monitors the first IPv4 and IPv6 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 Go's net package. It only picks the first address of each family.

Source implements producer.Source.

func NewSource

func NewSource(name string) *Source

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