Created
August 3, 2018 00:19
-
-
Save DanNi0130/2d7fa16fdabef4c600e69c315d8140e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const proxies = { | |
'useragent1': 'http://proxyusername1:proxypassword1@proxyhost1:proxyport1', | |
'useragent2': 'http://proxyusername2:proxypassword2@proxyhost2:proxyport2', | |
'useragent3': 'http://proxyusername3:proxypassword3@proxyhost3:proxyport3', | |
}; | |
const server = new ProxyChain.Server({ | |
port: 8000, | |
prepareRequestFunction: ({request}) => { | |
const userAgent = request.headers['user-agent']; | |
const proxy = proxies[userAgent]; | |
return { | |
upstreamProxyUrl: proxy, | |
}; | |
}); | |
}); | |
server.listen(() => console.log('proxy server started')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment