testutil

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyByHost

func KeyByHost(r *http.Request) (string, error)

Types

type Limiter

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

func NewLimiter

func NewLimiter(reqLimit int, keyFunc httprate.KeyFunc, statusCode int) *Limiter

func NewSkipper

func NewSkipper(hostname string) *Limiter

func (*Limiter) Name

func (l *Limiter) Name() string

func (*Limiter) OnRequestLimit

func (l *Limiter) OnRequestLimit(le *rl.Context) http.HandlerFunc

func (*Limiter) Rule

func (l *Limiter) Rule(r *http.Request) (*rl.Rule, error)

func (*Limiter) ShouldSetXRateLimitHeaders

func (l *Limiter) ShouldSetXRateLimitHeaders(le *rl.Context) bool

Jump to

Keyboard shortcuts

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