pub struct PingRunnerCore { /* private fields */ }

Implementations

Take the config and stop event and generate the RnpCore which runs all the pings.

Arguments
  • config: The configuration of Rnp.
  • stop_event: The event to signal Rnp to stop.

returns: RnpCore

Examples
use rnp::*;
use std::ops::Range;
use std::time::Duration;
use std::sync::Arc;
use futures_intrusive::sync::ManualResetEvent;
use tokio::runtime::Runtime;

let config = RnpPingRunnerConfig {
    worker_config: PingWorkerConfig {
        protocol: RnpSupportedProtocol::TCP,
        target: "10.0.0.1:443".parse().unwrap(),
        source_ip: "10.0.0.2".parse().unwrap(),
        ping_interval: Duration::from_millis(1500),
        ping_client_config: PingClientConfig {
            wait_timeout: Duration::from_millis(1000),
            time_to_live: Some(128),
            check_disconnect: false,
            wait_before_disconnect: Duration::ZERO,
            disconnect_timeout: Duration::from_millis(2000),
            server_name: None,
            log_tls_key: false,
            alpn_protocol: None,
            use_timer_rtt: false,
        },
    },
    worker_scheduler_config: PingWorkerSchedulerConfig {
        source_ports: PortRangeList {
            ranges: vec![(1024..=2048), (3096..=3096), (3097..=3097)]
        },
        ping_count: Some(4),
        warmup_count: 1,
        parallel_ping_count: 1,
    },
    result_processor_config: PingResultProcessorConfig {
        common_config: PingResultProcessorCommonConfig {
            quiet_level: RNP_QUIET_LEVEL_NONE,
        },
        exit_on_fail: false,
        exit_failure_reason: None,
        csv_log_path: None,
        json_log_path: None,
        text_log_path: None,
        show_result_scatter: false,
        show_latency_scatter: false,
        latency_buckets: None,
    },
    external_ping_client_factory: None,
    extra_ping_result_processors: vec![],
};

let rt = Runtime::new().unwrap();
rt.block_on(async {
    let stop_event = Arc::new(ManualResetEvent::new(false));
    let core = PingRunnerCore::new(config, stop_event);
});

Run all warm up pings one by one and wait until they are all completed.

Start running all normal pings in the way that matches the specified config.

Wait for all pings to complete.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more