rate

package
v0.0.0-...-5783bb9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package rate provides a rate limiter middleware based on a "token bucket" implementation.

More information: https://en.wikipedia.org/wiki/Token_bucket

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(limit, burst uint) func(http.Handler) http.Handler

Handler provides a rate limiter middleware based on a "token bucket" implementation. A rate limiter controls how frequently HTTP requests are allowed to happen. The "token bucket" is of size `limit`, initially full and refilled at rate `burst` tokens per second.

The rate limiter is applied to all incoming requests and will reject, with status 429, those that exceed the configured limit.

More information: https://www.rfc-editor.org/rfc/rfc6585.html#section-4

Types

This section is empty.

Jump to

Keyboard shortcuts

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