ratelimiter

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(configFn ConfigFunc) goyave.Middleware

New initializes new a rate limiter middleware

Types

type Config

type Config struct {
	// Unique identifier for requestors. Can be userID or IP
	// Defaults to Remote Address if it is empty
	ClientID interface{}

	// Duration or time taken until the quota expires and renews
	QuotaDuration time.Duration

	// Maximum number of requests in a client can send
	RequestQuota int
}

Config for setting configuration for the limiter middleware

type ConfigFunc

type ConfigFunc func(request *goyave.Request) Config

ConfigFunc acts as a factory for Config structs

Jump to

Keyboard shortcuts

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