middleware

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 ErrTooManyRequests = errors.New("too many requests")

ErrTooManyRequests signals that too many requests were simultaneously received

Functions

func CreateEndpointThrottler added in v0.0.2

func CreateEndpointThrottler(throttlerName string) gin.HandlerFunc

CreateEndpointThrottler will create a middleware-type of handler to be used in conjunction with special REST API end points that need to be better protected

func NewGlobalThrottler added in v0.0.2

func NewGlobalThrottler(maxConnections uint32) (*globalThrottler, error)

NewGlobalThrottler creates a new instance of a globalThrottler

func NewSourceThrottler added in v0.0.2

func NewSourceThrottler(maxNumRequests uint32) (*sourceThrottler, error)

NewSourceThrottler creates a new instance of a sourceThrottler

func WithFacade added in v0.0.2

func WithFacade(facade Handler) gin.HandlerFunc

WithFacade middleware will set up a facade object in the gin context

Types

type Handler added in v0.0.2

type Handler interface {
}

Handler interface defines methods that can be used from `facade` context variable

Jump to

Keyboard shortcuts

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