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: usize

Implementations

Set the identification of ICMP.

Set the packet size.(default: 56)

The timeout of each Ping, in seconds. (default: 2s)

Send Ping request with sequence number.

Trait Implementations

Executes the destructor for this type. Read more

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

Performs the conversion.

Performs the conversion.

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.