Versions in this module Expand all Collapse all v1 v1.0.2 Mar 22, 2023 Changes in this version + const DefaultConnections + const DefaultMaxBody + const DefaultMaxConnections + const DefaultMaxWorkers + const DefaultRedirects + const DefaultTimeout + const DefaultWorkers + const HTTPTargetFormat + const JSONTargetFormat + const MeanDown + const MeanUp + const NoFollow + const Peak + const Trough + var DefaultLocalAddr = net.IPAddr + var DefaultTLSConfig = &tls.Config + var ErrNilTarget = errors.New("nil target") + var ErrNoMethod = errors.New("target: required method is missing") + var ErrNoTargets = errors.New("no targets to attack") + var ErrNoURL = errors.New("target: required url is missing") + var TargetFormats = []string + func ChunkedBody(b bool) func(*Attacker) + func Client(c *http.Client) func(*Attacker) + func Connections(n int) func(*Attacker) + func H2C(enabled bool) func(*Attacker) + func HTTP2(enabled bool) func(*Attacker) + func KeepAlive(keepalive bool) func(*Attacker) + func LocalAddr(addr net.IPAddr) func(*Attacker) + func MaxBody(n int64) func(*Attacker) + func MaxConnections(n int) func(*Attacker) + func MaxWorkers(n uint64) func(*Attacker) + func Proxy(proxy func(*http.Request) (*url.URL, error)) func(*Attacker) + func ProxyHeader(h http.Header) func(*Attacker) + func Redirects(n int) func(*Attacker) + func TLSConfig(c *tls.Config) func(*Attacker) + func Timeout(d time.Duration) func(*Attacker) + func UnixSocket(socket string) func(*Attacker) + func Workers(n uint64) func(*Attacker) + type Attacker struct + func NewAttacker(opts ...func(*Attacker)) *Attacker + func (a *Attacker) Attack(tr Targeter, p Pacer, du time.Duration, name string) <-chan *Result + func (a *Attacker) Stop() + type Buckets []time.Duration + func (bs *Buckets) UnmarshalText(value []byte) error + func (bs Buckets) Nth(i int) (left, right string) + type ByteMetrics struct + Mean float64 + Total uint64 + type Closer interface + Close func() + type ConstantPacer struct + Freq int + Per time.Duration + func (cp ConstantPacer) Pace(elapsed time.Duration, hits uint64) (time.Duration, bool) + func (cp ConstantPacer) Rate(elapsed time.Duration) float64 + func (cp ConstantPacer) String() string + type Decoder func(*Result) error + func DecoderFor(r io.Reader) Decoder + func NewCSVDecoder(r io.Reader) Decoder + func NewDecoder(rd io.Reader) Decoder + func NewJSONDecoder(r io.Reader) Decoder + func NewRoundRobinDecoder(dec ...Decoder) Decoder + func (dec Decoder) Decode(r *Result) error + type DecoderFactory func(io.Reader) Decoder + type Encoder func(*Result) error + func NewCSVEncoder(w io.Writer) Encoder + func NewEncoder(r io.Writer) Encoder + func NewJSONEncoder(w io.Writer) Encoder + func (enc Encoder) Encode(r *Result) error + type Histogram struct + Buckets Buckets + Counts []uint64 + Total uint64 + func (h *Histogram) Add(r *Result) + func (h *Histogram) MarshalJSON() ([]byte, error) + type LatencyMetrics struct + Max time.Duration + Mean time.Duration + Min time.Duration + P50 time.Duration + P90 time.Duration + P95 time.Duration + P99 time.Duration + Total time.Duration + func (l *LatencyMetrics) Add(latency time.Duration) + func (l LatencyMetrics) Quantile(nth float64) time.Duration + type LinearPacer struct + Slope float64 + StartAt Rate + func (p LinearPacer) Pace(elapsed time.Duration, hits uint64) (time.Duration, bool) + func (p LinearPacer) Rate(elapsed time.Duration) float64 + type Metrics struct + BytesIn ByteMetrics + BytesOut ByteMetrics + Duration time.Duration + Earliest time.Time + End time.Time + Errors []string + Histogram *Histogram + Latencies LatencyMetrics + Latest time.Time + Rate float64 + Requests uint64 + StatusCodes map[string]int + Success float64 + Throughput float64 + Wait time.Duration + func (m *Metrics) Add(r *Result) + func (m *Metrics) Close() + type Pacer interface + Pace func(elapsed time.Duration, hits uint64) (wait time.Duration, stop bool) + Rate func(elapsed time.Duration) float64 + type PacerFunc func(time.Duration, uint64) (time.Duration, bool) + func (pf PacerFunc) Pace(elapsed time.Duration, hits uint64) (time.Duration, bool) + type Rate = ConstantPacer + type Report interface + Add func(*Result) + type Reporter func(io.Writer) error + func NewHDRHistogramPlotReporter(m *Metrics) Reporter + func NewHistogramReporter(h *Histogram) Reporter + func NewJSONReporter(m *Metrics) Reporter + func NewTextReporter(m *Metrics) Reporter + func (rep Reporter) Report(w io.Writer) error + type Result struct + Attack string + Body []byte + BytesIn uint64 + BytesOut uint64 + Code uint16 + Error string + Headers http.Header + Latency time.Duration + Method string + Seq uint64 + Timestamp time.Time + URL string + func (r *Result) End() time.Time + func (r Result) Equal(other Result) bool + type Results []Result + func (rs *Results) Add(r *Result) + func (rs *Results) Close() + func (rs Results) Len() int + func (rs Results) Less(i, j int) bool + func (rs Results) Swap(i, j int) + type SinePacer struct + Amp Rate + Mean Rate + Period time.Duration + StartAt float64 + func (sp SinePacer) Pace(elapsedTime time.Duration, elapsedHits uint64) (time.Duration, bool) + func (sp SinePacer) Rate(elapsed time.Duration) float64 + func (sp SinePacer) String() string + type Target struct + Body []byte + Header http.Header + Method string + URL string + func ReadAllTargets(t Targeter) (tgts []Target, err error) + func (t *Target) Equal(other *Target) bool + func (t *Target) Request() (*http.Request, error) + type TargetEncoder func(*Target) error + func NewJSONTargetEncoder(w io.Writer) TargetEncoder + func (enc TargetEncoder) Encode(t *Target) error + type Targeter func(*Target) error + func NewHTTPTargeter(src io.Reader, body []byte, hdr http.Header) Targeter + func NewJSONTargeter(src io.Reader, body []byte, header http.Header) Targeter + func NewStaticTargeter(tgts ...Target) Targeter + func (tr Targeter) Decode(t *Target) error