๐ CLI Speedtest (Rust)
A blazing-fast, high-performance CLI speedtest tool written in Rust. Designed for modern developers and system administrators who need accurate, machine-readable network performance metrics without the bloat.
โจ Features
- Interactive Menu: User-friendly TTY menu for quick tests, settings, and help.
- Blazing Fast: Powered by
tokiofor asynchronous, non-blocking I/O. - High Concurrency: Multi-threaded download and upload tests using
tokiotasks andBarriersynchronization to saturate high-speed connections. - Production Grade:
- Warm-up Phase: Includes a 2-second warm-up period to avoid TCP slow-start bias for more consistent results.
- Retry Logic: Built-in exponential backoff for failed network requests.
- Comprehensive Metrics:
- Latency: Min, Max, Average, Jitter, and Packet Loss.
- Throughput: Real-time Mbps for both Download and Upload.
- Visual Polish: Semantic color-coding and live rolling-speed displays.
- Machine-Readable: Use the
--jsonflag for clean, parseable output perfect for cron jobs and monitoring. - Graceful Degradation: Automatically disables color and interactive features when piped or in non-TTY environments. Respects the
NO_COLORenvironment variable.
๐ ๏ธ Installation
From Source
You will need the Rust toolchain installed.
The binary will be available at target/release/cli-speedtest.
๐ Usage
Interactive Mode
Simply run the binary without flags to enter the interactive menu:
Direct Run (Scripting Friendly)
Pass any configuration flag to bypass the menu and run directly:
| Flag | Description | Default |
|---|---|---|
-d, --duration <SECS> |
Length of the test in seconds | 10 |
-c, --connections <N> |
Number of parallel connections | 8 (DL), 4 (UL) |
--server <URL> |
Custom target server URL | Cloudflare |
--ping-count <N> |
Number of pings to send | 20 |
--no-download |
Skip the download test | - |
--no-upload |
Skip the upload test | - |
--json |
Output results in JSON format | - |
--no-color |
Disable terminal styling | - |
--debug |
Enable verbose logging | - |
Examples
# Run a 5-second test with 12 connections
# Skip upload test and get JSON output
# Use a custom server
๐ JSON Output Schema
When running with --json, the tool returns a structured object:
๐งช Testing
The project includes unit tests for core logic and integration tests using mock servers.
๐๏ธ Project Structure
src/main.rs: Entry point and CLI routing logic usingclap.src/lib.rs: Core orchestration logic for ping, download, and upload phases.src/client.rs: High-concurrency networking implementation usingtokioandreqwest.src/menu.rs: Interactive TTY menu and settings usingdialoguer.src/models.rs: Data structures and JSON serialization models.src/utils.rs: Technical constants (likeWARMUP_SECS) and measurement math.src/theme.rs: ANSI color system and UI rendering helpers.
๐ค Contributing
Feel free to open issues or submit pull requests to improve the tool!
๐ License
Distributed under the Apache License 2.0. See LICENSE for more information.
Built with โค๏ธ by Tirso Benedict J. Naza