ndt7

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package ndt7 contains the ndt7 network experiment.

See https://github.com/ooni/spec/blob/master/nettests/ts-022-ndt.md

Index

Constants

View Source
const (
	// OriginClient indicates that the measurement origin is the client.
	OriginClient = OriginKind("client")

	// OriginServer indicates that the measurement origin is the server.
	OriginServer = OriginKind("server")

	// TestDownload indicates that this is a download.
	TestDownload = TestKind("download")

	// TestUpload indicates that this is an upload.
	TestUpload = TestKind("upload")
)

Variables

This section is empty.

Functions

func NewExperimentMeasurer

func NewExperimentMeasurer(config Config) model.ExperimentMeasurer

NewExperimentMeasurer creates a new ExperimentMeasurer.

Types

type AppInfo

type AppInfo struct {
	NumBytes    int64
	ElapsedTime int64
}

AppInfo contains an application level measurement. This structure is described in the ndt7 specification.

type BBRInfo

type BBRInfo struct {
	InetDiagBBRInfo
	ElapsedTime int64
}

The BBRInfo struct contains information measured using BBR. This structure is an extension to the ndt7 specification. Variables here have the same measurement unit that is used by the Linux kernel.

type Config

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

Config contains the experiment settings

type ConnectionInfo

type ConnectionInfo struct {
	Client string
	Server string
	UUID   string `json:",omitempty"`
}

ConnectionInfo contains connection info. This structure is described in the ndt7 specification.

type InetDiagBBRInfo

type InetDiagBBRInfo struct {
	BW         int64  `csv:"BBR.BW"`         // Max-filtered BW (app throughput) estimate in bytes/second
	MinRTT     uint32 `csv:"BBR.MinRTT"`     // Min-filtered RTT in uSec
	PacingGain uint32 `csv:"BBR.PacingGain"` // Pacing gain shifted left 8 bits
	CwndGain   uint32 `csv:"BBR.CwndGain"`   // Cwnd gain shifted left 8 bits
}

InetDiagBBRInfo implements the struct associated with INET_DIAG_BBRINFO attribute, corresponding with linux struct tcp_bbr_info in uapi/linux/inet_diag.h.

type LinuxTCPInfo

