Expand description
Protocol-agnostic network link measurement for Rust.
linkprobe-core provides shared types, server discovery, measurement backends, and
OpenMetrics formatting. The linkprobe CLI
crate adds argument parsing, MQTT publish, and an HTTP scrape endpoint on top of this
library.
Use this crate when you want to embed link measurement in an agent, dashboard, or test harness. Use the CLI when you want a ready-made probe with JSON, Prometheus, and MQTT exporters.
§Backends
All engines implement MeasurementEngine and run synchronously (blocking HTTP or a
subprocess). Pick the backend that matches your endpoint:
| Backend | Type | Requires | Typical fields |
|---|---|---|---|
| LibreSpeed | LibreSpeedEngine | Outbound HTTPS | latency, jitter, download, upload |
| iperf3 | Iperf3Engine | iperf3 on PATH | latency, jitter, download, upload; UDP adds packet loss |
Optional fields on Measurement mean the backend did not report that metric for the run
(for example TCP iperf3 has no packet loss).
§Example
use linkprobe_core::backends::LibreSpeedEngine;
use linkprobe_core::{MeasurementEngine, Server};
let server = Server::librespeed("https://example-librespeed/");
let engine = LibreSpeedEngine::new()?;
let measurement = engine.measure(&server)?;
if let Some(ms) = measurement.latency_ms {
println!("latency: {ms:.1} ms");
}Discovery helpers such as fetch_librespeed_servers and rank_by_latency need a
network connection. See FAILOVER_EXTRA for list rotation behavior used by the CLI.
Re-exports§
pub use export::format_openmetrics;pub use export::format_openmetrics_failed;
Modules§
Structs§
- Measurement
- Result of one link measurement against a server.
- RunResult
- Outcome of one completed probe, suitable for JSON serialization or OpenMetrics export.
- Server
- Target server for a link measurement.
- Throughput
- Throughput in bits per second.
Enums§
- Error
- Failure from discovery, measurement, or export helpers.
Constants§
- DEFAULT_
IPER F3_ SERVERS_ URL - DEFAULT_
LIBRESPEED_ SERVERS_ URL - FAILOVER_
EXTRA - How many additional list servers the CLI may try after the preferred host fails
(auto-pick and
--server-idonly; explicit--serverURLs do not rotate).
Traits§
- Measurement
Engine - Runs latency, download, upload, and optional packet-loss measurement against a
Server.
Functions§
- failover_
candidates - Build a probe order:
preferredfirst, then up toextraother servers by ping rank. - fetch_
iperf3_ servers - Download and parse an iperf3 server list from
list_url. - fetch_
librespeed_ servers - Download and parse a LibreSpeed server list from
list_url. - parse_
iperf3_ servers - Parse an iperf3 public server list JSON document into
Servervalues. - parse_
librespeed_ servers - Parse a LibreSpeed server list JSON document into
Servervalues. - pick_
lowest_ latency - Return the server with the lowest ping latency, or an error if none responded.
- rank_
by_ latency - Ping servers and return those that responded, sorted by ascending latency (ms).
- server_
by_ id - Look up a server by numeric list id (string match on
Server::id). - servers_
list_ url - Pick the default iperf3 list URL when the CLI still has the LibreSpeed default configured.