diff --git a/actions.php b/actions.php
index 22b8242..5f029d0 100644
--- a/actions.php
+++ b/actions.php
@@ -23,16 +23,32 @@ public static function execute()
exit;
}
- $ip = gethostbyname($host);
- if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE || $ip == '127.0.0.1')
- {
- echo "";
- echo '';
- exit;
- }
-
if (isset($commands[$cmd]))
{
+ if ($cmd == "ping6" || $cmd == "traceroute6")
+ {
+ $result = dns_get_record($host, DNS_AAAA);
+ if (!empty($result))
+ {
+ $ip = $result[0]["ipv6"];
+ }
+ else
+ {
+ $ip = "";
+ }
+ }
+ else
+ {
+ $ip = gethostbyname($host);
+ }
+
+ if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE || $ip == '127.0.0.1')
+ {
+ echo "";
+ echo '';
+ exit;
+ }
+
call_user_func(array(__CLASS__, $cmd), $ip, $commands[$cmd]);
echo '';
@@ -142,4 +158,22 @@ protected static function ping6($host, $cmd)
flush();
});
}
-}
\ No newline at end of file
+
+ protected static function traceroute6($host, $cmd)
+ {
+ $args = [
+ 'cmd' => $cmd,
+ 'ip' => $host,
+ ];
+
+ echo '';
+ ob_flush();
+ flush();
+
+ command\traceroute::execute($args, function($line, $json) {
+ echo '';
+ ob_flush();
+ flush();
+ });
+ }
+}