type LinuxTCPInfo struct {
	State       uint8 `csv:"TCP.State"`
	CAState     uint8 `csv:"TCP.CAState"`
	Retransmits uint8 `csv:"TCP.Retransmits"`
	Probes      uint8 `csv:"TCP.Probes"`
	Backoff     uint8 `csv:"TCP.Backoff"`
	Options     uint8 `csv:"TCP.Options"`
	WScale      uint8 `csv:"TCP.WScale"`     //snd_wscale : 4, tcpi_rcv_wscale : 4;
	AppLimited  uint8 `csv:"TCP.AppLimited"` //delivery_rate_app_limited:1;

	RTO    uint32 `csv:"TCP.RTO"` // offset 8
	ATO    uint32 `csv:"TCP.ATO"`
	SndMSS uint32 `csv:"TCP.SndMSS"`
	RcvMSS uint32 `csv:"TCP.RcvMSS"`

	Unacked uint32 `csv:"TCP.Unacked"` // offset 24
	Sacked  uint32 `csv:"TCP.Sacked"`
	Lost    uint32 `csv:"TCP.Lost"`
	Retrans uint32 `csv:"TCP.Retrans"`
	Fackets uint32 `csv:"TCP.Fackets"`

	/* Times. */
	// These seem to be elapsed time, so they increase on almost every sample.
	// We can probably use them to get more info about intervals between samples.
	LastDataSent uint32 `csv:"TCP.LastDataSent"` // offset 44
	LastAckSent  uint32 `csv:"TCP.LastAckSent"`  /* Not remembered, sorry. */ // offset 48
	LastDataRecv uint32 `csv:"TCP.LastDataRecv"` // offset 52
	LastAckRecv  uint32 `csv:"TCP.LastDataRecv"` // offset 56

	/* Metrics. */
	PMTU        uint32 `csv:"TCP.PMTU"`
	RcvSsThresh uint32 `csv:"TCP.RcvSsThresh"`
	RTT         uint32 `csv:"TCP.RTT"`
	RTTVar      uint32 `csv:"TCP.RTTVar"`
	SndSsThresh uint32 `csv:"TCP.SndSsThresh"`
	SndCwnd     uint32 `csv:"TCP.SndCwnd"`
	AdvMSS      uint32 `csv:"TCP.AdvMSS"`
	Reordering  uint32 `csv:"TCP.Reordering"`

	RcvRTT   uint32 `csv:"TCP.RcvRTT"`
	RcvSpace uint32 `csv:"TCP.RcvSpace"`

	TotalRetrans uint32 `csv:"TCP.TotalRetrans"`

	PacingRate    int64 `csv:"TCP.PacingRate"`    // This is often -1, so better for it to be signed
	MaxPacingRate int64 `csv:"TCP.MaxPacingRate"` // This is often -1, so better to be signed.

	// NOTE: In linux, these are uint64, but we make them int64 here for compatibility with BigQuery
	BytesAcked    int64 `csv:"TCP.BytesAcked"`    /* RFC4898 tcpEStatsAppHCThruOctetsAcked */
	BytesReceived int64 `csv:"TCP.BytesReceived"` /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
	SegsOut       int32 `csv:"TCP.SegsOut"`       /* RFC4898 tcpEStatsPerfSegsOut */
	SegsIn        int32 `csv:"TCP.SegsIn"`        /* RFC4898 tcpEStatsPerfSegsIn */

	NotsentBytes uint32 `csv:"TCP.NotsentBytes"`
	MinRTT       uint32 `csv:"TCP.MinRTT"`
	DataSegsIn   uint32 `csv:"TCP.DataSegsIn"`  /* RFC4898 tcpEStatsDataSegsIn */
	DataSegsOut  uint32 `csv:"TCP.DataSegsOut"` /* RFC4898 tcpEStatsDataSegsOut */

	// NOTE: In linux, this is uint64, but we make it int64 here for compatibility with BigQuery
	DeliveryRate int64 `csv:"TCP.DeliveryRate"`

	BusyTime      int64 `csv:"TCP.BusyTime"`      /* Time (usec) busy sending data */
	RWndLimited   int64 `csv:"TCP.RWndLimited"`   /* Time (usec) limited by receive window */
	SndBufLimited int64 `csv:"TCP.SndBufLimited"` /* Time (usec) limited by send buffer */

	Delivered   uint32 `csv:"TCP.Delivered"`
	DeliveredCE uint32 `csv:"TCP.DeliveredCE"`

	// NOTE: In linux, these are uint64, but we make them int64 here for compatibility with BigQuery
	BytesSent    int64 `csv:"TCP.BytesSent"`    /* RFC4898 tcpEStatsPerfHCDataOctetsOut */
	BytesRetrans int64 `csv:"TCP.BytesRetrans"` /* RFC4898 tcpEStatsPerfOctetsRetrans */

	DSackDups uint32 `csv:"TCP.DSackDups"` /* RFC4898 tcpEStatsStackDSACKDups */
	ReordSeen uint32 `csv:"TCP.ReordSeen"` /* reordering events seen */
}

LinuxTCPInfo is the linux defined structure returned in RouteAttr DIAG_INFO messages. It corresponds to the struct tcp_info in include/uapi/linux/tcp.h

type Measurement

