var progress_bar = '
'; function test_ipv4() { var $p = $("#v4_conn"); $p.find(".proto_supported4").html(progress_bar).find(".progress-bar").css("width", "100%"); $p.find(".proto_address4, .proto_hostname4, .proto_isp4").empty(); $.ajax({ url: "https://v4.ip6.biz/info.php", dataType: "json", timeout: 15000, success: function(resp) { $p.find(".proto_supported4").html("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); }, error: function(xopt, err) { $p.find(".proto_supported4").html("Not supported"); }, }); } function test_ipv6() { var $p = $("#v6_conn"); $p.find(".proto_supported").html(progress_bar).find(".progress-bar").css("width", "100%"); $p.find(".proto_address, .proto_hostname, .proto_isp, .proto_icmp").empty(); $.ajax({ url: "https://v6.ip6.biz/info.php", dataType: "json", timeout: 15000, 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({ url: "https://v6.ip6.biz/icmp.php", dataType: "json", timeout: 2000, success: function(resp) { if (resp.status === "OK") { $p.find(".proto_icmp").html("Reachable (" + resp.rtt + ")"); } else { $p.find(".proto_icmp").html("Filtered"); } }, error: function(xopt, err) { $p.find(".proto_icmp").html("Not tested"); }, }); }, error: function(xopt, err) { $p.find(".proto_supported").html("Not supported"); }, }); } function test_browser() { var $p = $("#browser"); $p.find(".browser_default").html(progress_bar).find(".progress-bar").css("width", "100%"); $p.find(".browser_fallback").empty(); $.ajax({ url: "https://any.ip6.biz/proto.php", dataType: "json", timeout: 15000, success: function(resp) { $p.find(".browser_default").html("IPv" + resp.protocol + ""); $p.find(".browser_fallback").html(progress_bar).find(".progress-bar").css("width", "100%"); var fb_start = (new Date()).getTime(); $.ajax({ url: "https://f" + resp.protocol + ".ip6.biz/proto.php", dataType: "json", timeout: 15000, success: function(resp2) { var fb_time = Math.round(((new Date()).getTime() - fb_start)); var label = fb_time + " ms"; var lclass = "success"; if (fb_time > 1000) { lclass = "warning"; } $p.find(".browser_fallback").html("to IPv" + resp2.protocol + " in " + label + ""); }, error: function(xopt, err) { $p.find(".browser_fallback").html("No"); }, }); if (resp.protocol === "6") { } else { } }, error: function(xopt, err) { $p.find(".browser_default").html("Test failed"); }, }); } function test_dns() { var $p = $("#dns"); $p.find(".dns_dns4_ip4, .dns_dns4_ip6, .dns_dns6_ip4, .dns_dns6_ip6").html(progress_bar).find(".progress-bar").css("width", "100%"); $.ajax({ url: "https://v4.z4.ip6.biz/proto.php", dataType: "json", timeout: 15000, success: function(resp) { if (resp.protocol === "4") { $p.find(".dns_dns4_ip4").html("Reachable"); } else { $p.find(".dns_dns4_ip4").html("Test failed"); } }, error: function(xopt, err) { $p.find(".dns_dns4_ip4").html("Unreachable"); }, }); $.ajax({ url: "https://v6.z4.ip6.biz/proto.php", dataType: "json", timeout: 15000, success: function(resp) { if (resp.protocol === "6") { $p.find(".dns_dns4_ip6").html("Reachable"); } else { $p.find(".dns_dns4_ip6").html("Test failed"); } }, error: function(xopt, err) { $p.find(".dns_dns4_ip6").html("Unreachable"); }, }); $.ajax({ url: "https://v4.z6.ip6.biz/proto.php", dataType: "json", timeout: 15000, success: function(resp) { if (resp.protocol === "4") { $p.find(".dns_dns6_ip4").html("Reachable"); } else { $p.find(".dns_dns6_ip4").html("Test failed"); } }, error: function(xopt, err) { $p.find(".dns_dns6_ip4").html("Unreachable"); }, }); $.ajax({ url: "https://v6.z6.ip6.biz/proto.php", dataType: "json", timeout: 15000, success: function(resp) { if (resp.protocol === "6") { $p.find(".dns_dns6_ip6").html("Reachable"); } else { $p.find(".dns_dns6_ip6").html("Test failed"); } }, error: function(xopt, err) { $p.find(".dns_dns6_ip6").html("Unreachable"); }, }); } $(function() { $("table span.glyphicon-question-sign").each(function(k, el) { $(el).attr("data-title", $(el).closest("tr").find("th").text()).popover({ placement: "auto right", container: "body", }); }); $("#refresh_ipv4").click(function(ev) { test_ipv4(); ev.preventDefault(); return false; }); $("#refresh_ipv6").click(function(ev) { test_ipv6(); ev.preventDefault(); return false; }); $("#refresh_browser").click(function(ev) { test_browser(); ev.preventDefault(); return false; }); $("#refresh_dns").click(function(ev) { test_dns(); ev.preventDefault(); return false; }); test_browser(); test_ipv4(); test_ipv6(); test_dns(); });