common

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Duration    *time.Duration
	Connections *int
	Timeout     *time.Duration
	Mode        *string
	OutputFile  *string
	Interval    *time.Duration
	Preallocate *int
	CPUs        *int
	Method      *string
	Body        *RawRequestBody
	Headers     *RequestHeaders
	TrustAll    *bool
	Format      *string
	Plugin      *string
	Target      *string
}

Config is a struct containing all of the parsed CLI flags and arguments

type GocannonPlugin

type GocannonPlugin interface {
	// function called on gocannon startup with a config passed to it
	Startup(cfg Config)
	// function called before each request is sent
	BeforeRequest(cid int) (target string, method string, body RawRequestBody, headers RequestHeaders)
	// function that returns the plugin's name
	GetName() string
}

GocannonPlugin is an interface that has to be satisfied by a custom gocannnon plugin

type RawRequestBody

type RawRequestBody []byte

func (*RawRequestBody) IsCumulative

func (b *RawRequestBody) IsCumulative() bool

func (*RawRequestBody) Set

func (b *RawRequestBody) Set(value string) error

func (*RawRequestBody) String

func (b *RawRequestBody) String() string

type RequestHeader

type RequestHeader struct {
	Key   string
	Value string
}

RequestHeader represents a single HTTP request header (a key: value pair)

type RequestHeaders

type RequestHeaders []RequestHeader

RequestHeaders is a slice of request headers that will be added to the request

func (*RequestHeaders) IsCumulative

func (r *RequestHeaders) IsCumulative() bool

func (*RequestHeaders) Set

func (r *RequestHeaders) Set(value string) error

func (*RequestHeaders) String

func (r *RequestHeaders) String() string

Jump to

Keyboard shortcuts

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