peermon

package
v0.6.3-beta01 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathSelector

type PathSelector interface {
	BestPath() *SelectedRoute
}

type PeerMonitor

type PeerMonitor struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(cfg *PeerMonitorConfig) *PeerMonitor

func (*PeerMonitor) AddNode

func (pm *PeerMonitor) AddNode(ifname, pubKey string, endpoint netip.Addr, connID int)

func (*PeerMonitor) BestPath

func (pm *PeerMonitor) BestPath() *SelectedRoute

BestPath returns best route gateway. Best route is:

  • Lowest packet loss
  • possible lowest latency

But in order for not to fluctuate between 2 routes, when latency is the same so once one best route is found - do not switch to another route, unless it is (betterPercent)% better

func (*PeerMonitor) Close

func (pm *PeerMonitor) Close() error

func (*PeerMonitor) Collect

func (pm *PeerMonitor) Collect(ch chan<- prometheus.Metric, groupID int)

func (*PeerMonitor) DelNode

func (pm *PeerMonitor) DelNode(endpoint netip.Addr)

func (*PeerMonitor) Dump

func (pm *PeerMonitor) Dump()

func (*PeerMonitor) Flush

func (pm *PeerMonitor) Flush()

func (*PeerMonitor) HasNode

func (pm *PeerMonitor) HasNode(endpoint netip.Addr) bool

func (*PeerMonitor) Peers

func (pm *PeerMonitor) Peers() []string

func (*PeerMonitor) PingProcess

func (pm *PeerMonitor) PingProcess(pr *multiping.PingData)

type PeerMonitorConfig

type PeerMonitorConfig struct {
	AverageSize              uint
	RouteStrategy            int
	RerouteRatio             float32
	RerouteDiff              float32
	RouteDeleteLossThreshold float32
}

type RouteChangeReason

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

func NewReason

func NewReason(r int, o, n float32) *RouteChangeReason

func (*RouteChangeReason) Reason

func (rr *RouteChangeReason) Reason() string

func (*RouteChangeReason) String

func (rr *RouteChangeReason) String() string

func (*RouteChangeReason) Value

func (rr *RouteChangeReason) Value() float32

type SelectedRoute

type SelectedRoute struct {
	IP     netip.Addr // best route IP address
	ID     int        // ConnectionID of the best route
	Reason *RouteChangeReason
}

Jump to

Keyboard shortcuts

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