netstats

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingLoss = 1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IfaceBwEntry

type IfaceBwEntry struct {
	IfName    string           `json:"iface"`
	PublicKey string           `json:"iface_public_key"`
	Peers     []*PeerDataEntry `json:"peers"`
}

type Message

type Message struct {
	common.MessageHeader
	Data []IfaceBwEntry `json:"data"`
}

func NewMessage

func NewMessage() *Message

func (*Message) Add

func (msg *Message) Add(ip string, latency, loss float32) error

Add a single peer statistics to a message

func (*Message) PingProcess

func (msg *Message) PingProcess(pr *multiping.PingData)

Parse ping result and fill statistics for connected peers

func (*Message) Send

func (msg *Message) Send(writer io.Writer) error

type PeerDataEntry

type PeerDataEntry struct {
	PublicKey    string  `json:"public_key"`
	IP           string  `json:"internal_ip"`
	Handshake    string  `json:"last_handshake,omitempty"`
	KeepAllive   int     `json:"keep_alive_interval"`
	Latency      float32 `json:"latency_ms,omitempty"`
	Loss         float32 `json:"packet_loss"`
	RxBytes      int64   `json:"rx_bytes"`
	TxBytes      int64   `json:"tx_bytes"`
	RxSpeed      float32 `json:"rx_speed_mbps"`
	TxSpeed      float32 `json:"tx_speed_mbps"`
	ConnectionID int     `json:"connection_id"`
	GroupID      int     `json:"connection_group_id"`
}

Jump to

Keyboard shortcuts

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