routes; } public function __construct() { $result = @shell_exec("ip --json route show"); if (!$result) { throw new RuntimeException("Failed to read routing table"); } $this->routes = @json_decode($result, true); if ($this->routes === null) { throw new RuntimeException("Failed to parse json output"); } foreach ($this->routes as $key => &$route) { if ($route["dst"] === "default") { $route["dst"] = "0.0.0.0/0"; } elseif (!str_contains($route["dst"], "/")) { $route["dst"] .= "/32"; } } } }