type Measurement struct {
	// AppInfo contains application level measurements.
	AppInfo *AppInfo `json:",omitempty"`

	// BBRInfo is the data measured using TCP BBR instrumentation.
	BBRInfo *BBRInfo `json:",omitempty"`

	// ConnectionInfo contains info on the connection.
	ConnectionInfo *ConnectionInfo `json:",omitempty"`

	// Origin indicates who performed this measurement.
	Origin OriginKind `json:",omitempty"`

	// Test contains the test name.
	Test TestKind `json:",omitempty"`

	// TCPInfo contains metrics measured using TCP_INFO instrumentation.
	TCPInfo *TCPInfo `json:",omitempty"`
}

The Measurement struct contains measurement results. This message is an extension of the one inside of v0.9.0 of the ndt7 spec.

type Measurer

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

Measurer performs the measurement.

func (*Measurer) ExperimentName

func (m *Measurer) ExperimentName() string

ExperimentName implements ExperimentMeasurer.ExperiExperimentName.

func (*Measurer) ExperimentVersion

func (m *Measurer) ExperimentVersion() string

ExperimentVersion implements ExperimentMeasurer.ExperimentVersion.

func (Measurer) GetSummaryKeys

func (m Measurer) GetSummaryKeys(measurement *model.Measurement) (interface{}, error)

GetSummaryKeys implements model.ExperimentMeasurer.GetSummaryKeys.

func (*Measurer) Run

func (m *Measurer) Run(ctx context.Context, args *model.ExperimentArgs) error

Run implements ExperimentMeasurer.Run.

type OriginKind

type OriginKind string

OriginKind indicates the origin of a measurement.

type ServerInfo

type ServerInfo struct {
	Hostname string `json:"hostname"`
	Site     string `json:"site,omitempty"`
}

ServerInfo contains information on the selected server

Site is currently an extension to the NDT specification until the data format of the new mlab locate is clear.

type Summary

type Summary struct {
	AvgRTT         float64 `json:"avg_rtt"`         // Average RTT [ms]
	Download       float64 `json:"download"`        // download speed [kbit/s]
	MSS            int64   `json:"mss"`             // MSS
	MaxRTT         float64 `json:"max_rtt"`         // Max AvgRTT sample seen [ms]
	MinRTT         float64 `json:"min_rtt"`         // Min RTT according to kernel [ms]
	Ping           float64 `json:"ping"`            // Equivalent to MinRTT [ms]
	RetransmitRate float64 `json:"retransmit_rate"` // bytes_retrans/bytes_sent [0..1]
	Upload         float64 `json:"upload"`          // upload speed [kbit/s]
}

Summary is the measurement summary

type SummaryKeys

type SummaryKeys struct {
	Upload         float64 `json:"upload"`
	Download       float64 `json:"download"`
	Ping           float64 `json:"ping"`
	MaxRTT         float64 `json:"max_rtt"`
	AvgRTT         float64 `json:"avg_rtt"`
	MinRTT         float64 `json:"min_rtt"`
	MSS            float64 `json:"mss"`
	RetransmitRate float64 `json:"retransmit_rate"`
	IsAnomaly      bool    `json:"-"`
}

SummaryKeys contains summary keys for this experiment.

Note that this structure is part of the ABI contract with ooniprobe therefore we should be careful when changing it.

type TCPInfo

type TCPInfo struct {
	LinuxTCPInfo
	ElapsedTime int64
}

The TCPInfo struct contains information measured using TCP_INFO. This structure is described in the ndt7 specification.

type TestKeys

type TestKeys struct {
	// Download contains download results
	Download []Measurement `json:"download"`

	// Failure is the failure string
	Failure *string `json:"failure"`

	// Protocol contains the version of the ndt protocol
	Protocol int64 `json:"protocol"`

	// Server contains information on the selected server
	Server ServerInfo `json:"server"`

	// Summary contains the measurement summary
	Summary Summary `json:"summary"`

	// Upload contains upload results
	Upload []Measurement `json:"upload"`
}

TestKeys contains the test keys

type TestKind

type TestKind string

TestKind indicates the direction of a measurement.

Jump to

Keyboard shortcuts

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