Spaces:
Runtime error
Runtime error
Update ultimate_fix.js
Browse files- ultimate_fix.js +11 -7
ultimate_fix.js
CHANGED
|
@@ -20,12 +20,13 @@ try {
|
|
| 20 |
} catch(e) {}
|
| 21 |
|
| 22 |
// 2. Monkey-patch the global DNS system (The NUCLEAR FIX)
|
| 23 |
-
// We manually provide Discord's
|
| 24 |
const DISCORD_IPS = [
|
| 25 |
'162.159.138.232', '162.159.137.232', '162.159.136.232', '162.159.135.232',
|
| 26 |
-
'162.159.129.232', '162.159.130.233', '162.159.133.232', '162.159.134.232'
|
|
|
|
| 27 |
];
|
| 28 |
-
let currentIpIndex =
|
| 29 |
|
| 30 |
const originalLookup = dns.lookup;
|
| 31 |
dns.lookup = function(hostname, options, callback) {
|
|
@@ -34,15 +35,18 @@ dns.lookup = function(hostname, options, callback) {
|
|
| 34 |
options = { family: 4 };
|
| 35 |
}
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
const ip = DISCORD_IPS[currentIpIndex];
|
| 40 |
currentIpIndex = (currentIpIndex + 1) % DISCORD_IPS.length;
|
| 41 |
-
|
| 42 |
return callback(null, ip, 4);
|
| 43 |
}
|
| 44 |
|
| 45 |
-
// Default behavior for other domains
|
| 46 |
if (options && !options.family) options.family = 4;
|
| 47 |
return originalLookup(hostname, options, callback);
|
| 48 |
};
|
|
|
|
| 20 |
} catch(e) {}
|
| 21 |
|
| 22 |
// 2. Monkey-patch the global DNS system (The NUCLEAR FIX)
|
| 23 |
+
// We manually provide a diverse set of Discord's edge IPs to bypass Cloudflare IP blocks.
|
| 24 |
const DISCORD_IPS = [
|
| 25 |
'162.159.138.232', '162.159.137.232', '162.159.136.232', '162.159.135.232',
|
| 26 |
+
'162.159.129.232', '162.159.130.233', '162.159.133.232', '162.159.134.232',
|
| 27 |
+
'188.114.96.0', '188.114.97.0', '104.16.58.5', '104.16.59.5', '104.16.60.5'
|
| 28 |
];
|
| 29 |
+
let currentIpIndex = Math.floor(Math.random() * DISCORD_IPS.length);
|
| 30 |
|
| 31 |
const originalLookup = dns.lookup;
|
| 32 |
dns.lookup = function(hostname, options, callback) {
|
|
|
|
| 35 |
options = { family: 4 };
|
| 36 |
}
|
| 37 |
|
| 38 |
+
const isDiscord = hostname.includes('discord.com') ||
|
| 39 |
+
hostname.includes('discordapp.com') ||
|
| 40 |
+
hostname.includes('discord.gg') ||
|
| 41 |
+
hostname.includes('discord.net');
|
| 42 |
+
|
| 43 |
+
if (isDiscord) {
|
| 44 |
const ip = DISCORD_IPS[currentIpIndex];
|
| 45 |
currentIpIndex = (currentIpIndex + 1) % DISCORD_IPS.length;
|
| 46 |
+
console.log(`[DNS] Direct Route: ${hostname} -> ${ip}`);
|
| 47 |
return callback(null, ip, 4);
|
| 48 |
}
|
| 49 |
|
|
|
|
| 50 |
if (options && !options.family) options.family = 4;
|
| 51 |
return originalLookup(hostname, options, callback);
|
| 52 |
};
|