limiter

package
v0.0.0-...-7cf99fd Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketRule

type BucketRule struct {
	Key          string
	FillInterval time.Duration
	Capacity     int64
	Quantum      int64
}

type ILimiter

type ILimiter interface {
	Key(ctx *gin.Context) string
	GetBucket(key string) (*ratelimit.Bucket, bool)
	AddBuckets(rules ...BucketRule) ILimiter
}

func NewMethodLimiter

func NewMethodLimiter() ILimiter

type Limiter

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

type MethodLimiter

type MethodLimiter struct {
	*Limiter
}

func (MethodLimiter) AddBuckets

func (m MethodLimiter) AddBuckets(rules ...BucketRule) ILimiter

func (MethodLimiter) GetBucket

func (m MethodLimiter) GetBucket(key string) (*ratelimit.Bucket, bool)

func (MethodLimiter) Key

func (m MethodLimiter) Key(ctx *gin.Context) string

Jump to

Keyboard shortcuts

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