Spaces:
Runtime error
Runtime error
Update ultimate_fix.js
Browse files- ultimate_fix.js +19 -8
ultimate_fix.js
CHANGED
|
@@ -19,20 +19,31 @@ try {
|
|
| 19 |
dns.setServers(['1.1.1.1', '8.8.8.8', '1.0.0.1']);
|
| 20 |
} catch(e) {}
|
| 21 |
|
| 22 |
-
// 2. Monkey-patch the global DNS system (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
const originalLookup = dns.lookup;
|
| 24 |
dns.lookup = function(hostname, options, callback) {
|
| 25 |
if (typeof options === 'function') {
|
| 26 |
callback = options;
|
| 27 |
options = { family: 4 };
|
| 28 |
-
} else if (typeof options === 'number') {
|
| 29 |
-
options = { family: 4 };
|
| 30 |
-
} else if (!options) {
|
| 31 |
-
options = { family: 4 };
|
| 32 |
-
} else {
|
| 33 |
-
options.family = 4;
|
| 34 |
-
options.hints = (options.hints || 0) | dns.ADDRCONFIG;
|
| 35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
return originalLookup(hostname, options, callback);
|
| 37 |
};
|
| 38 |
|
|
|
|
| 19 |
dns.setServers(['1.1.1.1', '8.8.8.8', '1.0.0.1']);
|
| 20 |
} catch(e) {}
|
| 21 |
|
| 22 |
+
// 2. Monkey-patch the global DNS system (The NUCLEAR FIX)
|
| 23 |
+
// We manually provide Discord's stable IPs to bypass DNS-level blocks or IP bans.
|
| 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 = 0;
|
| 29 |
+
|
| 30 |
const originalLookup = dns.lookup;
|
| 31 |
dns.lookup = function(hostname, options, callback) {
|
| 32 |
if (typeof options === 'function') {
|
| 33 |
callback = options;
|
| 34 |
options = { family: 4 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
+
|
| 37 |
+
// If we are connecting to Discord, rotate through known good IPs
|
| 38 |
+
if (hostname.includes('discord.com') || hostname.includes('discordapp.com')) {
|
| 39 |
+
const ip = DISCORD_IPS[currentIpIndex];
|
| 40 |
+
currentIpIndex = (currentIpIndex + 1) % DISCORD_IPS.length;
|
| 41 |
+
// Immediate return with rotated IP
|
| 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 |
};
|
| 49 |
|