oxy: github.com/vulcand/oxy/connlimit Index | Files

package connlimit

import "github.com/vulcand/oxy/connlimit"

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

Index

Package Files

connlimit.go

type ConnErrHandler Uses

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

ConnErrHandler connection limiter error handler

func (*ConnErrHandler) ServeHTTP Uses

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

type ConnLimitOption Uses

type ConnLimitOption func(l *ConnLimiter) error

ConnLimitOption connection limit option type

func ErrorHandler Uses

func ErrorHandler(h utils.ErrorHandler) ConnLimitOption

ErrorHandler sets error handler of the server

func Logger Uses

func Logger(l *log.Logger) ConnLimitOption

Logger defines the logger the connection limiter will use.

It defaults to logrus.StandardLogger(), the global logger used by logrus.

type ConnLimiter Uses

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

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

func New Uses

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

New creates a new ConnLimiter

func (*ConnLimiter) ServeHTTP Uses

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

func (*ConnLimiter) Wrap Uses

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

Wrap sets the next handler to be called by connexion limiter handler.

type MaxConnError Uses

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

MaxConnError maximum connections reached error

func (*MaxConnError) Error Uses

func (m *MaxConnError) Error() string

Package connlimit imports 5 packages (graph) and is imported by 51 packages. Updated 2018-07-15. Refresh now. Tools for package owners.