ratelimit

package
v0.35.0-crescendo-prev... Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewControlMessageRateLimiter

func NewControlMessageRateLimiter(logger zerolog.Logger, limit rate.Limit, burst int) p2p.BasicRateLimiter

NewControlMessageRateLimiter returns a new ControlMessageRateLimiter. The cleanup loop will be started in a separate goroutine and should be stopped by calling Close.

Types

type ControlMessageRateLimiter

type ControlMessageRateLimiter struct {
	*ratelimiter.RateLimiter
}

ControlMessageRateLimiter rate limiter that rate limits the amount of

func (*ControlMessageRateLimiter) Allow

func (c *ControlMessageRateLimiter) Allow(peerID peer.ID, n int) bool

Allow checks the cached limiter for the peer and returns limiter.Allow(). If a limiter is not cached for a peer one is created.

Jump to

Keyboard shortcuts

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