rate

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLimit

func CheckLimit(to interface{})

func Start

func Start()

NewLimiter creates both chat and global rate limiters.

Types

type Limiter

type Limiter struct {
	// contains filtered or unexported fields
}

Limiter

func (*Limiter) Add

func (i *Limiter) Add(key string) *rate.Limiter

Add creates a new rate limiter and adds it to the keys map, using the key

func (*Limiter) GetLimiter

func (i *Limiter) GetLimiter(key string) *rate.Limiter

GetLimiter returns the rate limiter for the provided key if it exists. Otherwise, calls Add to add key address to the map

Jump to

Keyboard shortcuts

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