config

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackoffConfig

type BackoffConfig struct {
	InitialMs   int     `mapstructure:"initial_ms"`
	MaxMs       int     `mapstructure:"max_ms"`
	Multiplier  float64 `mapstructure:"multiplier"`
	MaxAttempts int     `mapstructure:"max_attempts"`
}

BackoffConfig controls retry/backoff behaviour.

type BrowserConfig

type BrowserConfig struct {
	Scroll          bool   `mapstructure:"scroll"`
	WaitForSelector string `mapstructure:"wait_for_selector"`
	TimeoutS        int    `mapstructure:"timeout_s"`
}

BrowserConfig holds headless-browser target settings.

type Config

type Config struct {
	Pacing         PacingConfig         `mapstructure:"pacing"`
	Limits         LimitsConfig         `mapstructure:"limits"`
	RateLimits     RateLimitsConfig     `mapstructure:"rate_limits"`
	Backoff        BackoffConfig        `mapstructure:"backoff"`
	Targets        []TargetConfig       `mapstructure:"targets"`
	TargetsFile    string               `mapstructure:"targets_file"`
	TargetDefaults TargetDefaultsConfig `mapstructure:"target_defaults"`
	Output         OutputConfig         `mapstructure:"output"`
	Metrics        MetricsConfig        `mapstructure:"metrics"`
	Daemon         DaemonConfig         `mapstructure:"daemon"`
}

Config is the root configuration structure.

func Load

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

Load reads the YAML config at path, applies defaults, and validates.

type DNSConfig

type DNSConfig struct {
	Resolver   string `mapstructure:"resolver"`
	RecordType string `mapstructure:"record_type"`
}

DNSConfig holds DNS resolver target settings.

type DaemonConfig

type DaemonConfig struct {
	PIDFile   string `mapstructure:"pid_file"`
	LogLevel  string `mapstructure:"log_level"`
	LogFormat string `mapstructure:"log_format"`
}

DaemonConfig holds daemon/process settings.

type DomainRateLimit

type DomainRateLimit struct {
	Domain string  `mapstructure:"domain"`
	RPS    float64 `mapstructure:"rps"`
}

DomainRateLimit specifies a per-domain requests-per-second limit.

type HTTPConfig

type HTTPConfig struct {
	Method   string            `mapstructure:"method"`
	Headers  map[string]string `mapstructure:"headers"`
	Body     string            `mapstructure:"body"`
	TimeoutS int               `mapstructure:"timeout_s"`
}

HTTPConfig holds HTTP-specific target settings.

type LimitsConfig

type LimitsConfig struct {
	MaxWorkers        int     `mapstructure:"max_workers"`
	MaxBrowserWorkers int     `mapstructure:"max_browser_workers"`
	CPUThresholdPct   float64 `mapstructure:"cpu_threshold_pct"`
	MemoryThresholdMB uint64  `mapstructure:"memory_threshold_mb"`
}

LimitsConfig controls concurrency and resource thresholds.

type MetricsConfig

type MetricsConfig struct {
	Enabled        bool `mapstructure:"enabled"`
	PrometheusPort int  `mapstructure:"prometheus_port"`
}

MetricsConfig controls Prometheus metrics exposition.

type OutputConfig

type OutputConfig struct {
	Enabled bool   `mapstructure:"enabled"`
	File    string `mapstructure:"file"`
	Format  string `mapstructure:"format"` // jsonl | csv
	Append  bool   `mapstructure:"append"`
}

OutputConfig controls writing request results to a file.

type PacingConfig

type PacingConfig struct {
	Mode              string          `mapstructure:"mode"` // human | rate_limited | scheduled
	RequestsPerMinute float64         `mapstructure:"requests_per_minute"`
	JitterFactor      float64         `mapstructure:"jitter_factor"`
	MinDelayMs        int             `mapstructure:"min_delay_ms"`
	MaxDelayMs        int             `mapstructure:"max_delay_ms"`
	Schedule          []ScheduleEntry `mapstructure:"schedule"`
}

PacingConfig controls how requests are spaced in time.

type RateLimitsConfig

type RateLimitsConfig struct {
	DefaultRPS float64           `mapstructure:"default_rps"`
	PerDomain  []DomainRateLimit `mapstructure:"per_domain"`
}

RateLimitsConfig holds global and per-domain rate limits.

type ScheduleEntry

type ScheduleEntry struct {
	Cron              string  `mapstructure:"cron"`
	DurationMinutes   int     `mapstructure:"duration_minutes"`
	RequestsPerMinute float64 `mapstructure:"requests_per_minute"`
}

ScheduleEntry defines a cron-based active window with its own RPM.

type TargetConfig

type TargetConfig struct {
	URL       string          `mapstructure:"url"`
	Weight    int             `mapstructure:"weight"`
	Type      string          `mapstructure:"type"` // http | browser | dns | websocket
	HTTP      HTTPConfig      `mapstructure:"http"`
	Browser   BrowserConfig   `mapstructure:"browser"`
	DNS       DNSConfig       `mapstructure:"dns"`
	WebSocket WebSocketConfig `mapstructure:"websocket"`
}

TargetConfig describes a single request target.

type TargetDefaultsConfig

type TargetDefaultsConfig struct {
	Weight    int             `mapstructure:"weight"`
	HTTP      HTTPConfig      `mapstructure:"http"`
	Browser   BrowserConfig   `mapstructure:"browser"`
	DNS       DNSConfig       `mapstructure:"dns"`
	WebSocket WebSocketConfig `mapstructure:"websocket"`
}

TargetDefaultsConfig holds fallback values applied to every target loaded from targets_file. Fields left at their zero value fall through to each driver's own built-in defaults.

type WebSocketConfig

type WebSocketConfig struct {
	DurationS      int      `mapstructure:"duration_s"`
	SendMessages   []string `mapstructure:"send_messages"`
	ExpectMessages int      `mapstructure:"expect_messages"`
}

WebSocketConfig holds WebSocket target settings.

Jump to

Keyboard shortcuts

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