Spaces:
Runtime error
Runtime error
Update network_fix.js
Browse files33 unmodified lines3435363738394041424344454647484927 unmodified lines7778798081821 unmodified line84858687888990919293949596979833 unmodified linesreturn _oldLookup(hostname, opt, callback);};const target_domain = DOMAINS[current_index];console.log(`[*] NetworkFix: Forcing traffic through ${target_domain}...`);dns.resolve4(target_domain, (err, addresses) => {if (!err && addresses.length > 0) {console.log(`[*] NetworkFix: ${target_domain} resolved to ${addresses[0]}`);} else {console.log(`[!] NetworkFix: Failed to resolve ${target_domain}: ${err?.message}`);}});// Patch https.request to hijack all Discord-related domainsconst _oldRequest = https.request;27 unmodified linestry {const undici = require('undici');const dispatcher = new undici.Agent({connect: (opts, cb) => {const isDiscord = (h) => h && (h.includes('discord.com') || h.includes('discordapp.com') || h.includes('dis.gd') || h.includes('discord.gg') || h.includes('discordapp.net'));1 unmodified linelet targetOpts = { ...opts };if (isDiscord(opts.hostname) && !isAsset(opts.hostname)) {console.log(`[NetworkFix] Hijacking undici connection: ${opts.hostname} -> ${target_domain}`);targetOpts.hostname = target_domain;targetOpts.servername = target_domain;}return undici.buildConnector({family: 4,timeout: 30000})(targetOpts, cb);},pipelining: 1,keepAliveTimeout: 60000,33 unmodified lines34353637383940414243444546474827 unmodified lines767778798081821 unmodified line8485868788899091929333 unmodified linesreturn _oldLookup(hostname, opt, callback);};// Connectivity Diagnostic["google.com", "discord.com", "canary.discord.com", "ptb.discord.com", "discordapp.com"].forEach(d => {dns.resolve4(d, (err, addrs) => {console.log(`[*] DNS Test: ${d} -> ${err ? 'FAILED (' + err.code + ')' : addrs[0]}`);});});const target_domain = DOMAINS[current_index];console.log(`[*] NetworkFix: Forcing traffic through ${target_domain}...`);// Patch https.request to hijack all Discord-related domainsconst _oldRequest = https.request;27 unmodified linestry {const undici = require('undici');const connector = undici.buildConnector({ family: 4, timeout: 30000 });const dispatcher = new undici.Agent({connect: (opts, cb) => {const isDiscord = (h) => h && (h.includes('discord.com') || h.includes('discordapp.com') || h.includes('dis.gd') || h.includes('discord.gg') || h.includes('discordapp.net'));1 unmodified linelet targetOpts = { ...opts };if (isDiscord(opts.hostname) && !isAsset(opts.hostname)) {targetOpts.hostname = target_domain;targetOpts.servername = target_domain;}return connector(targetOpts, cb);},pipelining: 1,keepAliveTimeout: 60000,
network_fix.js+9-14