limitreader

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitReader

type LimitReader struct {
	Src     io.Reader
	Limiter *ratelimiter.RateLimiter
	// contains filtered or unexported fields
}

LimitReader read stream with RateLimiter.

func NewLimitReader

func NewLimitReader(src io.Reader, rate int, calculateMd5 bool) *LimitReader

NewLimitReader create LimitReader src: reader rate: bytes/second

func NewLimitReaderWithLimiter

func NewLimitReaderWithLimiter(rl *ratelimiter.RateLimiter, src io.Reader, calculateMd5 bool) *LimitReader

NewLimitReaderWithLimiter create LimitReader with a rateLimiter. src: reader rate: bytes/second

func NewLimitReaderWithLimiterAndMD5Sum

func NewLimitReaderWithLimiterAndMD5Sum(src io.Reader, rl *ratelimiter.RateLimiter, md5sum hash.Hash) *LimitReader

NewLimitReaderWithLimiterAndMD5Sum create LimitReader with rateLimiter and md5 sum. src: reader rate: bytes/second

func NewLimitReaderWithMD5Sum

func NewLimitReaderWithMD5Sum(src io.Reader, rate int, md5sum hash.Hash) *LimitReader

NewLimitReaderWithMD5Sum create LimitReader with a md5 sum. src: reader rate: bytes/second

func (*LimitReader) Md5

func (lr *LimitReader) Md5() string

Md5 calculate the md5 of all contents read

func (*LimitReader) Read

func (lr *LimitReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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