config

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppConfig holds the parsed configuration.
	AppConfig Config
	Version   = "1.10.0"

	ErrInvalidConfig = errors.New("invalid configuration")
	URLPathRegex     = regexp.MustCompile(`^(/[a-zA-Z0-9\-._]+)+$`)
	URLRegex         = regexp.MustCompile(`^https?://[a-zA-Z0-9\-._]+(:[0-9]+)?(/[a-zA-Z0-9\-._]+)*/?$`)
)

Functions

func ValidateConfig added in v1.9.0

func ValidateConfig(configPath string) error

ValidateConfig validates the config file and returns an error if the config is invalid.

Types

type BufferSizes added in v1.8.0

type BufferSizes struct {
	Websocket        int `mapstructure:"websocket"`
	CTLog            int `mapstructure:"ctlog"`
	BroadcastManager int `mapstructure:"broadcastmanager"`
	Dispatcher       int `mapstructure:"dispatcher"`
}

func (*BufferSizes) Valid added in v1.10.0

func (b *BufferSizes) Valid() bool

type Compression added in v1.10.0

type Compression string

Compression represents the compression type for stream processing.

const (
	CompressionNone    Compression = "none"
	CompressionGzip    Compression = "gzip"
	CompressionSnappy  Compression = "snappy"
	CompressionZstd    Compression = "zstd"
	CompressionLz4     Compression = "lz4"
	CompressionDeflate Compression = "deflate"
)

func (Compression) SupportedBy added in v1.10.0

func (c Compression) SupportedBy(t StreamProcessorType) bool

SupportedBy returns true if the compression type is supported by the stream processing tool.

func (Compression) Valid added in v1.10.0

func (c Compression) Valid() bool

Valid returns true if the compression type is valid.

type Config

type Config struct {
	Webserver        Webserver
	Prometheus       Prometheus
	StreamProcessing []StreamProcessor `mapstructure:"stream_processing"`
	General          General
}

func ReadConfig

func ReadConfig(configPath string) (Config, error)

ReadConfig reads the configuration using Viper and returns a filled Config struct. It also validates and stores the result in AppConfig.

type General added in v1.10.0

type General struct {
	// DisableDefaultLogs indicates whether the default logs used in Google Chrome and provided by Google should be disabled.
	DisableDefaultLogs bool `mapstructure:"disable_default_logs"`
	// AdditionalLogs contains additional logs provided by the user that can be used in addition to the default logs.
	AdditionalLogs      []LogConfig `mapstructure:"additional_logs"`
	AdditionalTiledLogs []LogConfig `mapstructure:"additional_tiled_logs"`
	ExcludedLogs        []LogConfig `mapstructure:"excluded_logs"`
	// BufferSizes contains the buffer sizes for the different components of the server. They usually don't need any adjustments.
	BufferSizes BufferSizes `mapstructure:"buffer_sizes"`
	// DropOldLogs indicates whether downloading CT-Logs should start at the latest index (true) or should from the beginning (false).
	DropOldLogs *bool `mapstructure:"drop_old_logs"`
	Recovery    struct {
		Enabled     bool   `mapstructure:"enabled"`
		CTIndexFile string `mapstructure:"ct_index_file"`
	} `mapstructure:"recovery"`
}

func (*General) Valid added in v1.10.0

func (g *General) Valid() bool

type LogConfig added in v1.8.0

type LogConfig struct {
	Operator    string `mapstructure:"operator"`
	URL         string `mapstructure:"url"`
	Description string `mapstructure:"description"`
}

type Prometheus added in v1.10.0

type Prometheus struct {
	ServerConfig `mapstructure:",squash"`

	Enabled             bool   `mapstructure:"enabled"`
	MetricsURL          string `mapstructure:"metrics_url"`
	ExposeSystemMetrics bool   `mapstructure:"expose_system_metrics"`
}

func (*Prometheus) Valid added in v1.10.0

func (p *Prometheus) Valid() bool

type ServerConfig added in v1.4.0

type ServerConfig struct {
	ListenAddr     string   `mapstructure:"listen_addr"`
	ListenPort     int      `mapstructure:"listen_port"`
	CertPath       string   `mapstructure:"cert_path"`
	CertKeyPath    string   `mapstructure:"cert_key_path"`
	RealIP         bool     `mapstructure:"real_ip"`
	TrustedProxies []string `mapstructure:"trusted_proxies"`
	Whitelist      []string `mapstructure:"whitelist"`
}

type StreamProcessor added in v1.10.0

type StreamProcessor struct {
	Name        string              `mapstructure:"name"`
	Type        StreamProcessorType `mapstructure:"type"`
	Stream      StreamType          `mapstructure:"stream"`
	Enabled     *bool               `mapstructure:"enabled"`
	ServerAddr  string              `mapstructure:"server_addr"`
	ServerPort  int                 `mapstructure:"server_port"`
	Topic       string              `mapstructure:"topic"`
	Compression Compression         `mapstructure:"compression"`
}

func (*StreamProcessor) Valid added in v1.10.0

func (s *StreamProcessor) Valid() bool

type StreamProcessorType added in v1.10.0

type StreamProcessorType string

StreamProcessorType represents the type of stream processing tool to use. Supported types are "kafka" and "nqs".

const (
	StreamProcessorTypeKafka StreamProcessorType = "kafka"
	StreamProcessorTypeNQS   StreamProcessorType = "nqs"
)

type StreamType added in v1.10.0

type StreamType string

StreamType represents the type of stream to process. Supported types are "full", "lite", and "domains-only".

const (
	StreamTypeFull        StreamType = "full"
	StreamTypeLite        StreamType = "lite"
	StreamTypeDomainsOnly StreamType = "domains-only"
)

type Webserver added in v1.10.0

type Webserver struct {
	ServerConfig `mapstructure:",squash"`

	FullURL            string `mapstructure:"full_url"`
	LiteURL            string `mapstructure:"lite_url"`
	DomainsOnlyURL     string `mapstructure:"domains_only_url"`
	CompressionEnabled bool   `mapstructure:"compression_enabled"`
}

func (*Webserver) Valid added in v1.10.0

func (w *Webserver) Valid() bool

Jump to

Keyboard shortcuts

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