rateio

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 3 Imported by: 14

Documentation

Overview

rate limit and traffic control

Index

Constants

This section is empty.

Variables

View Source
var Window = 50 * time.Millisecond

Functions

func NewRateReader

func NewRateReader(r io.Reader, ratePerSecond int) io.ReadCloser

func NewRateWriter

func NewRateWriter(w io.Writer, ratePerSecond int) io.WriteCloser

Types

type Controller

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

Controller can limit multiple io.Reader(or io.Writer) within specific rate.

func NewController

func NewController(ratePerSecond int) *Controller

func (*Controller) Close

func (self *Controller) Close() error

func (*Controller) GetRateLimit

func (self *Controller) GetRateLimit() int

func (*Controller) Reader

func (self *Controller) Reader(underlying io.Reader) io.Reader

func (*Controller) Writer

func (self *Controller) Writer(underlying io.Writer) io.Writer

Jump to

Keyboard shortcuts

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