Struct surge_ping::Pinger
source · pub struct Pinger {
pub host: IpAddr,
pub ident: Option<PingIdentifier>,
/* private fields */
}Expand description
A Ping struct represents the state of one particular ping instance.
Fields§
§host: IpAddr§ident: Option<PingIdentifier>Implementations§
source§impl Pinger
impl Pinger
sourcepub fn timeout(&mut self, timeout: Duration) -> &mut Pinger
pub fn timeout(&mut self, timeout: Duration) -> &mut Pinger
The timeout of each Ping, in seconds. (default: 2s)
sourcepub async fn ping(
&mut self,
seq: PingSequence,
payload: &[u8]
) -> Result<(IcmpPacket, Duration), SurgeError>
pub async fn ping( &mut self, seq: PingSequence, payload: &[u8] ) -> Result<(IcmpPacket, Duration), SurgeError>
Send Ping request with sequence number.
sourcepub async fn send_ping(
&self,
seq: PingSequence,
payload: &[u8]
) -> Result<(), SurgeError>
pub async fn send_ping( &self, seq: PingSequence, payload: &[u8] ) -> Result<(), SurgeError>
Send a ping packet (useful, when you don’t need a reply).