middlewares

package
v0.0.0-...-410787f Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MiddlewareThrottling

func MiddlewareThrottling(t *Throttler) func(next http.Handler) http.Handler

Types

type Throttler

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

func NewThrottler

func NewThrottler(rps float64, cs int) *Throttler

NewThrottler sets: request per second num of concurent sessions

func (*Throttler) AddSession

func (t *Throttler) AddSession(ip string)

func (*Throttler) CloseSession

func (t *Throttler) CloseSession(ip string)

func (*Throttler) IsAllow

func (t *Throttler) IsAllow(ip string) bool

Jump to

Keyboard shortcuts

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