cooldown

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Command = 1 << iota
	User
	Channel
	Server
	Global
)

Variables

This section is empty.

Functions

func New

func New(limit int, timeFrame time.Duration, flags int) router.MiddlewareFunc

Create a new limiter which does nothing when the limit is hit

func NewShared

func NewShared(limit int, timeFrame time.Duration, flags int) router.MiddlewareFunc

Create a new limiter shared across the application

func NewSharedWithCatch

func NewSharedWithCatch(limit int, timeFrame time.Duration, flags int, catch middleware.CatchFunc) router.MiddlewareFunc

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) router.MiddlewareFunc

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
}

func (*Handler) Middleware

func (h *Handler) Middleware(fn router.Handler) router.Handler

Middleware function for the handler

Jump to

Keyboard shortcuts

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