Expand description
Bandwidth Authority metrics file parsing.
This module parses bandwidth files as described in Tor’s bandwidth-file-spec. These files contain relay bandwidth measurements collected by bandwidth authorities and are used to inform the consensus about relay capacities.
§Overview
Bandwidth files are produced by bandwidth scanners (like sbws) that measure the actual throughput of relays in the Tor network. Directory authorities use these measurements to assign bandwidth weights in the consensus, which affects how much traffic each relay receives.
§File Format Versions
The module supports multiple format versions:
| Version | Features |
|---|---|
| 1.0.0 | Basic format with timestamp and measurements only |
| 1.1.0 | Added header section with metadata |
| 1.2.0 | Added relay eligibility statistics |
| 1.3.0 | Added scanner location information |
| 1.4.0 | Added detailed measurement statistics |
§File Structure
<unix_timestamp>
version=1.4.0
software=sbws
... other headers ...
=====
bw=1000 node_id=$FINGERPRINT nick=RelayName ...
bw=2000 node_id=$FINGERPRINT nick=AnotherRelay ...§Example
use stem_rs::descriptor::bandwidth_file::BandwidthFile;
let content = r#"1547487689
node_id=$221C91D4C51E4C73CB6A8F0BEE01B0A6BB4A8476 bw=38000 nick=myrelay"#;
let bw_file = BandwidthFile::parse(content)?;
assert_eq!(bw_file.version, "1.0.0");
assert_eq!(bw_file.measurements.len(), 1);§See Also
- Bandwidth File Specification
- Python Stem’s
stem.descriptor.bandwidth_file
Structs§
- Bandwidth
File - Tor bandwidth authority measurements file.
- Bandwidth
Measurement - Bandwidth measurement data for a single relay.
- Recent
Stats - Statistical information collected over the recent data period.
- Relay
Failures - Summary of relay measurement failures by category.