Skip to main content

Crate netspeed_cli

Crate netspeed_cli 

Source
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_COLOR support
  • 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 progress
  • bin_errors — Binary-level error handling and exit codes
  • cli — Command-line argument parsing with clap
  • common — 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 measurement
  • endpoints — Canonical speedtest endpoint derivation
  • error — Unified error types with categorization
  • formatter — Output formatting (dashboard, detailed, compact, simple, JSON, CSV)
  • grades — Quality grade system (A–F ratings)
  • history — Persistent test result history with sparkline trends
  • http — HTTP client creation and IP discovery
  • http_client — Typed HTTP client abstraction
  • logging — Structured JSON logging
  • orchestrator — Top-level test orchestration and service wiring
  • output — Output dispatch and rendering
  • output_strategy — Format resolution from config and flags
  • phase_registry — Phase registration and lookup
  • phase_runner — Phase execution with template method pattern
  • phases — Phase context and executor definitions
  • profiles — User profiles/roles (gamer, streamer, etc.)
  • progress — Terminal progress bars, spinners, and sparklines
  • result_processor — Result aggregation and processing
  • servers — Server discovery, distance calculation, and selection
  • services — Service container for dependency injection
  • storage — Abstract storage trait for test results
  • task_runner — Test orchestration with retry and timeout
  • terminal — 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 OutputFormat strategy (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.