limitMiddleware

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PerDuration

func PerDuration(rate int, duration time.Duration) redis_rate.Limit

Types

type LimitMiddleware

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

func New

func New(rdb redis.UniversalClient, opt *Option) *LimitMiddleware

func (*LimitMiddleware) LimitMiddleware

func (l *LimitMiddleware) LimitMiddleware(optChain ...*Option) gin.HandlerFunc

type Option

type Option struct {
	Prefix                string
	Rate                  int
	Duration              time.Duration
	NoUidDistinguishable  bool // 是否不区分 uid  默认区分
	HeaderDistinguishable bool // 是否区分 header 默认不区分
}

Jump to

Keyboard shortcuts

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