Providing custom http agent for using socks 4/5
vladgovor77771 opened this issue · comments
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?
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
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.
Closing as support for SOCKS has been added in 2.5.0
, which is now released.