pub struct IcmpClient { /* private fields */ }Implementations§
Source§impl IcmpClient
impl IcmpClient
Sourcepub fn new(protocol: IcmpProtocol) -> Result<IcmpClient>
pub fn new(protocol: IcmpProtocol) -> Result<IcmpClient>
Examples found in repository?
examples/ping.rs (line 8)
7async fn main() -> Result<()> {
8 let client = IcmpClient::new(IcmpProtocol::Icmpv6)?;
9 let payload: [u8; 4] = [12u8, 14u8, 16u8, 32u8];
10 let result = client
11 .ping6(
12 Ipv6Addr::from_str("2606:4700:4700::1111")?,
13 0,
14 1,
15 &payload,
16 Duration::from_secs(10),
17 )
18 .await?;
19 println!("reply: {:?}", result);
20 Ok(())
21}pub async fn ping4( &self, addr: Ipv4Addr, id: u16, seq: u16, payload: &[u8], deadline: Duration, ) -> Result<Option<IcmpReply>>
Sourcepub async fn ping6(
&self,
addr: Ipv6Addr,
id: u16,
seq: u16,
payload: &[u8],
deadline: Duration,
) -> Result<Option<IcmpReply>>
pub async fn ping6( &self, addr: Ipv6Addr, id: u16, seq: u16, payload: &[u8], deadline: Duration, ) -> Result<Option<IcmpReply>>
Examples found in repository?
examples/ping.rs (lines 11-17)
7async fn main() -> Result<()> {
8 let client = IcmpClient::new(IcmpProtocol::Icmpv6)?;
9 let payload: [u8; 4] = [12u8, 14u8, 16u8, 32u8];
10 let result = client
11 .ping6(
12 Ipv6Addr::from_str("2606:4700:4700::1111")?,
13 0,
14 1,
15 &payload,
16 Duration::from_secs(10),
17 )
18 .await?;
19 println!("reply: {:?}", result);
20 Ok(())
21}Trait Implementations§
Source§impl Clone for IcmpClient
impl Clone for IcmpClient
Source§fn clone(&self) -> IcmpClient
fn clone(&self) -> IcmpClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for IcmpClient
impl !RefUnwindSafe for IcmpClient
impl Send for IcmpClient
impl Sync for IcmpClient
impl Unpin for IcmpClient
impl !UnwindSafe for IcmpClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request