traefik_regex_block

package module
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 11 Imported by: 0

README

traefik-regex-block

Middleware plugin for Traefik to block IPs for a period of time, based on the URL matching a list of regex patterns.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

New creates a new instance of the RegexBlock.

Types

type Config

type Config struct {
	RegexPatterns        []string `json:"regexPatterns,omitempty"`
	BlockDurationMinutes int      `json:"blockDurationMinutes,omitempty"`
	Whitelist            []string `json:"whitelist,omitempty"`
	EnableDebug          bool     `json:"enableDebug,omitempty"`
}

Config defines the configuration options for the plugin.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates a default configuration for the plugin.

type RegexBlock

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

RegexBlock is a Traefik plugin that blocks requests matching certain regex patterns.

func (*RegexBlock) ServeHTTP

func (p *RegexBlock) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP intercepts the request and blocks it if it matches any of the configured regex patterns.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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