Skip to main content

netrunner_core/
lib.rs

1//! # netrunner-core
2//!
3//! Framework-free internet speed-test and network-diagnostics engine shared by
4//! the `netrunner_cli` (Ratatui TUI) and `netrunner` (Zed GPUI desktop) apps,
5//! and usable as a standalone library.
6//!
7//! | Module | What lives here |
8//! |--------|-----------------|
9//! | [`types`] | Domain models — results, servers, config, quality ratings, diagnostics |
10//! | [`speed_test`] | Geolocation, server discovery/selection, throughput & latency measurement ([`SpeedTest`]) |
11//! | [`diagnostics`] | Gateway/DNS/route/IPv6 network diagnostics ([`NetworkDiagnosticsTool`]) |
12//! | [`history`] | Embedded `redb` history storage & statistics ([`HistoryStorage`]) |
13//! | [`events`] | UI-agnostic progress events ([`TestEvent`]) streamed over a channel |
14//!
15//! This crate has **no GUI or TUI dependencies**. Progress is reported through
16//! [`TestEvent`]s so any front-end can render it.
17//!
18//! ## Quick start
19//!
20//! ```no_run
21//! use netrunner_core::{SpeedTest, TestConfig};
22//!
23//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
24//! let test = SpeedTest::new(TestConfig::default())?;
25//! let result = test.run_full_test().await?;
26//! println!("{:.1} Mbps down / {:.1} Mbps up", result.download_mbps, result.upload_mbps);
27//! # Ok(())
28//! # }
29//! ```
30
31pub mod diagnostics;
32pub mod events;
33pub mod history;
34pub mod presentation;
35pub mod settings;
36pub mod speed_test;
37pub mod types;
38
39// Convenience re-exports — the public surface most consumers need.
40pub use diagnostics::NetworkDiagnosticsTool;
41pub use events::{emit, EventSender, Phase, SelectedServer, TestEvent};
42pub use history::{DbStats, HistoryStorage, SpeedTrends, TestStatistics};
43pub use presentation::{palette, quality_rgb};
44pub use settings::Settings;
45pub use speed_test::{GeoLocation, SpeedTest};
46pub use types::{
47    ConnectionQuality, DetailLevel, NetworkDiagnostics, RouteHop, ServerCapabilities,
48    ServerProvider, SpeedTestResult, TestConfig, TestServer,
49};