rate

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAnnounceRateTarget  = 3600.0 // Default 1 hour between announces
	DefaultAnnounceRateGrace   = 3      // Default number of grace announces
	DefaultAnnounceRatePenalty = 7200.0 // Default 2 hour penalty
	DefaultBurstFreqNew        = 3.5    // Default announces/sec for new interfaces
	DefaultBurstFreq           = 12.0   // Default announces/sec for established interfaces
	DefaultBurstHold           = 60     // Default seconds to hold after burst
	DefaultBurstPenalty        = 300    // Default seconds penalty after burst
	DefaultMaxHeldAnnounces    = 256    // Default max announces in hold queue
	DefaultHeldReleaseInterval = 30     // Default seconds between releasing held announces
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnounceRateControl

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

AnnounceRateControl handles per-destination announce rate limiting

func NewAnnounceRateControl

func NewAnnounceRateControl(target float64, grace int, penalty float64) *AnnounceRateControl

func (*AnnounceRateControl) AllowAnnounce

func (arc *AnnounceRateControl) AllowAnnounce(destHash string) bool

type IngressControl

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

IngressControl handles new destination announce rate limiting

func NewIngressControl

func NewIngressControl(enabled bool) *IngressControl

func (*IngressControl) ProcessAnnounce

func (ic *IngressControl) ProcessAnnounce(announceHash string, announceData []byte, isNewDest bool) bool

func (*IngressControl) ReleaseHeldAnnounce

func (ic *IngressControl) ReleaseHeldAnnounce() (string, []byte, bool)

type Limiter

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

func NewLimiter

func NewLimiter(rate float64, interval time.Duration) *Limiter

func (*Limiter) Allow

func (l *Limiter) Allow() bool

Jump to

Keyboard shortcuts

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