ipLimiter

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IpLimiter

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

IpLimiter ip限流器

var App IpLimiter

func (*IpLimiter) Affirm

func (r *IpLimiter) Affirm(ip string, t time.Duration, maxVisitTimes uint64) (*Visit, bool)

Affirm 检查限流

func (IpLimiter) New

func (IpLimiter) New() *IpLimiter

New 实例化:Ip 限流

type Visit

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

Visit 访问记录

func (*Visit) GetLastVisiter

func (r *Visit) GetLastVisiter() time.Time

GetLastVisiter 获取最后访问时间

func (*Visit) GetVisitTimes

func (r *Visit) GetVisitTimes() uint64

GetVisitTimes 获取窗口期内访问次数

Jump to

Keyboard shortcuts

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