Documentation ¶
Overview ¶
Package emitter contains the ndt5-client emitter.
Index ¶
- type Emitter
- type HumanReadable
- func (h HumanReadable) OnDebug(m string) error
- func (h HumanReadable) OnError(m string) error
- func (h HumanReadable) OnInfo(m string) error
- func (h HumanReadable) OnSpeed(test string, speed string) error
- func (h HumanReadable) OnSummary(s *Summary) error
- func (h HumanReadable) OnWarning(m string) error
- type Quiet
- type Summary
- type ValueUnitPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Emitter ¶
type Emitter interface { // OnDebug is emitted on debug messages. OnDebug(string) error // OnError is emitted on error mesages. OnError(string) error // OnWarning is emitted on warning messages. OnWarning(string) error // OnInfo is emitted on info messages. OnInfo(string) error // OnSpeed is emitted during the upload. OnSpeed(string, string) 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 NewHumanReadable ¶
func NewHumanReadable() Emitter
NewHumanReadable returns a new human readable emitter.
func NewHumanReadableWithWriter ¶
NewHumanReadableWithWriter returns a new human readable emitter using the specified writer.
type HumanReadable ¶
type HumanReadable struct {
// contains filtered or unexported fields
}
HumanReadable is a human readable emitter. It emits the events generated by running a ndt5 test as pleasant stdout messages.
func (HumanReadable) OnDebug ¶
func (h HumanReadable) OnDebug(m string) error
OnDebug handles debug messages.
func (HumanReadable) OnError ¶
func (h HumanReadable) OnError(m string) error
OnError handles error messages.
func (HumanReadable) OnInfo ¶
func (h HumanReadable) OnInfo(m string) error
OnInfo handles info messages.
func (HumanReadable) OnSpeed ¶
func (h HumanReadable) OnSpeed(test string, speed string) error
OnSpeed handles a speed reporting event during a test.
func (HumanReadable) OnSummary ¶
func (h HumanReadable) OnSummary(s *Summary) error
OnSummary handles the summary event.
func (HumanReadable) OnWarning ¶
func (h HumanReadable) OnWarning(m string) error
OnWarning handles warning messages.
type Quiet ¶
type Quiet struct {
// contains filtered or unexported fields
}
Quiet acts as a filter allowing summary and error messages only, and doesn't perform any formatting. The message is actually emitted by the embedded Emitter.
type Summary ¶
type Summary struct { // ServerFQDN is the FQDN of the server used for this test. ServerFQDN string // ServerIP is the IP address of the server. ServerIP string // ClientIP is the IP address of the client. ClientIP string // DownloadUUID is the UUID of the download test. 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 // MinRTT is the minimum round-trip time reported by the server in the // last Measurement of a download test, in milliseconds. MinRTT ValueUnitPair }
Summary is a struct containing the values displayed to the user at the end of an ndt5 test.
func NewSummary ¶
NewSummary returns a new Summary struct for a given FQDN.
type ValueUnitPair ¶
ValueUnitPair represents a {"Value": ..., "Unit": ...} pair.