diff --git a/js/network.js b/js/network.js index f490a85..22959df 100644 --- a/js/network.js +++ b/js/network.js @@ -1,53 +1,35 @@ -function peerLookupYggdrasil(element) { +function peerLookup(element) { - // Get online status - // @TODO - - // If provided, set special status - if ($(element).data('yggdrasil').length > 0) { - - $(element).children('td:eq(0)').find('i').removeClass('c-5'); - $(element).children('td:eq(0)').find('i').addClass('c-6'); - } -} - -function peerLookupIpv6(element) { + var host = $(element).data('host'); + var port = $(element).data('port'); // Get online status - // @TODO - - // Get country $.ajax({ type: 'GET', - url: 'https://ipapi.co/' + $(element).data('ipv4') + '/json', + url: 'https://api.twisterarmy.dedyn.io/socket.php?host=' + host + '&port=' + port, dataType: 'json', success: function (result) { - if (result.country_code && result.country_code != '' && result.country_code != 'undefined') { + if (result.success) { - // Set country - $(element).children('td:eq(1)').text(result.country_code); + // Set online + $(element).children('td:eq(0)').find('i').removeClass('c-5'); + $(element).children('td:eq(0)').find('i').addClass('c-7'); } } }); -} - -function peerLookupIpv4(element) { - - // Get online status - // @TODO // Get country $.ajax({ type: 'GET', - url: 'https://ipapi.co/' + $(element).data('ipv4') + '/json', + url: 'https://ipapi.co/' + host + '/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); + $(element).children('td:eq(2)').text(result.country_code); } } }); @@ -107,16 +89,8 @@ $(document).ready(function() { }); // 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); + $('#peers tr[data-peer]').each(function() { + peerLookup(this); }); /* diff --git a/network.html b/network.html index ae017e0..2c1fa05 100644 --- a/network.html +++ b/network.html @@ -24,7 +24,7 @@ --> - +
@@ -149,21 +149,45 @@ + - - - - - + - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
StatusAddress LocationIPv4IPv6YggdrasilPort TCPPort UDP+TCPComment
94.140.114.241:28333 -94.140.114.2412a02:7aa0:4000::f2301:23b4:991a:634d::332833329333Clearnet / TCP
94.140.114.241:29333-Clearnet / UDP+TCP
[2a02:7aa0:4000::f2]:28333-Clearnet / TCP
[2a02:7aa0:4000::f2]:29333-Clearnet / UDP+TCP
[301:23b4:991a:634d::33]:28333-Yggdrasil / TCP
[301:23b4:991a:634d::33]:29333-Yggdrasil / UDP+TCP
diff --git a/uk/network.html b/uk/network.html index bfbb626..6fa98c2 100644 --- a/uk/network.html +++ b/uk/network.html @@ -25,7 +25,7 @@ --> - +
@@ -150,21 +150,45 @@ + - - - - - + - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
СтатусАдреса РозташуванняIPv4IPv6YggdrasilПорт TCPПорт UDP+TCPКоментар
94.140.114.241:28333 -94.140.114.2412a02:7aa0:4000::f2301:23b4:991a:634d::332833329333Інтернет / TCP
94.140.114.241:29333-Інтернет / UDP+TCP
[2a02:7aa0:4000::f2]:28333-Інтернет / TCP
[2a02:7aa0:4000::f2]:29333-Інтернет / UDP+TCP
[301:23b4:991a:634d::33]:28333-Yggdrasil / TCP
[301:23b4:991a:634d::33]:29333-Yggdrasil / UDP+TCP