UNPKG

ignitetnt

Version:

IGNITE OS — Advanced proxy-enabled gaming platform with comprehensive filter bypass system

219 lines (187 loc) • 6.56 kB
// Comprehensive list of proxy domains and fallback services // Automatically updated and tested for availability export const PROXY_DOMAINS = { // Primary custom proxies (deploy these) primary: [ 'https://proxy1.ignite-os.workers.dev', 'https://proxy2.ignite-os.vercel.app/api/proxy', 'https://proxy3.ignite-os.netlify.app/.netlify/functions/proxy', 'https://ignite-proxy.herokuapp.com/proxy', 'https://ignite-games.fly.dev/proxy' ], // Public CORS proxies (may be less reliable) public: [ 'https://cors-anywhere.herokuapp.com', 'https://api.allorigins.win/raw?url=', 'https://thingproxy.freeboard.io/fetch/', 'https://cors-proxy.htmldriven.com/?url=', 'https://yacdn.org/proxy/' ], // Alternative services alternatives: [ 'https://api.codetabs.com/v1/proxy?quest=', 'https://crossorigin.me/', 'https://cors.bridged.cc/', 'https://proxy.cors.sh/', 'https://corsproxy.io/?' ] }; // Game server alternatives export const GAME_SERVERS = [ 'https://gms.parcoil.com', 'https://games.parcoil.com', 'https://cdn.parcoil.com/games', 'https://content.parcoil.com/gms', 'https://assets.parcoil.com/games' ]; // Content delivery networks for static assets export const CDN_ENDPOINTS = [ 'https://cdn.jsdelivr.net/gh/parcoilnetwork/games@main', 'https://unpkg.com/parcoil-games@latest', 'https://rawcdn.githack.com/parcoilnetwork/games/main', 'https://gitcdn.xyz/repo/parcoilnetwork/games/main' ]; // DNS-over-HTTPS providers for bypassing DNS filtering export const DOH_PROVIDERS = [ 'https://cloudflare-dns.com/dns-query', 'https://dns.google/dns-query', 'https://dns.quad9.net/dns-query', 'https://doh.opendns.com/dns-query' ]; // Domain fronting services (use with caution) export const DOMAIN_FRONTS = [ 'ajax.googleapis.com', 'fonts.googleapis.com', 'cdnjs.cloudflare.com', 'unpkg.com', 'cdn.jsdelivr.net' ]; class ProxyManager { constructor() { this.workingProxies = new Map(); this.lastTested = new Map(); this.testInterval = 5 * 60 * 1000; // 5 minutes this.currentProxyIndex = 0; } // Get all proxy endpoints in priority order getAllProxies() { return [ ...PROXY_DOMAINS.primary, ...PROXY_DOMAINS.public, ...PROXY_DOMAINS.alternatives ]; } // Test a single proxy endpoint async testProxy(proxyUrl, testTarget = 'https://httpbin.org/status/200') { try { const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), 5000); let testUrl; if (proxyUrl.includes('?url=') || proxyUrl.includes('?quest=') || proxyUrl.includes('?')) { testUrl = `${proxyUrl}${encodeURIComponent(testTarget)}`; } else { testUrl = `${proxyUrl}?target=${btoa(testTarget)}&t=${Date.now()}`; } const response = await fetch(testUrl, { method: 'HEAD', signal: controller.signal, headers: { 'User-Agent': 'Mozilla/5.0 (compatible; ProxyTester/1.0)', 'Accept': '*/*' } }); clearTimeout(timeoutId); const isWorking = response.ok || response.status === 200; this.workingProxies.set(proxyUrl, isWorking); this.lastTested.set(proxyUrl, Date.now()); return isWorking; } catch (error) { console.warn(`Proxy test failed for ${proxyUrl}:`, error.name); this.workingProxies.set(proxyUrl, false); this.lastTested.set(proxyUrl, Date.now()); return false; } } // Test multiple proxies in parallel async testProxies(proxyList = null) { const proxies = proxyList || this.getAllProxies(); const testPromises = proxies.map(proxy => this.testProxy(proxy)); try { await Promise.allSettled(testPromises); console.log('Proxy testing completed'); return this.getWorkingProxies(); } catch (error) { console.error('Proxy testing failed:', error); return []; } } // Get list of working proxies getWorkingProxies() { const working = []; for (const [proxy, isWorking] of this.workingProxies) { if (isWorking) working.push(proxy); } return working; } // Get the best available proxy async getBestProxy() { const now = Date.now(); // Check if we need to retest proxies const needsTesting = this.getAllProxies().some(proxy => { const lastTest = this.lastTested.get(proxy); return !lastTest || (now - lastTest) > this.testInterval; }); if (needsTesting) { console.log('Testing proxy endpoints...'); await this.testProxies(); } const workingProxies = this.getWorkingProxies(); if (workingProxies.length === 0) { console.warn('No working proxies found, using fallback'); return this.getAllProxies()[0]; // Return first proxy as fallback } // Rotate through working proxies const proxy = workingProxies[this.currentProxyIndex % workingProxies.length]; this.currentProxyIndex++; return proxy; } // Create proxy URL with automatic endpoint selection async createProxyUrl(targetUrl) { const proxyEndpoint = await this.getBestProxy(); if (proxyEndpoint.includes('?url=') || proxyEndpoint.includes('?quest=')) { return `${proxyEndpoint}${encodeURIComponent(targetUrl)}`; } else if (proxyEndpoint.includes('allorigins.win')) { return `${proxyEndpoint}${encodeURIComponent(targetUrl)}`; } else if (proxyEndpoint.includes('thingproxy.freeboard.io')) { return `${proxyEndpoint}${encodeURIComponent(targetUrl)}`; } else { const encoded = btoa(targetUrl).replace(/[+/=]/g, c => ({ '+': '-', '/': '_', '=': '' }[c]) ); return `${proxyEndpoint}?target=${encoded}&origin=${encodeURIComponent(location.origin)}&t=${Date.now()}`; } } // Health check for continuous monitoring startHealthCheck() { setInterval(async () => { console.log('Running proxy health check...'); await this.testProxies(); }, this.testInterval); } // Get proxy statistics getStats() { const total = this.getAllProxies().length; const working = this.getWorkingProxies().length; const tested = this.lastTested.size; return { total, working, tested, healthRatio: working / total, lastUpdate: Math.max(...this.lastTested.values()) }; } } // Create global proxy manager instance window.proxyManager = new ProxyManager(); export { ProxyManager };