I need to instantiate a local proxy in Go (accessible via http://localhost:8080) which itself passes through another proxy (accessible via http://vvv:[email protected]:zzz).
I can do this just fine in JS via:
const ProxyChain = require('proxy-chain');
const server = new ProxyChain.Server({
port: 8080,
verbose: true,
prepareRequestFunction: ({ request, username, password, hostname, port, isHttp, connectionId }) => {
return {
upstreamProxyUrl: `http://vvv:[email protected]:zzz`,
};
},
});
server.listen(() => {
console.log(`Proxy server is listening`);
});
But for performance reasons (I need to instantiate hundreds of local proxies) I’m looking for an equivalent in Go, in particular to chain with another proxy.
Any ideas ?
I’ve already tried several Go libraries (goproxy, …) but what gets in the way every time is the chain with the remote proxy, which is either ignored, or it’s the user/password that doesn’t seem to be transmitted.