refactor: Removes redundant trait implementation
Removes the duplicate `WithTimestampRequest` trait implementation as it's now provided by the `icmp-socket` crate fork.
This commit is contained in:
1 file changed
+1
-39
+1
-39
@@ -1,50 +1,12 @@
|
||||
use crate::pinger::{PingError, PingListener, PingReply, PingSender};
|
||||
use crate::time::Time;
|
||||
use icmp_socket::packet::IcmpPacketBuildError;
|
||||
use icmp_socket::packet::{IcmpPacketBuildError, WithTimestampRequest};
|
||||
use icmp_socket::Icmpv4Message;
|
||||
use icmp_socket::Icmpv4Packet;
|
||||
use rustix::thread::ClockId;
|
||||
use std::net::IpAddr;
|
||||
use std::time::Instant;
|
||||
|
||||
/// Construct a packet for the TimestampRequest messages.
|
||||
pub trait WithTimestampRequest {
|
||||
type Packet;
|
||||
|
||||
fn with_timestamp_request(
|
||||
identifier: u16,
|
||||
sequence: u16,
|
||||
originate: u32,
|
||||
receive: u32,
|
||||
transmit: u32,
|
||||
) -> Result<Self::Packet, IcmpPacketBuildError>;
|
||||
}
|
||||
|
||||
impl WithTimestampRequest for Icmpv4Packet {
|
||||
type Packet = Icmpv4Packet;
|
||||
|
||||
fn with_timestamp_request(
|
||||
identifier: u16,
|
||||
sequence: u16,
|
||||
originate: u32,
|
||||
receive: u32,
|
||||
transmit: u32,
|
||||
) -> Result<Self::Packet, IcmpPacketBuildError> {
|
||||
Ok(Self {
|
||||
typ: 13,
|
||||
code: 0,
|
||||
checksum: 0,
|
||||
message: Icmpv4Message::Timestamp {
|
||||
identifier,
|
||||
sequence,
|
||||
originate,
|
||||
receive,
|
||||
transmit,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PingerICMPTimestampListener {}
|
||||
|
||||
pub struct PingerICMPTimestampSender {}
|
||||
|
||||
Reference in new issue
Block a user