A simple speedtest.net/fast.com-esque CLI for LibreSpeed servers written in POSIX shell
curlawkjqdd(used for upload payload generation)- A terminal that understands the standard ANSI cursor-hide/show sequences if you want the spinner to look correct
- any POSIX-capable shell
- Put the script in
$PATHsomewhere. Generally, on Linux, a good location is/usr/local/bin.
- Run the script with no arguments to autoselect the first server in Librespeeds public list and run a full latency/download/upload test
- Run with
--listto print the available servers and their IDs, then rerun with--server <id>to use a specific one - {download,upload} tests can be skipped with
--no-downloador--no-upload, an example using a specific server with a shorter duration and IPv4 only could belibrespeed.sh --server 51 --duration 5 -4
All configuration is via CLI flags.
--list- Print the server list (ID, name, hostname) and exit--server <id>- Use a specific server ID from--list, defaults to the first server in the Librespeed list--duration <seconds>- How long each throughput test (download, upload) runs for, defaults to10--concurrent <n>- Number of parallelcurlworkers per throughput test, defaults to8. Bump this on fast connections as needed, though, this will result in increased CPU usage--chunk-mb <mb>- Size of each download request in megabytes, passed asckSizetogarbage.php, defaults to100. Librespeeds backend caps this at 100 and the script will clamp anything higher--ping-count <n>- Number of latency samples to take. One extra is taken and dropped as a warmup, defaults to10.--timeout <seconds>-curl --connect-timeoutvalue, applied to every request, defaults to10--interface <name>- Bindcurlto a specific network interface, this is useful if you want to test a specific NIC or VPN interface as opposed to the default route--secure- Passcurl --ssl-reqd, forcing TLS on every request, this is off by default and most or all of Librespeeds servers are HTTPS already-4/-6- Force IPv4 or IPv6 respectively--no-download- Skip the download test--no-upload- Skip the upload test--debug- After each throughput test, print a per-worker breakdown of bytes transferred, test duration, and resulting Mbit/s, off by default. This can be useful if your results look wrong and you want to see if a worker stalled
The server list is pulled from https://librespeed.org/backend-servers/servers.php at runtime, so the available servers are whatever Librespeed currently has in that list.
- Yes, Librespeed already has a CLI client- I got tired of compiling it for use all over the place as not everything has it packaged and chose to write one in shell to solve that.
- The script hides the terminal cursor while running and restores it on exit via an
EXIT/INT/TERM/HUPtrap, so if youkill -9the script the cursor will stay hidden- runtput cnormorprintf '\033[?25h'to get your cursor back - This was fucking difficult.