cooldown

package
v2.0.0-...-6a7c878 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 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) astral.MiddlewareFunc

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

func NewShared

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

NewShared Create a new limiter shared across the application

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

Jump to

Keyboard shortcuts

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