From 3964735af8982f50c4e7c565cac0f3267f5e9466 Mon Sep 17 00:00:00 2001 From: Cain <75994858+cainthebest@users.noreply.github.com> Date: Thu, 26 Sep 2024 23:23:42 +0100 Subject: [PATCH] fix(lib socket): feature gate local_addr to capture --- crates/lib/src/socket.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/lib/src/socket.rs b/crates/lib/src/socket.rs index 6161592..c76d0ef 100644 --- a/crates/lib/src/socket.rs +++ b/crates/lib/src/socket.rs @@ -61,6 +61,7 @@ pub trait Socket { /// /// # Returns /// The local SocketAddr. + #[cfg(feature = "packet_capture")] fn local_addr(&self) -> std::io::Result; } @@ -112,6 +113,8 @@ impl Socket for TcpSocketImpl { } fn port(&self) -> u16 { self.address.port() } + + #[cfg(feature = "packet_capture")] fn local_addr(&self) -> std::io::Result { self.socket.local_addr() } } @@ -164,6 +167,8 @@ impl Socket for UdpSocketImpl { } fn port(&self) -> u16 { self.address.port() } + + #[cfg(feature = "packet_capture")] fn local_addr(&self) -> std::io::Result { self.socket.local_addr() } }