Version: v0.0.0-...-8b1022e Latest Latest

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0



package connlimit provides control over simultaneous connections coming from the same source



This section is empty.


This section is empty.


This section is empty.


type ConnErrHandler

type ConnErrHandler struct {

func (*ConnErrHandler) ServeHTTP

func (e *ConnErrHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, err error)

type ConnLimitOption

type ConnLimitOption func(l *ConnLimiter) error

func ErrorHandler

func ErrorHandler(h utils.ErrorHandler) ConnLimitOption

ErrorHandler sets error handler of the server

func Logger

func Logger(l utils.Logger) ConnLimitOption

Logger sets the logger that will be used by this middleware.

type ConnLimiter

type ConnLimiter struct {
	// contains filtered or unexported fields

Limiter tracks concurrent connection per token and is capable of rejecting connections if they are failed

func New

func New(next http.Handler, extract utils.SourceExtractor, maxConnections int64, options ...ConnLimitOption) (*ConnLimiter, error)

func (*ConnLimiter) ServeHTTP

func (cl *ConnLimiter) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ConnLimiter) Wrap

func (cl *ConnLimiter) Wrap(h http.Handler)

type MaxConnError

type MaxConnError struct {
	// contains filtered or unexported fields

func (*MaxConnError) Error

func (m *MaxConnError) Error() string

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL