middleware

package
v1.0.138 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidMaxNumConcurrentRequests = errors.New("max number of concurrent requests value is invalid")

ErrInvalidMaxNumConcurrentRequests signals that a provided number of concurrent requests is invalid

View Source
var ErrInvalidMaxNumRequests = errors.New("max number of requests value is invalid")

ErrInvalidMaxNumRequests signals that a provided number of requests is invalid

View Source
var ErrNilFacade = errors.New("nil facade handler")

ErrNilFacade signals that nil facade provided is nil

View Source
var ErrTooManyRequests = errors.New("too many requests")

ErrTooManyRequests signals that too many requests were simultaneously received

Functions

func NewMiddleware added in v1.0.137

func NewMiddleware(
	facade ElrondHandler,
	maxConcurrentRequests uint32,
	maxNumRequestsPerAddress uint32,
) (*middleWare, error)

NewMiddleware creates a new instance of a gin middleware

func WithTestingElrondFacade added in v1.0.137

func WithTestingElrondFacade(elrondFacade ElrondHandler) gin.HandlerFunc

WithTestingElrondFacade middleware will set up an ElrondFacade object in the gin context should only be used in testing and not in conjunction with other middlewares as c.Next() instruction is not safe to be used multiple times in the same context.

Types

type ElrondHandler

type ElrondHandler interface {
	IsInterfaceNil() bool
}

ElrondHandler interface defines methods that can be used from `elrondFacade` context variable TODO rename ElrondHandler (take out Elrond part)

Jump to

Keyboard shortcuts

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