Documentation
¶
Overview ¶
Package ratelimit limits failed login attempts per client IP.
Index ¶
Constants ¶
View Source
const ( DefaultLimit = 10 DefaultWindow = time.Minute )
DefaultLimit and DefaultWindow cap login attempts per client IP.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware returns middleware that limits failed login attempts per client IP.
func ParseTrustedProxies ¶
ParseTrustedProxies parses a comma-separated list into trusted-proxy CIDR ranges.
Types ¶
type Config ¶
type Config struct {
// Limit caps failed attempts per client IP per Window. Zero applies DefaultLimit.
Limit int
// Window is the counting window. Zero applies DefaultWindow.
Window time.Duration
// TrustedProxies lists the CIDR ranges of reverse proxies permitted to
// set X-Forwarded-For.
TrustedProxies []string
}
Config parameterizes the limiter.
Click to show internal directories.
Click to hide internal directories.