mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +00:00
fix(lib socket): feature gate local_addr to capture
This commit is contained in:
parent
c82dc7d653
commit
3964735af8
1 changed files with 5 additions and 0 deletions
|
|
@ -61,6 +61,7 @@ pub trait Socket {
|
|||
///
|
||||
/// # Returns
|
||||
/// The local SocketAddr.
|
||||
#[cfg(feature = "packet_capture")]
|
||||
fn local_addr(&self) -> std::io::Result<SocketAddr>;
|
||||
}
|
||||
|
||||
|
|
@ -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<SocketAddr> { 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<SocketAddr> { self.socket.local_addr() }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue