ratelimit

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

func NewLimiter

func NewLimiter(maxPerTTL float64, ttl time.Duration, opts ...Option) *Limiter

func (*Limiter) LimitByKeysAndReturn

func (l *Limiter) LimitByKeysAndReturn(keys []string) (*errors.HTTPError, int, int64)

func (*Limiter) LimitByRequest

func (l *Limiter) LimitByRequest(w http.ResponseWriter, r *http.Request) *errors.HTTPError

func (*Limiter) LimitReached

func (l *Limiter) LimitReached(key string) (bool, float64, int64)

func (*Limiter) Middleware

func (l *Limiter) Middleware() gin.HandlerFunc

type Option

type Option func(*Limiter)

func WithIPHeaderKey

func WithIPHeaderKey(k string) Option

Jump to

Keyboard shortcuts

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