pub struct IcmpConfig {
pub socket_family: SocketFamily,
pub bind: Option<SocketAddr>,
pub ttl: Option<u32>,
pub hoplimit: Option<u32>,
pub read_timeout: Option<Duration>,
pub write_timeout: Option<Duration>,
pub interface: Option<String>,
pub sock_type_hint: IcmpSocketType,
pub fib: Option<u32>,
}Expand description
Configuration for an ICMP socket.
Fields§
§socket_family: SocketFamilyThe socket family.
bind: Option<SocketAddr>Optional bind address for the socket.
ttl: Option<u32>Time-to-live for IPv4 packets.
hoplimit: Option<u32>Hop limit for IPv6 packets.
read_timeout: Option<Duration>Read timeout for the socket.
write_timeout: Option<Duration>Write timeout for the socket.
interface: Option<String>Network interface to use for the socket.
sock_type_hint: IcmpSocketTypeSocket type hint, DGRAM preferred on Linux, RAW fallback on macOS/Windows.
fib: Option<u32>FreeBSD only: optional FIB (Forwarding Information Base) support.
Implementations§
Source§impl IcmpConfig
impl IcmpConfig
Sourcepub fn with_bind(self, addr: SocketAddr) -> Self
pub fn with_bind(self, addr: SocketAddr) -> Self
Set bind address for the socket.
Sourcepub fn with_hoplimit(self, hops: u32) -> Self
pub fn with_hoplimit(self, hops: u32) -> Self
Set the hop limit for IPv6 packets.
Sourcepub fn with_read_timeout(self, timeout: Duration) -> Self
pub fn with_read_timeout(self, timeout: Duration) -> Self
Set the read timeout for the socket.
Sourcepub fn with_write_timeout(self, timeout: Duration) -> Self
pub fn with_write_timeout(self, timeout: Duration) -> Self
Set the write timeout for the socket.
Sourcepub fn with_interface(self, iface: impl Into<String>) -> Self
pub fn with_interface(self, iface: impl Into<String>) -> Self
Set the network interface to use for the socket.
Sourcepub fn with_sock_type(self, ty: IcmpSocketType) -> Self
pub fn with_sock_type(self, ty: IcmpSocketType) -> Self
Set the socket type hint. (DGRAM or RAW)
Trait Implementations§
Source§impl Clone for IcmpConfig
impl Clone for IcmpConfig
Source§fn clone(&self) -> IcmpConfig
fn clone(&self) -> IcmpConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for IcmpConfig
impl RefUnwindSafe for IcmpConfig
impl Send for IcmpConfig
impl Sync for IcmpConfig
impl Unpin for IcmpConfig
impl UnwindSafe for IcmpConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more