Documentation ¶
Index ¶
- Constants
- func New(limit int, timeFrame time.Duration, flags int) astral.MiddlewareFunc
- func NewShared(limit int, timeFrame time.Duration, flags int) astral.MiddlewareFunc
- func NewSharedWithCatch(limit int, timeFrame time.Duration, flags int, catch middleware.CatchFunc) astral.MiddlewareFunc
- func NewWithCatch(limit int, timeFrame time.Duration, flags int, catch middleware.CatchFunc) astral.MiddlewareFunc
- type Handler
Constants ¶
View Source
const ( Command = 1 << iota User Channel Server Global )
Variables ¶
This section is empty.
Functions ¶
func NewSharedWithCatch ¶
func NewSharedWithCatch(limit int, timeFrame time.Duration, flags int, catch middleware.CatchFunc) astral.MiddlewareFunc
NewSharedWithCatch Create a new limiter shared across the application which calls "catch" if set when the limit is hit.
func NewWithCatch ¶
func NewWithCatch(limit int, timeFrame time.Duration, flags int, catch middleware.CatchFunc) astral.MiddlewareFunc
NewWithCatch Create a new limiter which calls "catch" if set when the limit is hit.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a type which wraps the specific functionality of the rate limiter
func (*Handler) Middleware ¶
func (h *Handler) Middleware(fn astral.Handler) astral.Handler
Middleware function for the handler
Click to show internal directories.
Click to hide internal directories.