monitor

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT, MIT Imports: 7 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerManager

type PeerManager interface {
	Peers() []peer.ID
	GetPeerScore(id peer.ID) (float64, error)
	IsStatic(peer.ID) bool
	// BanPeer bans the peer until the specified time and disconnects any existing connections.
	BanPeer(peer.ID, time.Time) error
}

type PeerMonitor

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

PeerMonitor runs a background process to periodically check for peers with scores below a minimum. When it finds bad peers, it disconnects and bans them. A delay is introduced between each peer being checked to avoid spikes in system load.

func NewPeerMonitor

func NewPeerMonitor(ctx context.Context, l log.Logger, clock clock.Clock, manager PeerManager, minScore float64, banDuration time.Duration) *PeerMonitor

func (*PeerMonitor) Start

func (p *PeerMonitor) Start()

func (*PeerMonitor) Stop

func (p *PeerMonitor) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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