#[non_exhaustive]pub enum SocketMode {
Raw,
Dgram,
Stream,
}Expand description
Socket mode (affects permissions required)
Different socket modes have different permission requirements:
- Raw: Full control but requires root/CAP_NET_RAW
- Dgram: ICMP datagram sockets - platform specific permissions
- Stream: TCP connections (not yet implemented)
The library will automatically fall back to less privileged modes when possible.
§Platform-Specific DGRAM Support
- Linux: Requires root or
sysctl net.ipv4.ping_group_rangeconfiguration - macOS: Works without root for ICMP DGRAM sockets
- FreeBSD/OpenBSD: Requires root
- Windows: Uses Windows-specific ICMP APIs (IcmpSendEcho)
This enum is #[non_exhaustive]: new socket modes may be added in minor
releases, so downstream matches must include a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Raw
Raw socket - always requires CAP_NET_RAW or root
Dgram
Datagram socket for ICMP - permissions vary by platform
Stream
Stream socket (TCP) - not yet implemented
Implementations§
Source§impl SocketMode
impl SocketMode
Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Get a human-readable description
Trait Implementations§
Source§impl Clone for SocketMode
impl Clone for SocketMode
Source§fn clone(&self) -> SocketMode
fn clone(&self) -> SocketMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SocketMode
Source§impl Debug for SocketMode
impl Debug for SocketMode
Source§impl<'de> Deserialize<'de> for SocketMode
impl<'de> Deserialize<'de> for SocketMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SocketMode
Source§impl PartialEq for SocketMode
impl PartialEq for SocketMode
Source§impl Serialize for SocketMode
impl Serialize for SocketMode
impl StructuralPartialEq for SocketMode
Auto Trait Implementations§
impl Freeze for SocketMode
impl RefUnwindSafe for SocketMode
impl Send for SocketMode
impl Sync for SocketMode
impl Unpin for SocketMode
impl UnsafeUnpin for SocketMode
impl UnwindSafe for SocketMode
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