config

package
v0.9.1-0...-40a840d Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config exposes the netflow configuration as a component.

Package config defines the configuration options for the netflow services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fxutil.Module

Module defines the fx options for this component.

Types

type Component

type Component interface {
	Get() *NetflowConfig
}

Component is the component type.

type ListenerConfig

type ListenerConfig struct {
	FlowType  common.FlowType `mapstructure:"flow_type"`
	Port      uint16          `mapstructure:"port"`
	BindHost  string          `mapstructure:"bind_host"`
	Workers   int             `mapstructure:"workers"`
	Namespace string          `mapstructure:"namespace"`
	Mapping   []Mapping       `mapstructure:"mapping"`
}

ListenerConfig contains configuration for a single flow listener

func (*ListenerConfig) Addr

func (c *ListenerConfig) Addr() string

Addr returns the host:port address to listen on.

type Mapping

type Mapping struct {
	Field       uint16            `mapstructure:"field"`
	Destination string            `mapstructure:"destination"`
	Endian      common.EndianType `mapstructure:"endianness"`
	Type        common.FieldType  `mapstructure:"type"`
}

Mapping contains configuration for a Netflow/IPFIX field mapping

type NetflowConfig

type NetflowConfig struct {
	Enabled                       bool             `mapstructure:"enabled"`
	Listeners                     []ListenerConfig `mapstructure:"listeners"`
	StopTimeout                   int              `mapstructure:"stop_timeout"`
	AggregatorBufferSize          int              `mapstructure:"aggregator_buffer_size"`
	AggregatorFlushInterval       int              `mapstructure:"aggregator_flush_interval"`
	AggregatorFlowContextTTL      int              `mapstructure:"aggregator_flow_context_ttl"`
	AggregatorPortRollupThreshold int              `mapstructure:"aggregator_port_rollup_threshold"`
	AggregatorPortRollupDisabled  bool             `mapstructure:"aggregator_port_rollup_disabled"`

	// AggregatorRollupTrackerRefreshInterval is useful to speed up testing to avoid wait for 1h default
	AggregatorRollupTrackerRefreshInterval uint `mapstructure:"aggregator_rollup_tracker_refresh_interval"`

	PrometheusListenerAddress string `mapstructure:"prometheus_listener_address"` // Example `localhost:9090`
	PrometheusListenerEnabled bool   `mapstructure:"prometheus_listener_enabled"`

	ReverseDNSEnrichmentEnabled bool `mapstructure:"reverse_dns_enrichment_enabled"`
}

NetflowConfig contains configuration for NetFlow collector.

func ReadConfig

func ReadConfig(conf config.Component, logger log.Component) (*NetflowConfig, error)

ReadConfig builds and returns configuration from Agent configuration.

func (*NetflowConfig) SetDefaults

func (mainConfig *NetflowConfig) SetDefaults(namespace string, logger log.Component) error

SetDefaults sets default values wherever possible, returning an error if any values are malformed.

Jump to

Keyboard shortcuts

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