use smoltcp::{time::Instant, wire::IpAddress};
use crate::{config::InterfaceId, device::Device};
pub struct LoopbackDevice;
impl LoopbackDevice {
pub fn new() -> Self {
Self
}
}
impl Device for LoopbackDevice {
fn name(&self) -> &str {
"lo"
}
fn recv(
&mut self,
_interface_id: InterfaceId,
_buffer: &mut smoltcp::storage::PacketBuffer<InterfaceId>,
_timestamp: Instant,
_snoop: &mut dyn FnMut(&[u8]),
) -> bool {
false
}
fn send(&mut self, _next_hop: IpAddress, _packet: &[u8], _timestamp: Instant) -> bool {
true
}
}