pub trait ProcessLookup: Send + Sync {
// Required methods
fn get_process_for_connection(
&self,
conn: &Connection,
) -> Option<(u32, String)>;
fn get_detection_method(&self) -> &str;
// Provided methods
fn refresh(&self) -> Result<()> { ... }
fn get_degradation_reason(&self) -> DegradationReason { ... }
fn fallback_lookup(
map: &HashMap<ConnectionKey, (u32, String)>,
key: &ConnectionKey,
) -> Option<(u32, String)>
where Self: Sized { ... }
}Expand description
Trait for platform-specific process lookup
Required Methods§
Sourcefn get_process_for_connection(&self, conn: &Connection) -> Option<(u32, String)>
fn get_process_for_connection(&self, conn: &Connection) -> Option<(u32, String)>
Look up process information for a connection Returns (pid, process_name) if found
Sourcefn get_detection_method(&self) -> &str
fn get_detection_method(&self) -> &str
Get the detection method name for display purposes
Provided Methods§
Sourcefn get_degradation_reason(&self) -> DegradationReason
fn get_degradation_reason(&self) -> DegradationReason
Get the reason why process detection is degraded (if any) Returns DegradationReason::None if using optimal detection method
Sourcefn fallback_lookup(
map: &HashMap<ConnectionKey, (u32, String)>,
key: &ConnectionKey,
) -> Option<(u32, String)>where
Self: Sized,
fn fallback_lookup(
map: &HashMap<ConnectionKey, (u32, String)>,
key: &ConnectionKey,
) -> Option<(u32, String)>where
Self: Sized,
Fallback lookup that relaxes the connection key to handle sockets stored with wildcard addresses in OS-level tables.
Three shapes that actually appear in OS socket tables:
- (lip:lport, 0:0) — listening on a specific local IP
- (0:lport, rip:rport) — INADDR_ANY socket connected to a known remote
- (0:lport, 0:0) — listening on INADDR_ANY
If two candidates resolve to different processes the result is ambiguous and
None is returned to avoid mis-attribution.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".