Expand description
§netspeed-cli
A command-line internet bandwidth tester using speedtest.net servers.
§Overview
This crate provides both a library and a binary (netspeed-cli) for
measuring download speed, upload speed, latency, jitter, and latency
under load. It connects to speedtest.net’s server infrastructure to
perform real-world bandwidth tests.
§Key Features
- Multi-format output: dashboard, detailed, compact, simple, minimal, JSON, JSONL, CSV
- Theming: dark, light, high-contrast, monochrome with
NO_COLORsupport - User profiles: gamer, streamer, remote-worker, power-user, casual
- Quality grading: A–F ratings for each metric and an overall score
- Latency under load: measures ping degradation during bandwidth saturation
- Test history: persistent local storage with backup and corruption recovery
- TLS options: custom CA certs, domain-restricted TLS, configurable TLS version
§Modules
bandwidth_loop— Inner bandwidth measurement loop with live progressbin_errors— Binary-level error handling and exit codescli— Command-line argument parsing with clapcommon— Shared utilities (bandwidth calculation, formatting, validation)config— Configuration management (CLI args + config file)domain— Core business logic (measurement, reporting, server, speedtest)download— Multi-stream download bandwidth measurementendpoints— Canonical speedtest endpoint derivationerror— Unified error types with categorizationformatter— Output formatting (dashboard, detailed, compact, simple, JSON, CSV)grades— Quality grade system (A–F ratings)history— Persistent test result history with sparkline trendshttp— HTTP client creation and IP discoveryhttp_client— Typed HTTP client abstractionlogging— Structured JSON loggingorchestrator— Top-level test orchestration and service wiringoutput— Output dispatch and renderingoutput_strategy— Format resolution from config and flagsphase_registry— Phase registration and lookupphase_runner— Phase execution with template method patternphases— Phase context and executor definitionsprofiles— User profiles/roles (gamer, streamer, etc.)progress— Terminal progress bars, spinners, and sparklinesresult_processor— Result aggregation and processingservers— Server discovery, distance calculation, and selectionservices— Service container for dependency injectionstorage— Abstract storage trait for test resultstask_runner— Test orchestration with retry and timeoutterminal— Terminal capability detection (color, animation, width)test_config— Per-test configuration (retries, stream count)theme— Color theming (Dark, Light, HighContrast, Monochrome)types— Shared data structures (Server, TestResult, etc.)upload— Multi-stream upload bandwidth measurement
Modules§
- bandwidth_
loop - Shared bandwidth measurement loop for download/upload tests.
- bin_
errors - Binary-level error handling for netspeed-cli.
- cli
- common
- Common shared utilities used across download, upload, formatting, and progress modules.
- config
- domain
- Domain layer for netspeed-cli.
- download
- Multi-stream download bandwidth measurement.
- endpoints
- Speedtest server endpoint derivation.
- error
- formatter
- Output formatting for speed test results.
- grades
- Comprehensive quality grade system (A-F) for all connection metrics.
- history
- http
- http_
client - Abstraction over HTTP client used by phases.
- logging
- Structured logging infrastructure for netspeed-cli.
- orchestrator
- Orchestrates the full speed test lifecycle.
- output
- Output handling trait for extensibility.
- output_
strategy - Output format resolution — extracts format selection from Config into
an
OutputFormatstrategy (Strategy pattern, OCP-compliant). - phase_
registry - Registry for phase functions allowing open/closed extension.
- phase_
runner - Trait to run all test phases. Allows custom implementations for testing.
- phases
- Phase definitions for the speed test lifecycle.
- profiles
- User profiles/roles that customize output based on use case.
- progress
- Terminal progress bars and spinners for test feedback.
- result_
processor - Responsible for grading test results.
- servers
- services
- Service abstractions for dependency injection.
- storage
- Result storage trait for test results.
- task_
runner - Test runner orchestration for download and upload bandwidth tests.
- terminal
- Terminal environment detection and abstraction.
- test_
config - Centralized test configuration constants.
- theme
- Color theme system for terminal output.
- types
- upload
- Multi-stream upload bandwidth measurement.