limiter

package
v0.0.0-...-b40c837 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

type LimiterBicketRule

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

type LimiterIface

type LimiterIface interface {
	Key(c *gin.Context) string
	GetBucket(key string) (*ratelimit.Bucket, bool)
	AddBuckets(rules ...LimiterBicketRule) LimiterIface
}

func NewMethodLimiter

func NewMethodLimiter() LimiterIface

type MethodLimiter

type MethodLimiter struct {
	LimiterIface
	*Limiter
}

func (MethodLimiter) AddBuckets

func (l MethodLimiter) AddBuckets(rules ...LimiterBicketRule) LimiterIface

func (MethodLimiter) GetBucket

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

func (MethodLimiter) Key

func (l MethodLimiter) Key(c *gin.Context) string

Jump to

Keyboard shortcuts

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