speed-cli 1.0.0

Comprehensive multi-protocol network performance testing CLI (TCP, UDP, QUIC, HTTP/1.1, HTTP/2, h2c, HTTP/3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use humansize::{BINARY, ToF64, Unsigned, format_size};

/// Format bytes using binary prefixes (KiB, MiB, etc.)
pub fn format_bytes(bytes: impl ToF64 + Unsigned) -> String {
    format_size(bytes, BINARY)
}

/// Format values for network throughput from Mbps
pub fn format_throughput(mbps: f64) -> String {
    if mbps >= 1000.0 {
        format!("{:.2} Gbps", mbps / 1000.0)
    } else {
        format!("{mbps:.2} Mbps")
    }
}