@ -1,62 +1,123 @@
@@ -1,62 +1,123 @@
function peerLookupYggdrasil ( element ) {
function getCountry ( answer , element ) {
// Get online status
// @TODO
element . children ( 'td:eq(3)' ) . html ( '' ) ;
// If provided, set special status
if ( $ ( element ) . data ( 'yggdrasil' ) . length > 0 ) {
$ ( answer ) . each ( function ( ) {
$ . ajax ( {
type : 'GET' ,
url : 'https://ipapi.co/' + this . data + '/json' ,
dataType : 'json' ,
success : function ( result ) {
if ( result . country _code && result . country _code != '' && result . country _code != 'undefined' ) {
element . children ( 'td:eq(3)' ) . append ( ' ' + result . country _code + ' ' ) ;
}
$ ( element ) . children ( 'td:eq(0)' ) . find ( 'i' ) . removeClass ( 'c-5' ) ;
$ ( element ) . children ( 'td:eq(0)' ) . find ( 'i' ) . addClass ( 'c-6' ) ;
}
}
function peerLookupIpv6 ( element ) {
// Get online status
// @TODO
// Get country
$ . ajax ( {
type : 'GET' ,
url : 'https://ipapi.co/' + $ ( element ) . data ( 'ipv4' ) + '/json' ,
dataType : 'json' ,
success : function ( result ) {
if ( result . country _code && result . country _code != '' && result . country _code != 'undefined' ) {
// Set country
$ ( element ) . children ( 'td:eq(1)' ) . text ( result . country _code ) ;
}
}
} ) ;
}
function peerLookupIpv4 ( element ) {
// Get online status
// @TODO
// Get country
$ . ajax ( {
type : 'GET' ,
url : 'https://ipapi.co/' + $ ( element ) . data ( 'ipv4' ) + '/json' ,
dataType : 'json' ,
success : function ( result ) {
if ( result . country _code && result . country _code != '' && result . country _code != 'undefined' ) {
// Set country
$ ( element ) . children ( 'td:eq(1)' ) . text ( result . country _code ) ;
}
} ) ;
}
} ) ;
}
function nsLookup ( host ) {
function nsLookup ( element ) {
$ . ajax ( {
type : 'GET' ,
url : 'https://dns.google/resolve?name=' + host ,
url : 'https://dns.google/resolve?name=' + $ ( element ) . data ( ' host' ) ,
dataType : 'json' ,
success : function ( result ) {
if ( result . Answer ) {
var peers = result . Answer . length ;
if ( result . Answer . length == 1 ) {
$ ( element ) . children ( 'td:eq(0)' ) . find ( 'i' ) . removeClass ( 'c-5' ) ;
$ ( element ) . children ( 'td:eq(0)' ) . find ( 'i' ) . addClass ( 'c-6' ) ;
var element = $ ( 'tr[data-host="' + host + '"' ) ;
} else if ( result . Answer . length > 1 ) {
if ( peers == 1 ) {
element . children ( 'td:eq(0)' ) . find ( 'i' ) . removeClass ( 'c-5' ) ;
element . children ( 'td:eq(0)' ) . find ( 'i' ) . addClass ( 'c-6' ) ;
} else if ( peers > 1 ) {
element . children ( 'td:eq(0)' ) . find ( 'i' ) . removeClass ( 'c-5' ) ;
element . children ( 'td:eq(0)' ) . find ( 'i' ) . addClass ( 'c-7' ) ;
$ ( element ) . children ( 'td:eq(0)' ) . find ( 'i' ) . removeClass ( 'c-5' ) ;
$ ( element ) . children ( 'td:eq(0)' ) . find ( 'i' ) . addClass ( 'c-7' ) ;
}
element . children ( 'td:eq(2)' ) . html ( peers ) ;
$ ( element ) . children ( 'td:eq(2)' ) . html ( result . Answer . length ) ;
// Get country
$ ( element ) . children ( 'td:eq(3)' ) . html ( '' ) ;
$ ( result . Answer ) . each ( function ( ) {
getCountry ( result . Answer , element ) ;
$ . ajax ( {
type : 'GET' ,
url : 'https://ipapi.co/' + this . data + '/json' ,
dataType : 'json' ,
success : function ( result ) {
if ( result . country _code && result . country _code != '' && result . country _code != 'undefined' ) {
$ ( element ) . children ( 'td:eq(3)' ) . append ( ' ' + result . country _code + ' ' ) ;
}
}
} ) ;
} ) ;
}
}
} ) ;
}
$ ( document ) . ready ( function ( ) {
$ ( document ) . ready ( function ( ) {
nsLookup ( 'seed.twister.net.co' ) ;
nsLookup ( 'seed2.twister.net.co' ) ;
nsLookup ( 'seed3.twister.net.co' ) ;
nsLookup ( 'dnsseed.gombadi.com' ) ;
nsLookup ( 'twisterseed.tk' ) ;
nsLookup ( 'cruller.tasty.sexy' ) ;
nsLookup ( 'twister-seeder.muh.freedu.ms' ) ;
nsLookup ( 'twisterarmyseed.tk' ) ;
nsLookup ( 'seed.twisterarmy.org' ) ;
// Check DNS
$ ( '#dns tr[data-host]' ) . each ( function ( ) {
nsLookup ( this ) ;
} ) ;
// Check peers
$ ( '#peers tr[data-yggdrasil]' ) . each ( function ( ) {
peerLookupYggdrasil ( this ) ;
} ) ;
$ ( '#peers tr[data-ipv6]' ) . each ( function ( ) {
peerLookupIpv6 ( this ) ;
} ) ;
$ ( '#peers tr[data-ipv4]' ) . each ( function ( ) {
peerLookupIpv4 ( this ) ;
} ) ;
/ *
$ ( '#vmap' ) . vectorMap ( {
@ -76,4 +137,4 @@ $( document ).ready(function() {
@@ -76,4 +137,4 @@ $( document ).ready(function() {
showTooltip : true ,
} ) ;
* /
} ) ;
} ) ;