const dns = require('dns'); /** * Connection Patience Fix. * Increases the timeout to 120 seconds to prevent the "Connect Timeout Error". */ function applyAdvancedFixes() { console.log(`[NETWORK] Increasing connection patience to 120s...`); try { const { setGlobalDispatcher, Agent } = require('undici'); const agent = new Agent({ connect: { timeout: 120000 // 2 minutes! } }); setGlobalDispatcher(agent); this._dispatcher = agent; } catch (e) {} } function getDispatcher() { return this._dispatcher; } function rotateEndpoint() { try { const ultimateFix = require('./ultimate_fix'); if (ultimateFix && typeof ultimateFix.rotateEndpoint === 'function') { ultimateFix.rotateEndpoint(); } } catch (e) { console.error("[NETWORK FIX] Error rotating endpoint:", e.message); } } function getTargetDomain() { return 'discord.com'; } module.exports = { applyAdvancedFixes, rotateEndpoint, getTargetDomain, getDispatcher };