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.

§Modules

  • 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
  • upload — Multi-stream upload bandwidth measurement
  • error — Unified error types with categorization
  • formatter — Output formatting (detailed, simple, JSON, CSV)
  • grades — Quality grade system (A-F ratings)
  • history — Persistent test result history
  • http — HTTP client creation and IP discovery
  • profiles — User profiles/roles (gamer, streamer, etc.)
  • progress — Terminal progress bars and spinners
  • servers — Server discovery, distance calculation, and selection
  • task_runner — Test orchestration with template method pattern
  • types — Shared data structures (Server, TestResult, etc.)

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.