Documentation
¶
Overview ¶
Package speedtest implements the throughput test used by 10000speedtest.
The China Telecom Guangdong web client drives its test with many parallel HTTP connections:
- Download: GET <server>/shmfile/<sizeMiB>?tag=<random> -> server streams sizeMiB of octet-stream
- Upload: POST <server>/upload?tag=<random> -> client streams a body, server sinks it
A Tester reproduces that behaviour: it opens Config.Connections parallel connections for Config.Duration and sums the bytes moved, reporting the throughput in Mbps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Server string
Connections int
Duration time.Duration
DownloadSize int
UploadSize int
Insecure bool
Chart bool
JSONOutput bool
// Interfaces binds outgoing connections to local network interfaces (by name)
// or source IPs. Each interface runs Connections connections and the results
// are aggregated. Empty uses the default route.
Interfaces []string
}
Config describes a single speed-test run.
type InterfaceResult ¶ added in v0.5.0
InterfaceResult holds one interface's contribution to a stage.
type Result ¶
type Result struct {
Name string
Bytes int64
Elapsed time.Duration
MegabitsPerSecond float64
PerInterface []InterfaceResult
}
Result holds the measured throughput of one stage. When more than one interface is tested, PerInterface breaks the total down per interface.
type Tester ¶
type Tester struct {
// contains filtered or unexported fields
}
Tester runs download and upload stages against a configured server, over one HTTP client per configured interface.
func New ¶
New builds a Tester with one HTTP client per configured interface. It returns an error if any interface cannot be resolved to a local address.