monitor

package
v1.5.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT, MIT Imports: 7 Imported by: 2

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