pub struct CircuitBandwidthEvent {
pub id: CircuitId,
pub read: u64,
pub written: u64,
pub delivered_read: Option<u64>,
pub delivered_written: Option<u64>,
pub overhead_read: Option<u64>,
pub overhead_written: Option<u64>,
pub time: Option<DateTime<Utc>>,
/* private fields */
}Expand description
Event providing bandwidth information for a specific circuit.
Unlike BandwidthEvent which provides aggregate bandwidth, this event
tracks bandwidth usage per circuit. This is useful for monitoring
individual connections or identifying high-bandwidth circuits.
§Example
use stem_rs::events::CircuitBandwidthEvent;
fn handle_circ_bw(event: &CircuitBandwidthEvent) {
println!("Circuit {} bandwidth: {} read, {} written",
event.id, event.read, event.written);
if let Some(time) = &event.time {
println!(" at {}", time);
}
}§See Also
BandwidthEvent- Aggregate bandwidthConnectionBandwidthEvent- Per-connection bandwidth
Fields§
§id: CircuitIdCircuit identifier.
read: u64Bytes read on this circuit.
written: u64Bytes written on this circuit.
delivered_read: Option<u64>User payload bytes received on this circuit (if available).
This field was added in Tor 0.4.1.1-alpha and represents the actual user data received, excluding cell overhead.
delivered_written: Option<u64>User payload bytes sent on this circuit (if available).
This field was added in Tor 0.4.1.1-alpha and represents the actual user data sent, excluding cell overhead.
overhead_read: Option<u64>Overhead bytes received on this circuit (if available).
This field was added in Tor 0.4.1.1-alpha and represents padding added to make cells a fixed length.
overhead_written: Option<u64>Overhead bytes sent on this circuit (if available).
This field was added in Tor 0.4.1.1-alpha and represents padding added to make cells a fixed length.
time: Option<DateTime<Utc>>Timestamp of the measurement (if available).
Implementations§
Source§impl CircuitBandwidthEvent
impl CircuitBandwidthEvent
Sourcepub fn parse(content: &str) -> Result<Self, Error>
pub fn parse(content: &str) -> Result<Self, Error>
Parses a circuit bandwidth event from raw control protocol content.
§Arguments
content- The event content after the event type
§Event Format
ID=CircuitID READ=bytes WRITTEN=bytes [DELIVERED_READ=bytes] [DELIVERED_WRITTEN=bytes]
[OVERHEAD_READ=bytes] [OVERHEAD_WRITTEN=bytes] [TIME=timestamp]The DELIVERED_* and OVERHEAD_* fields were added in Tor 0.4.1.1-alpha.
§Errors
Returns Error::Protocol if:
- Required fields (ID, READ, WRITTEN) are missing
- Numeric values cannot be parsed
Trait Implementations§
Source§impl Clone for CircuitBandwidthEvent
impl Clone for CircuitBandwidthEvent
Source§fn clone(&self) -> CircuitBandwidthEvent
fn clone(&self) -> CircuitBandwidthEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more