Browse Source

add alternative dns support

main
ghost 10 months ago
parent
commit
e3ff4143f4
  1. 93
      js/network.js
  2. 2
      network.html
  3. 2
      uk/network.html

93
js/network.js

@ -37,9 +37,100 @@ function peerLookup(element) {
function nsLookup(element) { function nsLookup(element) {
var host = $(element).data('host');
// Try alternative DNS
var alfis = [
".ygg",
".btn",
".anon",
".conf",
".index",
".index",
".merch",
".mirror",
".mob",
".screen",
".srv"
];
$.each(alfis, function() {
if (host.includes(this)) {
$.ajax({
type: 'GET',
url: 'https://yggapi.duckdns.org/net/dig.php?records[]=A&records[]=AAAA&name=' + host,
dataType: 'json',
success: function (result) {
if (result.success) {
var total = 0;
if (result.records.A.length) {
$(result.records.A).each(function() {
total++;
$.ajax({
type: 'GET',
url: 'https://ipapi.co/' + this + '/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 + ' ');
}
}
});
});
}
if (result.records.AAAA.length) {
$(result.records.AAAA).each(function() {
total++;
$.ajax({
type: 'GET',
url: 'https://ipapi.co/' + this + '/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 + ' ');
}
}
});
});
}
if (total == 1) {
$(element).children('td:eq(0)').find('i').removeClass('c-5');
$(element).children('td:eq(0)').find('i').addClass('c-6');
} else if (total > 1) {
$(element).children('td:eq(0)').find('i').removeClass('c-5');
$(element).children('td:eq(0)').find('i').addClass('c-7');
}
}
}
});
return false;
}
});
// Regular DNS
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: 'https://dns.google/resolve?name=' + $(element).data('host'), url: 'https://dns.google/resolve?name=' + host,
dataType: 'json', dataType: 'json',
success: function (result) { success: function (result) {

2
network.html

@ -24,7 +24,7 @@
<script src="/js/jquery.vmap.js"></script> <script src="/js/jquery.vmap.js"></script>
<script src="/js/jquery.vmap.world.js"></script> <script src="/js/jquery.vmap.world.js"></script>
--> -->
<script src="/js/network.js?v=6"></script> <script src="/js/network.js?v=7"></script>
</head> </head>
<body class="bg-c-1 bg-img-1 c-0"> <body class="bg-c-1 bg-img-1 c-0">
<div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0"> <div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0">

2
uk/network.html

@ -25,7 +25,7 @@
<script src="/js/jquery.vmap.js"></script> <script src="/js/jquery.vmap.js"></script>
<script src="/js/jquery.vmap.world.js"></script> <script src="/js/jquery.vmap.world.js"></script>
--> -->
<script src="/js/network.js?v=6"></script> <script src="/js/network.js?v=7"></script>
</head> </head>
<body class="bg-c-1 bg-img-1 c-0"> <body class="bg-c-1 bg-img-1 c-0">
<div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0"> <div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0">

Loading…
Cancel
Save