ratelimit

package
v0.1.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ratelimit bounds how often an individual peer may make a node or router do pre-authentication work.

Index

Constants

View Source
const (
	// Rate limiting defaults for peers
	PeerRateLimit = 5
	PeerBurst     = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerRateLimiter

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

PeerRateLimiter tracks rate limits per peer using an LRU cache.

func NewPeerRateLimiter

func NewPeerRateLimiter(size int) (*PeerRateLimiter, error)

NewPeerRateLimiter creates a new PeerRateLimiter with specified cache size.

func (*PeerRateLimiter) Allow

func (prl *PeerRateLimiter) Allow(peerID string) bool

Allow checks if the peer is allowed to perform an action.

Jump to

Keyboard shortcuts

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