emitter

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package emitter contains the ndt7-client emitter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

type Emitter interface {
	// OnStarting is emitted before attempting to start a test.
	OnStarting(test spec.TestKind) error

	// OnError is emitted if a test cannot start.
	OnError(test spec.TestKind, err error) error

	// OnConnected is emitted when we connected to the ndt7 server.
	OnConnected(test spec.TestKind, fqdn string) error

	// OnDownloadEvent is emitted during the download.
	OnDownloadEvent(m *spec.Measurement) error

	// OnUploadEvent is emitted during the upload.
	OnUploadEvent(m *spec.Measurement) error

	// OnComplete is always emitted when the test is over.
	OnComplete(test spec.TestKind) error

	// OnSummary is emitted after the test is over.
	OnSummary(s *Summary) error
}

Emitter is a generic emitter. When an event occurs, the corresponding method will be called. An error will generally mean that it's not possible to write the output. A common case where this happen is where the output is redirected to a file on a full hard disk.

See the documentation of the main package for more details on the sequence in which events may occur.

func NewJSON

func NewJSON(w io.Writer) Emitter

NewJSON creates a new JSON emitter

type Summary

type Summary struct {
	// ServerFQDN is the FQDN of the server used for this test.
	ServerFQDN string

	// ServerIP is the (v4 or v6) IP address of the server.
	ServerIP string

	// ClientIP is the (v4 or v6) IP address of the client.
	ClientIP string

	// DownloadUUID is the UUID of the download test.
	// TODO: add UploadUUID after we start processing counterflow messages.
	DownloadUUID string

	// Download is the download speed, in Mbit/s. This is measured at the
	// receiver.
	Download ValueUnitPair

	// Upload is the upload speed, in Mbit/s. This is measured at the sender.
	Upload ValueUnitPair

	// DownloadRetrans is the retransmission rate. This is based on the TCPInfo
	// values provided by the server during a download test.
	DownloadRetrans ValueUnitPair

	// RTT is the round-trip time of the latest measurement, in milliseconds.
	// This is provided by the server during a download test.
	MinRTT ValueUnitPair
}

Summary is a struct containing the values displayed to the user at the end of an ndt7 test.

func NewSummary

func NewSummary(FQDN string) *Summary

NewSummary returns a new Summary struct for a given FQDN.

type ValueUnitPair

type ValueUnitPair struct {
	Value float64
	Unit  string
}

ValueUnitPair represents a {"Value": ..., "Unit": ...} pair.

Jump to

Keyboard shortcuts

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