config

package
v2.0.1-0...-1980a61 Latest Latest
Warning

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

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

Documentation

Overview

Package config provides primitives for l3afd configuration ( i.e. l3afd.cfg) file.

Index

Constants

View Source
const (
	ENV_PROD = "PROD"
)

Variables

This section is empty.

Functions

func LoadConfigBool

func LoadConfigBool(confReader *config.Config, group, field string) bool

func LoadConfigDuration

func LoadConfigDuration(confReader *config.Config, group, field string) time.Duration

func LoadConfigFloat

func LoadConfigFloat(confReader *config.Config, group, field string) float64

func LoadConfigInt

func LoadConfigInt(confReader *config.Config, group, field string) int

func LoadConfigString

func LoadConfigString(confReader *config.Config, group, field string) string

LoadConfigString gets the value (as a string) for a field belonging to a group. If the group and field are present - it returns the value If the group or field are absent - it aborts the process Note: Values that are encrypted are decrypted using a global key

func LoadConfigStringCSV

func LoadConfigStringCSV(confReader *config.Config, group, field string) []string

LoadConfigStringCSV splits a CSV config string value and returns the resulting slice of strings. An emptyDefault []string is returned if the config field is emptyDefault (as opposed to []string{""}, which strings.Split() would return).

func LoadConfigStringEncKey

func LoadConfigStringEncKey(confReader *config.Config, group, field string) string

LoadConfigStringEncKey is similar to LoadConfigString, except that it accepts an optional decryption key.

func LoadConfigURL

func LoadConfigURL(confReader *config.Config, group, field string) *url.URL

func LoadOptionalConfigBool

func LoadOptionalConfigBool(confReader *config.Config, group, field string, defaultValue bool) bool

func LoadOptionalConfigDuration

func LoadOptionalConfigDuration(confReader *config.Config, group, field string, defaultValue time.Duration) time.Duration

func LoadOptionalConfigFloat

func LoadOptionalConfigFloat(confReader *config.Config, group, field string, defaultValue float64) float64

func LoadOptionalConfigInt

func LoadOptionalConfigInt(confReader *config.Config, group, field string, defaultValue int) int

func LoadOptionalConfigString

func LoadOptionalConfigString(confReader *config.Config, group, field, defaultValue string) string

LoadOptionalConfigString gets the value (as a string) for a field belonging to a group. If the group and field are present - it returns the value If the group or field are absent - it returns the supplied default value Note: Values that are encrypted are decrypted using a global key

func LoadOptionalConfigStringCSV

func LoadOptionalConfigStringCSV(confReader *config.Config, group, field string, defaultValue []string) []string

func LoadOptionalConfigStringEncKey

func LoadOptionalConfigStringEncKey(confReader *config.Config, group, field, defaultValue string) string

LoadOptionalConfigStringEncKey is similar to LoadOptionalConfigString, except that it accepts an optional decryption key.

func LoadOptionalConfigURL

func LoadOptionalConfigURL(confReader *config.Config, group, field string, defaultValue *url.URL) *url.URL

Types

type Config

type Config struct {
	PIDFilename         string
	DataCenter          string
	BPFDir              string
	BPFLogDir           string
	MinKernelMajorVer   int
	MinKernelMinorVer   int
	EBPFRepoURL         string
	HttpClientTimeout   time.Duration
	MaxEBPFReStartCount int
	Environment         string
	BpfMapDefaultPath   string
	// Flag to enable chaining with root program
	BpfChainingEnabled bool

	// stats
	// Prometheus endpoint for pull/scrape the metrics.
	MetricsAddr      string
	EBPFPollInterval time.Duration
	NMetricSamples   int

	ShutdownTimeout time.Duration

	SwaggerApiEnabled bool

	// XDP Root program details.
	XDPRootPackageName       string
	XDPRootArtifact          string
	XDPRootMapName           string
	XDPRootCommand           string
	XDPRootVersion           string
	XDPRootObjectFile        string
	XDPRootEntryFunctionName string

	// TC Root program details.
	TCRootPackageName              string
	TCRootArtifact                 string
	TCRootIngressMapName           string
	TCRootEgressMapName            string
	TCRootCommand                  string
	TCRootVersion                  string
	TCRootIngressObjectFile        string
	TCRootEgressObjectFile         string
	TCRootIngressEntryFunctionName string
	TCRootEgressEntryFunctionName  string

	// ebpf chain details
	EBPFChainDebugAddr    string
	EBPFChainDebugEnabled bool

	// l3af configs to listen addrs
	L3afConfigsRestAPIAddr string

	// l3af config store
	L3afConfigStoreFileName string

	// mTLS
	MTLSEnabled               bool
	MTLSMinVersion            uint16
	MTLSCertDir               string
	MTLSCACertFilename        string
	MTLSServerCertFilename    string
	MTLSServerKeyFilename     string
	MTLSCertExpiryWarningDays int
	MTLSSANMatchRules         []string
}

func ReadConfig

func ReadConfig(configPath string) (*Config, error)

ReadConfig - Initializes configuration from file

Jump to

Keyboard shortcuts

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