config

package
v0.0.0-...-dcb2eba Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config is used to configure traffic refinery

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSCacheConfig

type DNSCacheConfig struct {
	// Time before eviction from the cache
	EvictTime time.Duration
	// Length of the garbage collection period.
	CleanupTime time.Duration
}

DNSCacheConfig provides configurations used by the DNSCache

type FlowCacheConfig

type FlowCacheConfig struct {
	// Cache type. Currently only supports "ConcurrentCacheMap"
	CacheType string
	// Time before eviction from the cache
	EvictTime time.Duration
	// Number of shards used for concurrency
	ShardsCount int
	// Length of the garbage collection period.
	CleanupTime time.Duration
	// Whether to anonymize IP addresses or not
	Anonymize bool
}

FlowCacheConfig provides configurations used by the FlowCache

type ParserConfig

type ParserConfig struct {
	// Driver type. Either "ring" (PF_RING) or "pcap" (PCAP) or "afpacket (AF Packet)"
	Driver string
	// Whether to use PF_RING clustering for load balancing across threads
	Clustered bool
	// ID of the cluster to use
	ClusterID int
	// Whether to use PF_RING in Zero Copy mode. Not available if Clustered is true
	ZeroCopy bool
	// Whether to use AFPacket Fanout
	FanOut bool
	// Name of the interface to use
	Ifname string
	// Mode for hte interface. Supports "host"|"router"|"mirror" modes
	Mode string
	// Whether it's a replay session
	Replay bool
	// Gateway MAC address used when in replay mode
	ReplayMAC string
	// How many replicas of the same parser type
	Replicas int
}

ParserConfig provides configurations for a single parser

type ParsersConfig

type ParsersConfig struct {
	// Struct containing the configuration for the DNS parser
	DNSParser ParserConfig
	// Array of struct containing the configurations of the traffic parsers
	TrafficParsers []ParserConfig
}

ParsersConfig provides configurations for packet capture and processing.

type ServiceConfig

type ServiceConfig struct {
	// Name of the service
	Name string
	// Filter of the service
	Filter ServiceFilterConfig
	// Collect is the list of features to collect for the service
	Collect []string
	// Emit is the cycle length for stats printouts in ms
	Emit time.Duration
}

ServiceConfig contains the details of a service to track

type ServiceFilterConfig

type ServiceFilterConfig struct {
	// DomainsString is the list of domains to match
	DomainsString []string
	// DomainsRegex is the list of regexes to match
	DomainsRegex []string
	// Prefixes is the list of subnets to match
	Prefixes []string
}

ServiceFilterConfig contains the set of filters used to filter traffic classes

type StatsOutConfig

type StatsOutConfig struct {
	// Run determines whether to run a printer or not
	Run bool
	// Mode determines which printer to use. Currently only supports "dump"
	Mode string
	// Append determines whether to append entries to the file or to
	// reflush the same one every cycle
	Append bool
}

StatsConfig contains basic configurations on how to print statistics

type SysConfig

type SysConfig struct {
	// CPU is a boolean determining whether to run CPU profiling
	CPUProf bool
	// MemProf is a boolean determining whether to run MemProf profiling
	MemProf bool
	// InterfacesStats is a boolean determing whether to print out interface
	// statistics
	InterfacesStats bool
	// OutFolder is the path where to store the output files
	OutFolder string
}

SysConfig provides general configurations for the Traffic Refinery system.

type TrafficRefineryConfig

type TrafficRefineryConfig struct {
	Sys       SysConfig
	Parsers   ParsersConfig
	DNSCache  DNSCacheConfig
	FlowCache FlowCacheConfig
	Stats     StatsOutConfig
	Services  []ServiceConfig
}

TrafficRefineryConfig contains all configuration structures required by traffic refinery

func (*TrafficRefineryConfig) ImportConfig

func (conf *TrafficRefineryConfig) ImportConfig()

ImportConfig uses a conventional file named tr"config" to load the configuration

func (*TrafficRefineryConfig) ImportConfigFromFile

func (conf *TrafficRefineryConfig) ImportConfigFromFile(fileName string)

ImportConfigFromFile uses a conventional file named path/configName" to load the configuration

func (*TrafficRefineryConfig) PrintConfig

func (conf *TrafficRefineryConfig) PrintConfig()

PrintConfig prints the current configuration.

Jump to

Keyboard shortcuts

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