2021-05-02 20:43:48 +02:00
var progress _bar = '<div class="progress progress-striped active"><div class="progress-bar" role="progressbar" style="width:0"></div></div>' ;
function test _ipv4 ( ) {
var $p = $ ( "#v4_conn" ) ;
2021-05-04 23:45:21 +02:00
$p . find ( ".proto_supported" ) . html ( progress _bar ) . find ( ".progress-bar" ) . css ( "width" , "100%" ) ;
$p . find ( ".proto_address, .proto_hostname, .proto_isp" ) . empty ( ) ;
2021-05-02 20:43:48 +02:00
$ . ajax ( {
url : "https://v4.ip6.biz/info.php" ,
dataType : "json" ,
timeout : 15000 ,
success : function ( resp ) {
2021-05-04 23:45:21 +02:00
$p . find ( ".proto_supported" ) . html ( "<span class='label label-success' style='font-size:1em'>Supported</span>" ) ;
$p . find ( ".proto_address" ) . html ( "<span class='address'>" + resp . address + "</span>" ) ;
$p . find ( ".proto_isp" ) . html ( "<img class='img-flag' src='/img/flags/" + resp . country + ".png' title='" + resp . country + "' />" + 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 ( "<span class='label label-danger'>SERVFAIL</span>" ) ;
} else if ( resp . status == "none" ) {
$p . find ( ".proto_hostname" ) . html ( "<span class='label label-warning'>None</span>" ) ;
} else {
$p . find ( ".proto_hostname" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
}
}
} ,
error : function ( xopt , err ) {
$p . find ( ".proto_hostname" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
} ,
} ) ;
2021-05-02 20:43:48 +02:00
} ,
error : function ( xopt , err ) {
2021-05-04 23:45:21 +02:00
$p . find ( ".proto_supported" ) . html ( "<span class='label label-danger' style='font-size:1em'>Not supported</span>" ) ;
2021-05-02 20:43:48 +02:00
} ,
} ) ;
}
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 ) {
2021-05-05 12:09:17 +02:00
if ( resp . address . includes ( "." ) ) {
$p . find ( ".proto_supported" ) . html ( "<span class='label label-warning' style='font-size:1em'>Browser error</span>" ) ;
$p . find ( ".proto_icmp" ) . html ( "<span class='label label-warning' style='font-size:1em'>Not tested</span>" ) ;
$p . find ( ".proto_address" ) . html ( "<span class='address'>n/a</span>" ) ;
$p . find ( ".proto_hostname" ) . html ( "<span class='label label-warning'>Not tested</span>" )
$p . find ( ".proto_isp" ) . prev ( ) . html ( "Error" )
$p . find ( ".proto_isp" ) . html ( "Your browser doesn't support IPv6 properly. Please check out <a href='https://bugzilla.mozilla.org/show_bug.cgi?id=1709564'>this bug</a> if you are using Firefox." ) ;
return ;
}
2021-05-02 20:43:48 +02:00
$p . find ( ".proto_supported" ) . html ( "<span class='label label-success' style='font-size:1em'>Supported</span>" ) ;
$p . find ( ".proto_address" ) . html ( "<span class='address'>" + resp . address + "</span>" ) ;
$p . find ( ".proto_isp" ) . html ( "<img class='img-flag' src='/img/flags/" + resp . country + ".png' title='" + resp . country + "' />" + 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 ( "<span class='label label-success'>Reachable (" + resp . rtt + ")</span>" ) ;
} else {
$p . find ( ".proto_icmp" ) . html ( "<span class='label label-warning'>Filtered</span>" ) ;
}
} ,
error : function ( xopt , err ) {
$p . find ( ".proto_icmp" ) . html ( "<span class='label label-default'>Not tested</span>" ) ;
} ,
} ) ;
2021-05-04 23:45:21 +02:00
$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 ( "<span class='label label-danger'>SERVFAIL</span>" ) ;
} else if ( resp . status == "none" ) {
$p . find ( ".proto_hostname" ) . html ( "<span class='label label-warning'>None</span>" ) ;
} else {
$p . find ( ".proto_hostname" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
}
}
} ,
error : function ( xopt , err ) {
$p . find ( ".proto_hostname" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
} ,
} ) ;
2021-05-02 20:43:48 +02:00
} ,
error : function ( xopt , err ) {
$p . find ( ".proto_supported" ) . html ( "<span class='label label-danger' style='font-size:1em'>Not supported</span>" ) ;
} ,
} ) ;
}
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 ( "<span class='label label-success' style='font-size:1em'>IPv" + resp . protocol + "</span>" ) ;
$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 ( "<span class='label label-" + lclass + "'>to IPv" + resp2 . protocol + " in " + label + "</span>" ) ;
} ,
error : function ( xopt , err ) {
$p . find ( ".browser_fallback" ) . html ( "<span class='label label-danger'>No</span>" ) ;
} ,
} ) ;
if ( resp . protocol === "6" ) {
} else {
}
} ,
error : function ( xopt , err ) {
2021-05-05 12:09:17 +02:00
$p . find ( ".browser_default" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
2021-05-02 20:43:48 +02:00
} ,
} ) ;
}
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 ( "<span class='label label-success'>Reachable</span>" ) ;
} else {
2021-05-05 12:09:17 +02:00
$p . find ( ".dns_dns4_ip4" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
2021-05-02 20:43:48 +02:00
}
} ,
error : function ( xopt , err ) {
$p . find ( ".dns_dns4_ip4" ) . html ( "<span class='label label-danger'>Unreachable</span>" ) ;
} ,
} ) ;
$ . 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 ( "<span class='label label-success'>Reachable</span>" ) ;
} else {
2021-05-05 12:09:17 +02:00
$p . find ( ".dns_dns4_ip6" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
2021-05-02 20:43:48 +02:00
}
} ,
error : function ( xopt , err ) {
$p . find ( ".dns_dns4_ip6" ) . html ( "<span class='label label-danger'>Unreachable</span>" ) ;
} ,
} ) ;
$ . 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 ( "<span class='label label-success'>Reachable</span>" ) ;
} else {
2021-05-05 12:09:17 +02:00
$p . find ( ".dns_dns6_ip4" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
2021-05-02 20:43:48 +02:00
}
} ,
error : function ( xopt , err ) {
$p . find ( ".dns_dns6_ip4" ) . html ( "<span class='label label-danger'>Unreachable</span>" ) ;
} ,
} ) ;
$ . 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 ( "<span class='label label-success'>Reachable</span>" ) ;
} else {
2021-05-05 12:09:17 +02:00
$p . find ( ".dns_dns6_ip6" ) . html ( "<span class='label label-danger'>Test failed</span>" ) ;
2021-05-02 20:43:48 +02:00
}
} ,
error : function ( xopt , err ) {
$p . find ( ".dns_dns6_ip6" ) . html ( "<span class='label label-danger'>Unreachable</span>" ) ;
} ,
} ) ;
}
$ ( 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 ( ) ;
} ) ;