job

package
v0.8.29 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package job [contains all the attack types db1000n can simulate]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseConfig

func ParseConfig(c Config, args config.Args, global GlobalConfig) error

Types

type BasicJobConfig

type BasicJobConfig struct {
	IntervalMs int
	Interval   *time.Duration
	utils.Counter
	Backoff *utils.BackoffConfig
}

BasicJobConfig comment for linter

func (*BasicJobConfig) FromGlobal

func (c *BasicJobConfig) FromGlobal(global GlobalConfig)

func (BasicJobConfig) GetInterval

func (c BasicJobConfig) GetInterval() time.Duration

func (*BasicJobConfig) Next

func (c *BasicJobConfig) Next(ctx context.Context) bool

Next comment for linter

type Config

type Config interface {
	FromGlobal(GlobalConfig)
}

type ConfigOptions

type ConfigOptions struct {
	PathsCSV       string        // Comma-separated config location URLs
	BackupConfig   string        // Raw backup config
	Format         string        // json or yaml
	RefreshTimeout time.Duration // How often to refresh config
}

ConfigOptions for fetching job configs for the runner

func NewConfigOptionsWithFlags

func NewConfigOptionsWithFlags() *ConfigOptions

NewConfigOptionsWithFlags returns ConfigOptions initialized with command line flags.

type GlobalConfig

type GlobalConfig struct {
	ClientID string

	ProxyURLs           string
	SkipEncrypted       bool
	EnablePrimitiveJobs bool
	ScaleFactor         int
	MinInterval         time.Duration
	Backoff             utils.BackoffConfig
}

GlobalConfig passes commandline arguments to every job.

func NewGlobalConfigWithFlags

func NewGlobalConfigWithFlags() *GlobalConfig

NewGlobalConfigWithFlags returns a GlobalConfig initialized with command line flags.

type Job

type Job = func(ctx context.Context, args config.Args, globalConfig *GlobalConfig, a *metrics.Accumulator, logger *zap.Logger) (data any, err error)

Job comment for linter

func Get

func Get(t string) Job

Get job by type name

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes jobs according to the (fetched from remote) configuration

func NewRunner

func NewRunner(cfgOptions *ConfigOptions, globalJobsCfg *GlobalConfig) *Runner

NewRunner according to the config

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, logger *zap.Logger)

Run the runner and block until Stop() is called

Directories

Path Synopsis
Package config [used for configuring the package]
Package config [used for configuring the package]

Jump to

Keyboard shortcuts

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