Spaces:
Runtime error
Runtime error
Update network_fix.js
Browse files- network_fix.js +3 -11
network_fix.js
CHANGED
|
@@ -3,12 +3,11 @@ const http = require('http');
|
|
| 3 |
const dns = require('dns');
|
| 4 |
|
| 5 |
const DOMAINS = [
|
| 6 |
-
"canary.discord.com",
|
| 7 |
"ptb.discord.com",
|
|
|
|
| 8 |
"discord.com",
|
| 9 |
"dis.gd",
|
| 10 |
-
"discordapp.com"
|
| 11 |
-
"gateway.discord.gg"
|
| 12 |
];
|
| 13 |
let current_index = 0;
|
| 14 |
|
|
@@ -53,19 +52,12 @@ function applyAdvancedFixes() {
|
|
| 53 |
https.globalAgent = new https.Agent(options);
|
| 54 |
http.globalAgent = new http.Agent(options);
|
| 55 |
|
| 56 |
-
dns.setServers(['8.8.8.8', '1.1.1.1']); // Use reliable DNS
|
| 57 |
-
|
| 58 |
try {
|
| 59 |
const { setGlobalDispatcher, Agent } = require('undici');
|
| 60 |
const dispatcher = new Agent({
|
| 61 |
connect: {
|
| 62 |
family: 4,
|
| 63 |
-
servername: target_domain
|
| 64 |
-
lookup: (hostname, options, callback) => {
|
| 65 |
-
const isDiscord = hostname.includes('discord.com') || hostname.includes('discordapp.com') || hostname.includes('dis.gd') || hostname.includes('discord.gg');
|
| 66 |
-
const target = isDiscord ? target_domain : hostname;
|
| 67 |
-
dns.lookup(target, { family: 4 }, callback);
|
| 68 |
-
}
|
| 69 |
},
|
| 70 |
pipelining: 1,
|
| 71 |
keepAliveTimeout: 30000
|
|
|
|
| 3 |
const dns = require('dns');
|
| 4 |
|
| 5 |
const DOMAINS = [
|
|
|
|
| 6 |
"ptb.discord.com",
|
| 7 |
+
"canary.discord.com",
|
| 8 |
"discord.com",
|
| 9 |
"dis.gd",
|
| 10 |
+
"discordapp.com"
|
|
|
|
| 11 |
];
|
| 12 |
let current_index = 0;
|
| 13 |
|
|
|
|
| 52 |
https.globalAgent = new https.Agent(options);
|
| 53 |
http.globalAgent = new http.Agent(options);
|
| 54 |
|
|
|
|
|
|
|
| 55 |
try {
|
| 56 |
const { setGlobalDispatcher, Agent } = require('undici');
|
| 57 |
const dispatcher = new Agent({
|
| 58 |
connect: {
|
| 59 |
family: 4,
|
| 60 |
+
servername: target_domain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
},
|
| 62 |
pipelining: 1,
|
| 63 |
keepAliveTimeout: 30000
|