ratelimit

package
v0.0.0-...-40ef913 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadSeeker

func ReadSeeker(rs io.ReadSeeker, l *Limiter) io.ReadSeeker

ReadSeeker 返回一个带有Limiter的io.ReadSeeker

func Reader

func Reader(r io.Reader, l *Limiter) io.Reader

Reader 返回一个带有Limiter的io.Reader

func Writer

func Writer(w io.Writer, l *Limiter) io.Writer

Writer 返回一个带有Limiter的io.Writer

Types

type Limiter

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

Limiter 速度限制器

func New

func New(rate int64) *Limiter

New New rate 速度,rate/每秒

func (*Limiter) Wait

func (l *Limiter) Wait(count int)

Wait 传入需要处理的数量,计算并等待需要经过的时间

Jump to

Keyboard shortcuts

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