ratelimitedconn

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter interface {
	Allow(n int) bool
}

type RateLimitedConn

type RateLimitedConn struct {
	net.Conn
	// contains filtered or unexported fields
}

TODO: would it make sense to merge this with the connRateLimiter?

func NewRateLimitedConn

func NewRateLimitedConn(conn net.Conn, bandwidthLimiter Limiter, logger commontypes.Logger) *RateLimitedConn

func (*RateLimitedConn) EnableRateLimiting

func (r *RateLimitedConn) EnableRateLimiting()

EnableRateLimiting is not thread-safe!

func (*RateLimitedConn) Read

func (r *RateLimitedConn) Read(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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