()
| 2865 | } |
| 2866 | |
| 2867 | fn detect_tailscale_ip_from_cli() -> Option<IpAddr> { |
| 2868 | let output = ProcessCommand::new("tailscale") |
| 2869 | .args(["ip", "-4"]) |
| 2870 | .stdout(Stdio::piped()) |
| 2871 | .stderr(Stdio::null()) |
| 2872 | .output() |
| 2873 | .ok()?; |
| 2874 | if !output.status.success() { |
| 2875 | return None; |
| 2876 | } |
| 2877 | let text = String::from_utf8_lossy(&output.stdout); |
| 2878 | text.lines() |
| 2879 | .filter_map(|line| line.trim().parse::<IpAddr>().ok()) |
| 2880 | .find(|ip| is_tailscale_ip(*ip)) |
| 2881 | } |
| 2882 | |
| 2883 | fn detect_tailscale_ip_from_ifconfig() -> Option<IpAddr> { |
| 2884 | let output = ProcessCommand::new("ifconfig") |
no test coverage detected