ratelimit

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitOpts

type LimitOpts struct {
	Strategy func(c *gin.Context) string
	Fallback func(c *gin.Context)
}

func Apply

func Apply(opts []Option) *LimitOpts

Apply applies the option to limiter

type Limiter

type Limiter interface {
	Allow(context.Context, string) bool
}

type Option

type Option func(*LimitOpts)

func WithFallback

func WithFallback(fallback func(c *gin.Context)) Option

WithFallback set the fallback handler when request is blocked

func WithResourceStrategy

func WithResourceStrategy(strategy func(c *gin.Context) string) Option

WithResourceStrategy set the verify path extract strategy of request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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