diff --git a/src/hostname.php b/src/hostname.php new file mode 100644 index 0000000..7023dc2 --- /dev/null +++ b/src/hostname.php @@ -0,0 +1,34 @@ +ip6.biz - + - + \ No newline at end of file diff --git a/src/info.php b/src/info.php index 895849a..b3797ef 100644 --- a/src/info.php +++ b/src/info.php @@ -7,12 +7,8 @@ if (substr($ip, 0, 9) === "10.23.42.") { $ip = "116.202.163.154"; } -$hostname = gethostbyaddr($ip); $res = array(); $res["address"] = $ip; -if ($ip !== $hostname){ - $res["hostname"] = $hostname; -} $countrydb = '/var/lib/GeoIP/GeoLite2-Country.mmdb'; $asndb = '/var/lib/GeoIP/GeoLite2-ASN.mmdb'; diff --git a/src/js/connectivity.js b/src/js/connectivity.js index 75277ee..7c44408 100644 --- a/src/js/connectivity.js +++ b/src/js/connectivity.js @@ -2,20 +2,41 @@ var progress_bar = '
Supported"); - $p.find(".proto_address4").html("" + resp.address + ""); - $p.find(".proto_hostname4").html(resp.hostname ? resp.hostname : "None"); - $p.find(".proto_isp4").html("" + resp.asn); + $p.find(".proto_supported").html("Supported"); + $p.find(".proto_address").html("" + resp.address + ""); + $p.find(".proto_isp").html("" + resp.asn); + $p.find(".proto_hostname").html(progress_bar).find(".progress-bar").css("width", "100%"); + $.ajax({ + url: "https://v4.ip6.biz/hostname.php", + dataType: "json", + timeout: 2000, + success: function(resp) { + if (resp.status == "ok") { + $p.find(".proto_hostname").html(resp.response); + } else { + if (resp.status == "servfail") { + $p.find(".proto_hostname").html("SERVFAIL"); + } else if (resp.status == "none") { + $p.find(".proto_hostname").html("None"); + } else { + $p.find(".proto_hostname").html("Test failed"); + } + } + }, + error: function(xopt, err) { + $p.find(".proto_hostname").html("Test failed"); + }, + }); }, error: function(xopt, err) { - $p.find(".proto_supported4").html("Not supported"); + $p.find(".proto_supported").html("Not supported"); }, }); } @@ -31,15 +52,6 @@ function test_ipv6() { success: function(resp) { $p.find(".proto_supported").html("Supported"); $p.find(".proto_address").html("" + resp.address + ""); - if (resp.hostname) { - $p.find(".proto_hostname").html(resp.hostname); - } else { - if (resp.rdns_fail) { - $p.find(".proto_hostname").html("SERVFAIL"); - } else { - $p.find(".proto_hostname").html("None"); - } - } $p.find(".proto_isp").html("" + resp.asn); $p.find(".proto_icmp").html(progress_bar).find(".progress-bar").css("width", "100%"); $.ajax({ @@ -57,6 +69,28 @@ function test_ipv6() { $p.find(".proto_icmp").html("Not tested"); }, }); + $p.find(".proto_hostname").html(progress_bar).find(".progress-bar").css("width", "100%"); + $.ajax({ + url: "https://v6.ip6.biz/hostname.php", + dataType: "json", + timeout: 2000, + success: function(resp) { + if (resp.status == "ok") { + $p.find(".proto_hostname").html(resp.response); + } else { + if (resp.status == "servfail") { + $p.find(".proto_hostname").html("SERVFAIL"); + } else if (resp.status == "none") { + $p.find(".proto_hostname").html("None"); + } else { + $p.find(".proto_hostname").html("Test failed"); + } + } + }, + error: function(xopt, err) { + $p.find(".proto_hostname").html("Test failed"); + }, + }); }, error: function(xopt, err) { $p.find(".proto_supported").html("Not supported");