pub struct PortInfo {
pub port: u16,
pub protocol: Protocol,
pub pid: u32,
pub process_name: String,
pub address: Option<String>,
}Expand description
Information about a listening port
Fields§
§port: u16Port number
protocol: ProtocolProtocol (TCP/UDP)
pid: u32Process ID using this port
process_name: StringProcess name
address: Option<String>Bind address (e.g., “0.0.0.0”, “127.0.0.1”, “::”)
Implementations§
Source§impl PortInfo
impl PortInfo
Sourcepub fn get_all_listening() -> Result<Vec<PortInfo>>
pub fn get_all_listening() -> Result<Vec<PortInfo>>
Get all listening ports on the system
Sourcepub fn find_by_port(port: u16) -> Result<Option<PortInfo>>
pub fn find_by_port(port: u16) -> Result<Option<PortInfo>>
Find which process is listening on a specific port
Sourcepub fn get_process(&self) -> Result<Option<Process>>
pub fn get_process(&self) -> Result<Option<Process>>
Get the full process info for this port’s process
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PortInfo
impl<'de> Deserialize<'de> for PortInfo
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
Auto Trait Implementations§
impl Freeze for PortInfo
impl RefUnwindSafe for PortInfo
impl Send for PortInfo
impl Sync for PortInfo
impl Unpin for PortInfo
impl UnwindSafe for PortInfo
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