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:
Nils Andreas Svee committed 2026-02-21 17:25:25 +07:00
1 parent f5d3776159
commit f3e7729f43
1 file changed
+1 -39
+1 -39
View File
@@ -1,50 +1,12 @@
use crate::pinger::{PingError, PingListener, PingReply, PingSender}; use crate::pinger::{PingError, PingListener, PingReply, PingSender};
use crate::time::Time; use crate::time::Time;
use icmp_socket::packet::IcmpPacketBuildError; use icmp_socket::packet::{IcmpPacketBuildError, WithTimestampRequest};
use icmp_socket::Icmpv4Message; use icmp_socket::Icmpv4Message;
use icmp_socket::Icmpv4Packet; use icmp_socket::Icmpv4Packet;
use rustix::thread::ClockId; use rustix::thread::ClockId;
use std::net::IpAddr; use std::net::IpAddr;
use std::time::Instant; 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 PingerICMPTimestampListener {}
pub struct PingerICMPTimestampSender {} pub struct PingerICMPTimestampSender {}