limiter

package
v0.0.0-...-c18a219 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorTooManyRequests = web.NewError(http.StatusTooManyRequests)

Functions

func HandlerName

func HandlerName(ctx web.Context) string

func IP

func IP(ctx web.Context) string

Types

type AutoLimiter

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

func NewAuto

func NewAuto(store limiter.Store, opts ...Option) *AutoLimiter

func (*AutoLimiter) Apply

func (al *AutoLimiter) Apply(next web.HandlerFunc) web.HandlerFunc

type Keyer

type Keyer func(ctx web.Context) string

type Option

type Option func(*Options)

func Key

func Key(k Keyer) Option

type Options

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

type SimpleLimiter

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

func NewSimple

func NewSimple(store limiter.Store, period time.Duration, count int64, opts ...Option) *SimpleLimiter

func (*SimpleLimiter) Apply

func (sl *SimpleLimiter) Apply(next web.HandlerFunc) web.HandlerFunc

Jump to

Keyboard shortcuts

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