app

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUserAgent        = "go-loader"
	DefaultIPSourceHeader   = `X-Forwarded-For`
	DefaultPortSourceHeader = `X-Forwarded-Port`
	DefaultSessionLength    = 35
)

global constants for file

Variables

View Source
var (
	DefaultEndpointList = []string{"/"}
)

Functions

This section is empty.

Types

type Visitor

type Visitor struct {
	sync.Mutex

	// IPSourceHeader is the header to use for the IP address. Defaults to `X-Forwarded-For`
	IPSourceHeader string `json:"ip_source_header" mapstructure:"IP_SOURCE_HEADER"`
	// PortSourceHeader is the header to use for the port. Defaults to `X-Forwarded-Port`
	PortSourceHeader string `json:"port_source_header" mapstructure:"PORT_SOURCE_HEADER"`
	// SessionLength is the number of requests to make before ending the session
	SessionLength int `json:"session_length" mapstructure:"SESSION_LENGTH"`
	// TargetScheme is the scheme for URL to send the request to
	TargetScheme string `json:"target_scheme" mapstructure:"TARGET_SCHEME"`
	// TargetHost is the host for URL to send the request to
	TargetHost string `json:"target_host" mapstructure:"TARGET_HOST"`
	// Endpoints is the wordlist for the endpoint.
	Endpoints []string `json:"endpoint_wordlist" mapstructure:"ENDPOINTS"`
	// contains filtered or unexported fields
}

Visitor keeps track of the configuration for a visitor.

func NewVisitor

func NewVisitor() *Visitor

func (*Visitor) AddHeader

func (v *Visitor) AddHeader(key, value string)

AddHeader a value to given header for the visitor

func (*Visitor) Ip

func (v *Visitor) Ip() ip.IPv4

Ip getter for mock ipv4 address of the visitor

func (*Visitor) Run

func (v *Visitor) Run(ctx context.Context) error

Run starts making requests to the target host.

func (*Visitor) SetHeader

func (v *Visitor) SetHeader(key, value string)

SetHeader a header for the visitor

func (*Visitor) SetIp

func (v *Visitor) SetIp(ip ip.IPv4)

SetIp setter for mock ipv4 address of the visitor. see ip/ipv4.go

func (*Visitor) SetRequestWaitDistribution

func (v *Visitor) SetRequestWaitDistribution(requestWaitDistribution distuv.LogNormal)

SetRequestWaitDistribution is how long it takes for a visitor to make a request, or the distribution of the time the visitor sleeps between requests. Must return a positive value. Values less than or equal to 0 will be set to 1.

Jump to

Keyboard shortcuts

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