Spaces:
Runtime error
Runtime error
Update network_fix.js
Browse files- network_fix.js +17 -4
network_fix.js
CHANGED
|
@@ -3,10 +3,10 @@ const http = require('http');
|
|
| 3 |
const dns = require('dns');
|
| 4 |
|
| 5 |
const DOMAINS = [
|
| 6 |
-
"ptb.discord.com",
|
| 7 |
-
"canary.discord.com",
|
| 8 |
"discordapp.com",
|
| 9 |
-
"discord.com"
|
|
|
|
|
|
|
| 10 |
];
|
| 11 |
let current_index = 0;
|
| 12 |
|
|
@@ -18,12 +18,25 @@ function applyAdvancedFixes() {
|
|
| 18 |
console.log("[*] NetworkFix: Running in Minimal Recovery Mode...");
|
| 19 |
|
| 20 |
// Connectivity Diagnostic
|
| 21 |
-
["google.com", "discord.com"].forEach(d => {
|
| 22 |
dns.resolve4(d, (err, addrs) => {
|
| 23 |
console.log(`[*] DNS Test: ${d} -> ${err ? 'FAILED (' + err.code + ')' : addrs[0]}`);
|
| 24 |
});
|
| 25 |
});
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
const target_domain = DOMAINS[current_index];
|
| 28 |
console.log(`[*] NetworkFix: Forcing traffic through ${target_domain}...`);
|
| 29 |
|
|
|
|
| 3 |
const dns = require('dns');
|
| 4 |
|
| 5 |
const DOMAINS = [
|
|
|
|
|
|
|
| 6 |
"discordapp.com",
|
| 7 |
+
"discord.com",
|
| 8 |
+
"ptb.discord.com",
|
| 9 |
+
"canary.discord.com"
|
| 10 |
];
|
| 11 |
let current_index = 0;
|
| 12 |
|
|
|
|
| 18 |
console.log("[*] NetworkFix: Running in Minimal Recovery Mode...");
|
| 19 |
|
| 20 |
// Connectivity Diagnostic
|
| 21 |
+
["google.com", "discord.com", "discordapp.com"].forEach(d => {
|
| 22 |
dns.resolve4(d, (err, addrs) => {
|
| 23 |
console.log(`[*] DNS Test: ${d} -> ${err ? 'FAILED (' + err.code + ')' : addrs[0]}`);
|
| 24 |
});
|
| 25 |
});
|
| 26 |
|
| 27 |
+
// WebSocket Test
|
| 28 |
+
try {
|
| 29 |
+
const WebSocket = require('ws');
|
| 30 |
+
const testWs = new WebSocket(`wss://gateway.discord.gg`);
|
| 31 |
+
testWs.on('open', () => {
|
| 32 |
+
console.log("[*] WS Test: Initialized successfully");
|
| 33 |
+
testWs.close();
|
| 34 |
+
});
|
| 35 |
+
testWs.on('error', (e) => {
|
| 36 |
+
console.log(`[!] WS Test: Failed (${e.message})`);
|
| 37 |
+
});
|
| 38 |
+
} catch (e) {}
|
| 39 |
+
|
| 40 |
const target_domain = DOMAINS[current_index];
|
| 41 |
console.log(`[*] NetworkFix: Forcing traffic through ${target_domain}...`);
|
| 42 |
|