botdetector

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

krakend-botdetector

A bot detector middleware for the KrakenD framework

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Denylist  []string
	Allowlist []string
	Patterns  []string
	CacheSize int
}

Config defines the behaviour of the detector

type Detector

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

Detector is a struct able to detect bot-made requests

func NewDetector

func NewDetector(cfg Config) (*Detector, error)

NewDetector creates a Detector

func (*Detector) IsBot

func (d *Detector) IsBot(r *http.Request) bool

IsBot returns true if the request was made by a bot

type DetectorFunc

type DetectorFunc func(r *http.Request) bool

DetectorFunc is a func that chek if a request was made by a bot

func New

func New(cfg Config) (DetectorFunc, error)

New returns a detector function with or without LRU cache depending on the params

type LRUDetector

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

LRUDetector is a struct able to detect bot-made requests and cache the results for future reutilization

func NewLRU

func NewLRU(cfg Config) (*LRUDetector, error)

NewLRU creates a new LRUDetector

func (*LRUDetector) IsBot

func (d *LRUDetector) IsBot(r *http.Request) bool

IsBot returns true if the request was made by a bot

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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