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.
Click to show internal directories.
Click to hide internal directories.