// src/proxy.js — Manual proxy support (no external fetch) // HF Spaces Secrets-এ PROXY_LIST দাও: "ip1:port1,ip2:port2" let proxyList = process.env.PROXY_LIST ? process.env.PROXY_LIST.split(",").map((p) => p.trim()).filter(Boolean) : []; let currentIndex = 0; // Round-robin function getNextProxy() { if (!proxyList.length) return null; const proxy = `http://${proxyList[currentIndex % proxyList.length]}`; currentIndex++; return proxy; } function removeCurrentProxy() { if (!proxyList.length) return; const idx = (currentIndex - 1 + proxyList.length) % proxyList.length; proxyList.splice(idx, 1); console.log(`🗑️ Proxy removed. Remaining: ${proxyList.length}`); } function getStats() { return { total: proxyList.length, active: currentIndex % Math.max(proxyList.length, 1), }; } // No-op — external fetch নেই async function fetchProxies() {} module.exports = { fetchProxies, getNextProxy, removeCurrentProxy, getStats };