config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(cfg *Config) error

Validate checks if the configuration is valid

Types

type CircuitBreakerConfig

type CircuitBreakerConfig struct {
	FailureThreshold int           `yaml:"failure_threshold"`
	Timeout          time.Duration `yaml:"timeout"`
}

CircuitBreakerConfig defines circuit breaker settings

type Config

type Config struct {
	AgentID  string `yaml:"agent_id"`
	Hostname string `yaml:"hostname"`

	ControlServer ControlServerConfig `yaml:"control_server"`
	TLS           TLSConfig           `yaml:"tls"`
	Ocserv        OcservConfig        `yaml:"ocserv"`
	Health        HealthConfig        `yaml:"health"`
	Telemetry     TelemetryConfig     `yaml:"telemetry"`
	Logging       LoggingConfig       `yaml:"logging"`
	Security      SecurityConfig      `yaml:"security"`
}

Config represents the complete agent configuration

func Load

func Load(path string) (*Config, error)

Load reads configuration from a YAML file and applies environment variable overrides

type ControlServerConfig

type ControlServerConfig struct {
	Address        string               `yaml:"address"`
	Reconnect      ReconnectConfig      `yaml:"reconnect"`
	CircuitBreaker CircuitBreakerConfig `yaml:"circuit_breaker"`
}

ControlServerConfig defines connection settings to control server

type HealthConfig

type HealthConfig struct {
	HeartbeatInterval time.Duration `yaml:"heartbeat_interval"`
	DeepCheckInterval time.Duration `yaml:"deep_check_interval"`
	MetricsInterval   time.Duration `yaml:"metrics_interval"`
}

HealthConfig defines health check intervals

type LoggingConfig

type LoggingConfig struct {
	Level      string `yaml:"level"`
	Format     string `yaml:"format"`
	Output     string `yaml:"output"`
	FilePath   string `yaml:"file_path"`
	MaxSizeMB  int    `yaml:"max_size_mb"`
	MaxBackups int    `yaml:"max_backups"`
	MaxAgeDays int    `yaml:"max_age_days"`
}

LoggingConfig defines logging behavior

type OcservConfig

type OcservConfig struct {
	ConfigPath        string `yaml:"config_path"`
	ConfigPerUserDir  string `yaml:"config_per_user_dir"`
	ConfigPerGroupDir string `yaml:"config_per_group_dir"`
	CtlSocket         string `yaml:"ctl_socket"`
	SystemdService    string `yaml:"systemd_service"`
	BackupDir         string `yaml:"backup_dir"`
}

OcservConfig defines ocserv paths and settings

type ReconnectConfig

type ReconnectConfig struct {
	InitialDelay time.Duration `yaml:"initial_delay"`
	MaxDelay     time.Duration `yaml:"max_delay"`
	Multiplier   float64       `yaml:"multiplier"`
	MaxAttempts  int           `yaml:"max_attempts"`
}

ReconnectConfig defines reconnection behavior

type SecurityConfig

type SecurityConfig struct {
	AllowedCommands   []string      `yaml:"allowed_commands"`
	SudoUser          string        `yaml:"sudo_user"`
	MaxCommandTimeout time.Duration `yaml:"max_command_timeout"`
}

SecurityConfig defines security constraints

type TLSConfig

type TLSConfig struct {
	Enabled      bool   `yaml:"enabled"`
	AutoGenerate bool   `yaml:"auto_generate"` // Auto-generate self-signed certs if missing
	CertFile     string `yaml:"cert_file"`
	KeyFile      string `yaml:"key_file"`
	CAFile       string `yaml:"ca_file"`
	ServerName   string `yaml:"server_name"`
	MinVersion   string `yaml:"min_version"`
}

TLSConfig defines mTLS configuration

type TelemetryConfig

type TelemetryConfig struct {
	Enabled        bool    `yaml:"enabled"`
	Endpoint       string  `yaml:"endpoint"`
	ServiceName    string  `yaml:"service_name"`
	ServiceVersion string  `yaml:"service_version"`
	SampleRate     float64 `yaml:"sample_rate"`
}

TelemetryConfig defines OpenTelemetry settings

Jump to

Keyboard shortcuts

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