Struct surge_ping::Pinger[][src]

pub struct Pinger { /* 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);
}

Implementations

Creates a new Ping instance from IpAddr.

Sets the value for the SO_BINDTODEVICE option on this socket.

If a socket is bound to an interface, only packets received from that particular interface are processed by the socket. Note that this only works for some socket types, particularly AF_INET sockets.

If interface is None or an empty string it removes the binding.

This function is only available on Fuchsia and Linux.

Binds this socket to the specified address. This function directly corresponds to the bind(2) function on Windows and Unix.

Set the value of the IP_TTL option for this socket. This value sets the time-to-live field that is used in every packet sent from this socket.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. 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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.