middleware

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrivateIPAddressRegex = regexp.MustCompile(`(10(?:\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$)|(192\\.168(?:\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){2}$)|(172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){2}$)`)

PrivateIPAddressRegex for detects a valid IP address

Functions

func AsynqTaskTracerMiddleware added in v1.12.0

func AsynqTaskTracerMiddleware(h asynq.Handler) asynq.Handler

AsynqTaskTracerMiddleware tracer for asynq task, place this middleware on mux

Types

type RedisIPRateLimiter

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

RedisIPRateLimiter is the redis store that implements IP Based rate limiter

func NewRedisIPRateLimiter

func NewRedisIPRateLimiter(redisClient *redis.Client, rate limiter.Rate, excludedIPs []string, excludedUserAgents []string) (redisLimiter RedisIPRateLimiter, err error)

NewRedisIPRateLimiter initializes RedisIPRateLimiter

func (RedisIPRateLimiter) Limit

func (r RedisIPRateLimiter) Limit() echo.MiddlewareFunc

Limit limit request by IP

Jump to

Keyboard shortcuts

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