pub struct NetTool;Expand description
Network utility wrapper
Implementations§
Source§impl NetTool
impl NetTool
pub fn new() -> Self
Sourcepub fn get_local_ipv4(&self) -> Result<String>
pub fn get_local_ipv4(&self) -> Result<String>
Quickly get the local IPv4 address by attempting a dummy UDP connection
Sourcepub fn is_usable_local_port(&self, port: u16) -> bool
pub fn is_usable_local_port(&self, port: u16) -> bool
Check if a local port is usable (not occupied)
Sourcepub fn is_inner_ip(&self, ip_str: impl AsRef<str>) -> bool
pub fn is_inner_ip(&self, ip_str: impl AsRef<str>) -> bool
Check if an IP address string is an internal/private IP
Auto Trait Implementations§
impl Freeze for NetTool
impl RefUnwindSafe for NetTool
impl Send for NetTool
impl Sync for NetTool
impl Unpin for NetTool
impl UnsafeUnpin for NetTool
impl UnwindSafe for NetTool
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