Skip to main content

Module speedtest

Module speedtest 

Source
Expand description

Ping, jitter, download, and upload speeds

This block uses Cloudflare’s networkquality-rs (nq) library to run a speedtest and report the ping, jitter, download speed, and upload speed.

The block can be configured to use custom endpoints for the speedtest, but by default Cloudflare’s nq endpoints are used.

For example setting config_url to "https://mensura.cdn-apple.com/.well-known/nq" will use Apple’s nq endpoints instead of Cloudflare’s.

nq is based on the IETF draft: “Responsiveness under Working Conditions”.

The draft defines “responsiveness”, measured in Round trips Per Minute (RPM), as a useful measurement of network quality.

§Configuration

KeyValuesDefault
formatA string to customise the output of this block. See below for available placeholders." ^icon_ping $ping.eng(prefix:m) ^icon_net_down $speed_down ^icon_net_up $speed_up "
intervalUpdate interval in seconds1800
config_urlThe endpoint to get the responsiveness config from. See SpeedtestConfig::config_url for the expected format of the configuration JSON returned by this endpoint.None
large_download_urlThe large file endpoint which should be multiple GBs."https://h3.speed.cloudflare.com/__down?bytes=10000000000"
small_download_urlThe small file endpoint which should be very small, only a few bytes."https://h3.speed.cloudflare.com/__down?bytes=10"
upload_urlThe upload url which accepts an arbitrary amount of data."https://h3.speed.cloudflare.com/__up"
latencyArguments for the latency test.See table below
rpmArguments for the RPM test.See table below

§Latency Configuration (settings used for ping and jitter)

KeyValuesDefault
runsThe number of latency test runs to perform.20

§RPM Configuration (settings used for speed_down and speed_up)

KeyValuesDefault
moving_average_distanceThe number of intervals to use when calculating the moving average.4
std_toleranceHow far a measurement is allowed to be from the previous moving average before the measurement is considered unstable.0.05
trimmed_mean_percentDetermines which percentile to use for averaging when calculating the trimmed mean of throughputs or RPM scores. A value of 0.95 means to only use values in the 95th percentile to calculate an average.0.95
max_loaded_connectionsThe maximum number of loaded connections that the test can use to saturate the network.16
interval_duration_msThe duration between test intervals in milliseconds (ms).500 (0.5 seconds)
test_duration_msThe overall test duration in milliseconds (ms).12_000 (12 seconds)
conn_typeThe type of connection to use for the speed test. One of "h1", "h2", or "h3""h2"
upload_bytes_per_requestThe number of bytes to upload per request during the speed test.100_000_000

§Available Format Keys

PlaceholderValueTypeUnit
pingPing delayNumberSeconds
jitterJitterNumberSeconds
speed_downDownload speedNumberBits per second
speed_upUpload speedNumberBits per second

§Examples

Show only ping (with an icon)

[[block]]
block = "speedtest"
format = " ^icon_ping $ping "

Hide ping and display speed in bytes per second each using 4 characters (without icons)

[[block]]
block = "speedtest"
format = " $speed_down.eng(w:4,u:B) $speed_up(w:4,u:B) "

Advanced configuration

[[block]]
block = "speedtest"
[block.latency]
runs = 5
[block.rpm]
conn_type = "h1"

§Icons Used

  • ping (^icon_ping)
  • net_down (^icon_net_down)
  • net_up (^icon_net_up)

Structs§

Config
LatencyConfigOpts
RpmConfigOpts
SpeedtestConfig