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
Click to show internal directories.
Click to hide internal directories.