limiter

package
v1.7.12 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(allowed uint64, overflow ...func(c *znet.Context)) znet.HandlerFunc

New Newlimiter

Types

type Rule added in v1.1.17

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

Rule user access control strategy

func NewRule added in v1.1.17

func NewRule() *Rule

NewRule Custom limiter rule

func (*Rule) AddRule added in v1.1.17

func (r *Rule) AddRule(exp time.Duration, allowed int, estimated ...int)

AddRule increase user access control strategy If less than 1s, please use golang.org/x/time/rate

func (*Rule) AllowVisit added in v1.1.17

func (r *Rule) AllowVisit(keys ...interface{}) bool

AllowVisit Is access allowed

func (*Rule) AllowVisitByIP added in v1.1.17

func (r *Rule) AllowVisitByIP(ip string) bool

AllowVisitByIP AllowVisit IP

func (*Rule) GetOnline added in v1.1.17

func (r *Rule) GetOnline() []string

GetOnline Get all current online users

func (*Rule) Remaining added in v1.1.17

func (r *Rule) Remaining(key interface{}) []int

Remaining Remaining visits

func (*Rule) RemainingVisitsByIP added in v1.1.17

func (r *Rule) RemainingVisitsByIP(ip string) []int

RemainingVisitsByIP Remaining Visits IP

Jump to

Keyboard shortcuts

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