firewall

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanSemaphore

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

Semaphore 限制同一时刻,最多可以发生的次数

func NewChanSemaphore

func NewChanSemaphore(cap int) *ChanSemaphore

NewChanSemaphore

func (*ChanSemaphore) Acquire

func (this *ChanSemaphore) Acquire()

func (*ChanSemaphore) Release

func (this *ChanSemaphore) Release()

type Semaphore

type Semaphore interface {
	// P wait()
	Acquire()

	// V signal()
	Release()
}

func NewSemaphore

func NewSemaphore(cap int) Semaphore

NewSemaphore

type SleepLimiter

type SleepLimiter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SleepLimiter 限制单位时间内的可执行次数

func NewSleepLimiter

func NewSleepLimiter(ttl time.Duration, limit int) *SleepLimiter

func (*SleepLimiter) Acquire

func (this *SleepLimiter) Acquire()

Jump to

Keyboard shortcuts

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