Expand description
Bandwidth estimation and congestion detection for the CHIE protocol.
This module provides real-time bandwidth estimation and congestion detection capabilities to optimize content delivery and prevent network overload.
§Features
- Real-time bandwidth estimation using exponentially weighted moving averages
- Congestion detection through packet loss and latency variation
- Adaptive rate limiting based on network conditions
- Historical bandwidth tracking and statistics
§Example
use chie_core::bandwidth_estimation::{BandwidthEstimator, EstimatorConfig};
let config = EstimatorConfig::default();
let mut estimator = BandwidthEstimator::new(config);
// Record a data transfer
estimator.record_transfer(1024 * 1024, 100); // 1 MB in 100ms
// Get current estimate
let bandwidth_mbps = estimator.estimate_mbps();
println!("Estimated bandwidth: {:.2} Mbps", bandwidth_mbps);
// Check for congestion
if estimator.is_congested() {
println!("Network is congested, reducing rate");
}Structs§
- Bandwidth
Estimator - Bandwidth estimator with congestion detection.
- Bandwidth
Stats - Bandwidth estimation statistics.
- Estimator
Config - Configuration for bandwidth estimator.
Enums§
- Congestion
State - Congestion state.