ratelimiter

package
v0.0.0-...-79063dd Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsMiddleware

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

func MewMetricMiddleware

func MewMetricMiddleware(next allower) *MetricsMiddleware

func (*MetricsMiddleware) Allow

func (m *MetricsMiddleware) Allow(user string) bool

type TokenRateLimiter

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

func New

func New(tokens int, every time.Duration) *TokenRateLimiter

func (*TokenRateLimiter) Allow

func (t *TokenRateLimiter) Allow(user string) bool

Allow enforces a rate limit of N tokens per session.

Jump to

Keyboard shortcuts

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