Skip to main content

Crate irtt_client

Crate irtt_client 

Source
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§

CancellationToken
Cloneable cooperative cancellation flag.
Client
Low-level synchronous IRTT client.
ClientConfig
Configuration for opening and running an IRTT client session.
ClientTimestamp
Client-side timestamp captured in both wall-clock and monotonic time.
EventHub
Publish/subscribe fan-out for ClientEvent values.
EventSubscription
Handle for receiving managed client events.
ManagedClient
Entry point for running a client session on a worker thread.
ManagedClientSession
Running managed client session.
NegotiatedParams
Protocol parameters accepted for a session.
OneWayDelaySample
Directional one-way delay samples computed from wall-clock timestamps.
PacketMeta
Receive-side packet metadata observed outside the IRTT wire protocol.
ReceivedStatsSample
Server-reported receive counters decoded from an echo reply.
RecvBudget
Bound for a single receive-drain operation.
RttSample
Round-trip timing for one echo reply.
ServerTiming
Server-reported timing fields decoded from an echo reply.
SessionOutcome
Outcome returned by a completed managed client session.
SignedDuration
Signed nanosecond-backed duration used for derived timing values.
SocketConfig
Local UDP socket options used by ClientConfig.
SubscriberConfig
Configuration for one managed event subscriber.

Enums§

ClientError
Failure reported while configuring, opening, running, receiving, closing, or joining an IRTT client session.
ClientEvent
Event emitted by an IRTT client session.
EventSubscriptionError
Failure reported while setting up or receiving from an event subscription.
NegotiationPolicy
How strictly to handle server-side negotiation restrictions.
NegotiationRestriction
A server-side restriction applied during session parameter negotiation.
OpenOutcome
Result of the IRTT open exchange.
RunMode
Mode requested during the IRTT open exchange.
SessionEndReason
Reason a managed client session ended.
SubscriberOverflow
Overflow behavior for a bounded event subscription queue.
WarningKind
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_fill value, 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.