internal

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackHouseT

type BlackHouseT struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewBlackHouseT

func NewBlackHouseT() *BlackHouseT

func (*BlackHouseT) AddBlack

func (b *BlackHouseT) AddBlack(ipInt uint32, blackDuration time.Duration)

func (*BlackHouseT) IsBlack

func (b *BlackHouseT) IsBlack(ipInt uint32) (ok bool)

func (*BlackHouseT) List

func (b *BlackHouseT) List() (ipList []string)

type IPRateLimiterT

type IPRateLimiterT struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewIPRateLimiter

func NewIPRateLimiter(rateSpeed int, bucketLen int, blackTimes int, intervalSecond int) *IPRateLimiterT

func (*IPRateLimiterT) BlackAllow

func (i *IPRateLimiterT) BlackAllow(ipInt uint32) bool

func (*IPRateLimiterT) IPAllow

func (i *IPRateLimiterT) IPAllow(ipInt uint32) bool

func (*IPRateLimiterT) Len

func (i *IPRateLimiterT) Len() int

func (*IPRateLimiterT) SetParam

func (i *IPRateLimiterT) SetParam(rateSpeed int, bucketLen int, blackTimes int, intervalSecond int)

type WaitT

type WaitT struct {
	Conn           net.Conn
	IPInt          uint32
	TimerAfterFunc *time.Timer
}

func (*WaitT) Stop

func (w *WaitT) Stop()

type WhiteIPT

type WhiteIPT struct {
	IPInts map[uint32]struct{}
	sync.RWMutex
}

func NewWhiteIPT

func NewWhiteIPT() *WhiteIPT

func (*WhiteIPT) Add

func (w *WhiteIPT) Add(ipInts ...uint32)

func (*WhiteIPT) IsWhite

func (w *WhiteIPT) IsWhite(ipInt uint32) (ok bool)

func (*WhiteIPT) List

func (w *WhiteIPT) List() (ipList []string)

Jump to

Keyboard shortcuts

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