Struct surge_ping::Pinger
source ·
[−]pub struct Pinger {
pub destination: IpAddr,
pub ident: u16,
pub size: usize,
// some fields omitted
}Expand description
A Ping struct represents the state of one particular ping instance.
Examples
use std::time::Duration;
use surge_ping::Pinger;
#[tokio::main]
async fn main() {
let mut pinger = Pinger::new("114.114.114.114".parse().unwrap()).unwrap();
pinger.size(56).timeout(Duration::from_secs(1));
let result = pinger.ping(0).await;
println!("{:?}", result);
}Fields
destination: IpAddrident: u16size: usizeImplementations
The timeout of each Ping, in seconds. (default: 2s)
Send Ping request with sequence number.
