rate

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 0 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rate defines rate-limiting interfaces for controlling the rate of new connections or requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter interface {
	// Allow reports whether n operations can proceed at the current rate.
	Allow(n int) bool
	// Limit returns the current rate limit (operations per second).
	Limit() float64
}

Limiter controls the rate of operations. It reports whether a given number of operations is within the allowed rate.

type RateLimiter

type RateLimiter interface {
	// Limiter returns the Limiter for the given key.
	Limiter(key string) Limiter
}

RateLimiter provides per-key rate limiters. Keys are typically client IPs or service names, allowing different rate limits for different sources.

Jump to

Keyboard shortcuts

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