ratelimiter

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ratelimiter

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

func (*Ratelimiter) Allow

func (rate *Ratelimiter) Allow(ip netip.Addr) bool

func (*Ratelimiter) Close

func (rate *Ratelimiter) Close()

func (*Ratelimiter) Init

func (rate *Ratelimiter) Init(spawner Spawner)

Init resets the limiter and starts its garbage-collection worker.

When spawner is non-nil, the worker is started through it so callers can observe the same lifecycle as other long-lived networking workers.

type RatelimiterEntry

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

type Spawner added in v0.4.0

type Spawner interface {
	Spawn(worker func(), name string) (uint64, error)
}

Spawner starts long-lived background workers. It matches gonnect.Spawner's Spawn method without making this package depend on gonnect directly.

Jump to

Keyboard shortcuts

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