#[cfg(unix)]
pub mod unix;
#[cfg(target_os = "windows")]
pub mod windows;
#[cfg(target_os = "windows")]
pub use self::windows::resolve_peer;
#[derive(Debug, Clone)]
pub struct PeerIdentity {
pub user_key: String,
pub user_display: String,
pub pid: u32,
pub session: Option<u32>,
}
impl PeerIdentity {
pub fn handshake_session_id(&self) -> u32 {
#[cfg(target_os = "windows")]
{
self.session.unwrap_or(0)
}
#[cfg(not(target_os = "windows"))]
{
self.user_key
.strip_prefix("uid-")
.and_then(|n| n.parse().ok())
.unwrap_or(0)
}
}
}