1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Project-wide constants. Centralizes magic numbers so they are not
//! duplicated across modules.
use Duration;
/// Timeout for non-critical startup requests (/meta, /locations, /cdn-cgi/trace).
pub const META_FETCH_TIMEOUT: Duration = from_secs;
/// Per-connection TCP connect timeout for the speed-test HTTP client. Kept
/// short so that when a family is pinned via `--ipv4-only` / `--ipv6-only` and
/// that family has no working route, connects fail fast instead of stalling on
/// the overall request timeout.
pub const HTTP_CONNECT_TIMEOUT: Duration = from_secs;
/// Fraction of a throughput phase treated as ramp-up (TCP slow start / buffer
/// fill) and excluded from steady-state reporting and stability CV.
pub const STEADY_STATE_RAMP_FRACTION: f64 = 0.20;
/// Minimum ramp-up exclusion regardless of phase length.
pub const STEADY_STATE_MIN_RAMP: Duration = from_secs;
/// Poll cadence while a phase or worker waits for a pause to lift.
pub const PAUSE_POLL_INTERVAL: Duration = from_millis;
/// Backoff after a failed throughput request so an unreachable server does
/// not turn the workers into a hot loop.
pub const WORKER_ERROR_BACKOFF: Duration = from_millis;
/// Per-probe response deadline for the UDP loss probe.
pub const UDP_PROBE_TIMEOUT: Duration = from_millis;
/// Delay between UDP loss probes.
pub const UDP_PROBE_INTERVAL: Duration = from_millis;
/// Latency probes per family in the IPv4-vs-IPv6 comparison (median reported).
pub const IP_COMPARISON_LATENCY_PROBES: usize = 5;
/// Waveform-style bufferbloat thresholds: (max latency increase in ms, grade).
/// The first row whose threshold the measured value is <= to wins.
/// `f64::INFINITY` serves as the catch-all for F.
pub const BUFFERBLOAT_THRESHOLDS: & = &;
/// Stability thresholds: (max coefficient of variation in percent, grade).
/// First matching row wins. Calibrated against typical observed CV ranges
/// (wired fiber ~2-4%, decent Wi-Fi ~8-15%, congested ~20%+).
pub const STABILITY_THRESHOLDS: & = &;
/// Sentinel grade used in `ConnectionQuality` when one half (bufferbloat
/// or stability) cannot be computed but the other can. Single-character
/// hyphen, never the em dash.
pub const GRADE_UNAVAILABLE: &str = "-";
/// Minimum number of throughput samples required to compute a CV
/// (stddev of fewer than 3 samples is meaningless).
pub const MIN_STABILITY_SAMPLES: usize = 3;
/// Cadence at which the download/upload loops sample cumulative bytes and emit
/// a `ThroughputTick`. Also serves as the minimum steady-state window length:
/// a window shorter than one full interval carries too little signal to report.
pub const THROUGHPUT_SAMPLE_INTERVAL: Duration = from_millis;
/// Minimum number of additional history entries fetched per lazy-load request
/// when the History tab selection nears the end of the loaded window.
pub const HISTORY_LOAD_CHUNK_MIN: usize = 20;
/// Trigger history lazy-loading when the selection is within this many rows of
/// the end of the visible (filtered) list.
pub const HISTORY_LAZY_LOAD_THRESHOLD: usize = 10;
/// Rows PageUp/PageDown jump by in the History tab.
pub const HISTORY_PAGE_SIZE: usize = 20;