pub struct PingRunnerCore { /* private fields */ }
Implementations§
Source§impl PingRunnerCore
impl PingRunnerCore
Sourcepub fn new(
config: RnpPingRunnerConfig,
stop_event: Arc<ManualResetEvent>,
) -> PingRunnerCore
pub fn new( config: RnpPingRunnerConfig, stop_event: Arc<ManualResetEvent>, ) -> PingRunnerCore
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);
});
Sourcepub async fn run_warmup_pings(&mut self)
pub async fn run_warmup_pings(&mut self)
Run all warm up pings one by one and wait until they are all completed.
Sourcepub fn start_running_normal_pings(&mut self)
pub fn start_running_normal_pings(&mut self)
Start running all normal pings in the way that matches the specified config.
Auto Trait Implementations§
impl Freeze for PingRunnerCore
impl !RefUnwindSafe for PingRunnerCore
impl Send for PingRunnerCore
impl Sync for PingRunnerCore
impl Unpin for PingRunnerCore
impl !UnwindSafe for PingRunnerCore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more