ratelimit

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderReset     = "X-Ratelimit-Reset"
	HeaderLimit     = "X-Ratelimit-Limit"
	HeaderRemaining = "X-Ratelimit-Remaining"
)

Variables

This section is empty.

Functions

func New

func New(rdb *redis.Client, key KeyFunc, errFunc ErrFunc) gin.HandlerFunc

New creates a distributed rate limiter middleware using redis for state management.

Types

type ErrFunc

type ErrFunc func(*gin.Context, error) (shouldReturn bool)

type KeyFunc

type KeyFunc func(*gin.Context) (key string, limit *int, err error)

Jump to

Keyboard shortcuts

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