Expand description
Reusable client/session/event layer for IRTT-compatible probes.
irtt-client opens IRTT-compatible sessions, sends echo probes, receives
replies, classifies loss/late/duplicate packets, and emits ClientEvent
values for callers to consume directly or aggregate with irtt-stats.
Timing values intentionally preserve signed measurement semantics. When
server timing is available, RttSample::effective is adjusted for server
processing and can be negative if the reported server processing time exceeds
the raw client-observed RTT. Directional OneWayDelaySample values are
also signed when the required wall-clock timestamps are available; negative
values usually indicate client/server clock skew.
A managed session can drive the socket loop on a worker thread and publish events through a subscription:
use std::time::Duration;
use irtt_client::{ClientConfig, ClientEvent, ManagedClient, SubscriberConfig};
let config = ClientConfig {
server_addr: "127.0.0.1:2112".to_owned(),
duration: Some(Duration::from_secs(10)),
interval: Duration::from_secs(1),
..ClientConfig::default()
};
let (session, events) =
ManagedClient::start_with_subscription(config, SubscriberConfig::default())?;
while let Ok(event) = events.recv() {
match event {
ClientEvent::EchoReply { seq, rtt, .. } => {
println!("seq={seq} effective_rtt_us={}", rtt.effective.as_micros());
}
ClientEvent::SessionClosed { .. } => break,
_ => {}
}
}
let _outcome = session.join()?;Structs§
- Cancellation
Token - Cloneable cooperative cancellation flag.
- Client
- Low-level synchronous IRTT client.
- Client
Config - Configuration for opening and running an IRTT client session.
- Client
Timestamp - Client-side timestamp captured in both wall-clock and monotonic time.
- Event
Hub - Publish/subscribe fan-out for
ClientEventvalues. - Event
Subscription - Handle for receiving managed client events.
- Managed
Client - Entry point for running a client session on a worker thread.
- Managed
Client Session - Running managed client session.
- Negotiated
Params - Protocol parameters accepted for a session.
- OneWay
Delay Sample - Directional one-way delay samples computed from wall-clock timestamps.
- Packet
Meta - Receive-side packet metadata observed outside the IRTT wire protocol.
- Received
Stats Sample - Server-reported receive counters decoded from an echo reply.
- Recv
Budget - Bound for a single receive-drain operation.
- RttSample
- Round-trip timing for one echo reply.
- Server
Timing - Server-reported timing fields decoded from an echo reply.
- Session
Outcome - Outcome returned by a completed managed client session.
- Signed
Duration - Signed nanosecond-backed duration used for derived timing values.
- Socket
Config - Local UDP socket options used by
ClientConfig. - Subscriber
Config - Configuration for one managed event subscriber.
Enums§
- Client
Error - Failure reported while configuring, opening, running, receiving, closing, or joining an IRTT client session.
- Client
Event - Event emitted by an IRTT client session.
- Event
Subscription Error - Failure reported while setting up or receiving from an event subscription.
- Negotiation
Policy - How strictly to handle server-side negotiation restrictions.
- Negotiation
Restriction - A server-side restriction applied during session parameter negotiation.
- Open
Outcome - Result of the IRTT open exchange.
- RunMode
- Mode requested during the IRTT open exchange.
- Session
EndReason - Reason a managed client session ended.
- Subscriber
Overflow - Overflow behavior for a bounded event subscription queue.
- Warning
Kind - Category for a non-fatal
ClientEvent::Warning.
Constants§
- MAX_
DSCP_ CODEPOINT - Largest valid DSCP codepoint accepted by client configuration.
- MAX_
SERVER_ FILL_ BYTES - Protocol compatibility bound for a requested
server_fillvalue, in UTF-8 bytes. - MAX_TTL
- Largest IPv4 TTL or IPv6 hop-limit value accepted by client configuration.
- MAX_
UDP_ PAYLOAD_ LENGTH - Largest UDP payload length accepted by client configuration, in bytes.