Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidMaxNumConcurrentRequests = errors.New("max number of concurrent requests value is invalid")
ErrInvalidMaxNumConcurrentRequests signals that a provided number of concurrent requests is invalid
var ErrInvalidMaxNumRequests = errors.New("max number of requests value is invalid")
ErrInvalidMaxNumRequests signals that a provided number of requests is invalid
var ErrNilFacade = errors.New("nil facade handler")
ErrNilFacade signals that nil facade provided is nil
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)