attackwave

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

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

Detector tracks suspicious requests per IP and reports attack waves

func NewDetector

func NewDetector(opts *Options) *Detector

func (*Detector) CheckRequest

func (d *Detector) CheckRequest(ctx *request.Context, statusCode int) bool

CheckRequest checks if the request is part of an attack wave Returns true if an attack wave is detected and should be reported

func (*Detector) GetSamplesForIP

func (d *Detector) GetSamplesForIP(ip string) []Sample

GetSamplesForIP returns the samples collected for the given IP

type Options

type Options struct {
	AttackWaveThreshold   int
	AttackWaveTimeFrame   time.Duration
	MinTimeBetweenReports time.Duration
	MaxSamplesPerIP       int
}

type Sample

type Sample struct {
	Method string `json:"method"`
	URL    string `json:"url"`
}

Sample represents a suspicious request sample with method and URL

Jump to

Keyboard shortcuts

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