bucket

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 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 Limiter

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

Limiter implements ratelimit.RateLimit interface by Token Bucket.

func NewLimiter

func NewLimiter(opts ...Option) *Limiter

func (*Limiter) Allow

func (b *Limiter) Allow(ctx *gin.Context) (func(), error)

type Option

type Option func(limiter *Limiter)

func WithBucket

func WithBucket(bucket *ratelimit.Bucket) Option

func WithMaxWait

func WithMaxWait(wait time.Duration) Option

Jump to

Keyboard shortcuts

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