pub struct NetworkInfo {
pub public_ip: String,
pub tunnel_running: bool,
pub tunnel_pid: Option<u32>,
pub listening_ports: Vec<u16>,
}Expand description
Network state information.
Public IP capture is opt-in via RUNTIMO_ENABLE_PUBLIC_IP=1.
Without this env var, public_ip defaults to "unknown" to prevent
unintended external network metadata leakage.
Tunnel detection reads /proc/[0-9]*/comm files (process names only,
not command lines). This eliminates the self-match bug where pgrep
would match the shell that runs pgrep itself.
Listening ports are read directly from /proc/net/tcp and /proc/net/tcp6
— no ss shell-out, no service name guessing.
Fields§
§public_ip: StringPublic IP address (from ifconfig.me when RUNTIMO_ENABLE_PUBLIC_IP=1),
or "unknown".
tunnel_running: boolWhether a cloudflared tunnel process is running (detected via
/proc/*/comm content match, not pgrep).
tunnel_pid: Option<u32>PID of the cloudflared process if found, extracted from the
/proc/<pid> directory name.
listening_ports: Vec<u16>Raw listening TCP ports from /proc/net/tcp and /proc/net/tcp6.
Only ports in LISTEN (state 0A) state are included.
Sorted ascending, duplicates removed.
Trait Implementations§
Source§impl Clone for NetworkInfo
impl Clone for NetworkInfo
Source§fn clone(&self) -> NetworkInfo
fn clone(&self) -> NetworkInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more