ratelimit

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ratelimit provides token bucket rate limiting for cloudemu services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limiter implements a token bucket rate limiter.

func New

func New(rate float64, burst int, clock config.Clock) *Limiter

New creates a new Limiter with the given rate (requests per second) and burst size.

func (*Limiter) Allow

func (l *Limiter) Allow() error

Allow checks if a request is allowed. Returns a Throttled error if rate limited.

Jump to

Keyboard shortcuts

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