Skip to main content

netspeed_cli/domain/
speedtest.rs

1//! Full speed test lifecycle orchestration.
2//!
3//! This module provides the public API for running a complete speed test.
4//! Implementation delegates to the phases module.
5
6use crate::error::Error;
7use crate::orchestrator::Orchestrator;
8use crate::task_runner::TestRunResult;
9
10/// Run all test phases in sequence.
11///
12/// This is the main entry point for running a complete speed test.
13/// It executes phases in order: server discovery → IP discovery →
14/// ping test → download test → upload test → results.
15///
16/// # Errors
17///
18/// Returns various [`Error`] types depending on which phase fails.
19pub async fn run_all_phases(orch: &Orchestrator) -> Result<(), Error> {
20    // Delegate to phases module - eliminates duplicate logic
21    crate::phases::run_all_phases(orch).await
22}
23
24/// Phase results from all test phases.
25pub type PhaseResults = (
26    Option<(f64, f64, f64, Vec<f64>)>, // ping: (latency, jitter, packet_loss, samples)
27    Option<TestRunResult>,             // download result
28    Option<TestRunResult>,             // upload result
29);