a tool like speedtest-cli
, but in Rust and lacking a few things
Status: This is working at the moment. Download and upload testing is done.
This is a learning exercise for me to learn:
Plans may include a runtime-free tool (with musl especially) that can run against speedtest.net. Cross-compile this and maybe it can go anywhere! I also hope that this is less demanding on resources than the Python or Go versions.
This is currently based heavily on the popular Python implementation:
https://github.com/sivel/speedtest-cli @ 0.3.4
For now, it would only support speedtest.net and not Speedtest Mini.
There is also a Go version which is different from the other CLI speedtest clients I've found:
https://github.com/traetox/speedtest
It seems different as it appears to just use TCP connections and some protocol. It's probably more suitable to high-speed connections. I'll probably offer it as an alternative option that is also built-in.
speedtest-cli
and a bit about speedtest.net in general and about speedtest-go
The client
attributes are read.
client
's attributesip
- Your IP address.lat
- GeoIP'd Latitude of your locationlon
- GeoIP'd Longitude of your locationisp
- Your ISP name. e.g. "Time Warner Cable"In the original Python implementation, times
, download
, and upload
elements' attributes are also read.
times
- Saved in the Python implementation but it's not used throughout
the script.download
- Saved in the Python implementation. Not used either.upload
- Ditto.Deleting these unused elements (times
, download
, and upload
) still lets
the Python implementation work. As far as I know, they are unused. Judging
from the history of the original Python implementation, they were introduced
in the first commit but never removed and stayed in as further refactoring
was done.
server
attributes are read.
lat
- GeoIP'd Latitude of your locationlon
- GeoIP'd Longitude of your locationurl
- This is used as the endpoint that is used to calculate speeds.name
- Name of the server used.sponsor
- Sponsor of the serverhost
, id
, and country
but they are not used. host
is used in the TCP connection test (as in the Go version) which isn't supported yet here.client
attribute from the configuration.latency.txt
is downloaded from the "directory" where the file of the url
element is located. This is timed and 3 samples are made and then averaged by dividing by 6 (???, "It was purposeful."). Samples that aren't 200
or test=test
will have a sample of "1 hour" recorded. I think this is just a sentinel value to say "don't use this server".PING
and PONG
. (TODO)[350, 500, 750, 1000, 1500, 2000, 2500, 3000, 3500, 4000]
with random(size)x(size).jpg
, like /random350x350.jpg
from the fastest server.
speedtest-cli
is a file download that in the beginning has started and at the latter half is when the downloads are complete which is also when the trickling starts happening[250000(25 times), 500000(25 times)]
where bytes of a rolling 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
cycled to the desired size is posted as a request with that data
. This is timed. It is posted that url
that is in the server configuration.
Note that some of these operations are different on one particular Go version of the speedtest. In that version, tests are done to find an amount of data that can run for a default of 3 seconds. In particular, speedtest-cli
tests with what Ookla calls the "HTTP Legacy Fallback" for hosts that cannot establish a direct TCP connection.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.