proxy-chain
proxy-chain copied to clipboard
Providing custom http agent for using socks 4/5
Simply modified your code on handler_forward.js
// custom `http.Agent` support, set `server.httpAgent`
if (!!this.server.httpAgent) reqOpts.agent = this.server.httpAgent;
And in server.js in constructor add
this.httpAgent = options.httpAgent;
Then, if we want to create server with socks proxy for example, do this:
const { SocksProxyAgent } = require('socks-proxy-agent');
const ProxyChain = require('../proxy-chain');
const info = {
host: ip,
port: 8080,
}
const agent = new SocksProxyAgent(info);
const options = {
port: 8086,
verbose: true,
httpAgent: agent
}
const server = new ProxyChain.Server(options);
server.listen();
But I don't undestand why is it under comment, so we can't use it without code customisation. @jancurn , Can you please add 2 strings to next update please :)
Thanks for the hint @vladgovor77771, we'll look into it when we have time.
@vladgovor77771 what workaround can be used now? Because your code is not working as far as i can see. The agent is not used. Maybe alternative library?
https://github.com/apify/proxy-chain/pull/171
I have made a workaround but currently not working for https... The implementation from @temp3l can maybe help: https://github.com/temp3l/proxy-chain/tree/socksProxy
Another solution here: https://github.com/orlv/tiny-proxy-chain/blob/94fb49c7b9b930817d0308c116d9de6d8b90db8a/index.js#L265
Thanks for the hint @vladgovor77771, we'll look into it when we have time.
Please update these for getting Socks5 support. Waiting for your response.