mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] refreshes and blacklists failed proxies
This commit is contained in:
@@ -68,5 +68,9 @@ function cacheUserAgent(id, method) {
|
||||
return cacheWrap(remoteCache, `${USER_AGENT_KEY_PREFIX}:${id}`, method, { ttl: USER_AGENT_TTL });
|
||||
}
|
||||
|
||||
module.exports = { cacheWrapStream, cacheWrapResolvedUrl, cacheWrapProxy, cacheUserAgent };
|
||||
function uncacheProxy(id) {
|
||||
return remoteCache.del(`${PROXY_KEY_PREFIX}:${id}`);
|
||||
}
|
||||
|
||||
module.exports = { cacheWrapStream, cacheWrapResolvedUrl, cacheWrapProxy, cacheUserAgent, uncacheProxy };
|
||||
|
||||
|
||||
@@ -17,4 +17,12 @@ function getRandomProxy() {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
module.exports = { getRandomUserAgent, getRandomProxy };
|
||||
function blacklistProxy(proxy) {
|
||||
const proxyHost = proxy.replace(/.*@/, '');
|
||||
console.warn(`Blacklisting ${proxyHost}`);
|
||||
if (PROXY_HOSTS && PROXY_HOSTS.indexOf(proxyHost) > -1) {
|
||||
PROXY_HOSTS.splice(PROXY_HOSTS.indexOf(proxyHost), 1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { getRandomUserAgent, getRandomProxy, blacklistProxy };
|
||||
Reference in New Issue
Block a user