config

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 8 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 AuthConfig added in v1.2.0

type AuthConfig struct {
	Type        string `mapstructure:"type"`      // bearer | basic | header | query
	Token       string `mapstructure:"token"`     // literal token value
	TokenEnv    string `mapstructure:"token_env"` // env var holding the token
	Username    string `mapstructure:"username"`
	UsernameEnv string `mapstructure:"username_env"`
	Password    string `mapstructure:"password"`
	PasswordEnv string `mapstructure:"password_env"`
	HeaderName  string `mapstructure:"header_name"` // required for type: header
	ParamName   string `mapstructure:"param_name"`  // required for type: query
}

AuthConfig defines optional authentication applied to a target request. Supported types: bearer, basic, header, query. Token values can be supplied as literals (token/username/password) or resolved at dispatch time from environment variables (token_env etc.).

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 GRPCConfig added in v1.1.0

type GRPCConfig struct {
	Body     string `mapstructure:"body"`      // JSON-encoded request body (unmarshalled via reflection)
	TimeoutS int    `mapstructure:"timeout_s"` // per-call timeout in seconds (default 15)
	TLS      bool   `mapstructure:"tls"`       // force TLS even when scheme is grpc://
	Insecure bool   `mapstructure:"insecure"`  // skip TLS certificate verification
}

GRPCConfig holds gRPC target settings. The URL scheme selects TLS: grpc:// for plaintext, grpcs:// for TLS. The cfg.TLS field can also force TLS regardless of scheme.

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"`
	PCAPFile string `mapstructure:"pcap_file"` // write synthetic PCAP alongside normal output
}

OutputConfig controls writing request results to a file.

type PacingConfig

type PacingConfig struct {
	Mode              string          `mapstructure:"mode"` // human | rate_limited | scheduled | burst
	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"`
	// RampUpS is the number of seconds over which burst mode linearly
	// increases from a throttled start to full-speed dispatch. Only used
	// when Mode is "burst". 0 means no ramp-up (immediate full speed).
	RampUpS int `mapstructure:"ramp_up_s"`
}

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 | grpc
	Auth      AuthConfig      `mapstructure:"auth"`
	HTTP      HTTPConfig      `mapstructure:"http"`
	Browser   BrowserConfig   `mapstructure:"browser"`
	DNS       DNSConfig       `mapstructure:"dns"`
	WebSocket WebSocketConfig `mapstructure:"websocket"`
	GRPC      GRPCConfig      `mapstructure:"grpc"`
}

TargetConfig describes a single request target.

type TargetDefaultsConfig

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

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