apify / proxy-chain

Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.

Home Page:https://www.npmjs.com/package/proxy-chain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

closeTunnel always returns false?

peterp85 opened this issue · comments

Sample code below is very similar to example listed on apify blog.


const { createTunnel, closeTunnel } = require('proxy-chain');

(async() => {

    const tunnelInfo = await createTunnel(
        'http://aaa:bbbb@127.0.0.1:8888',
        '127.0.0.2:8889'
    );

    closeTunnel(tunnelInfo).then(res=>console.log(res));
})();

No matter what I use as proxyUrl and targetHost result is same - closeTunnel return false but lsof -i -P -n show that port is still listening and I can use it as proxy. Am I missing something?

Tested on nodejs version 10.20.1 and 12.19.0, proxy-chain version 0.4.5

Hello!

I changed a part of code and sended a Pull Request #101, if you wanna fix it in your side until the release, please open the file node_modules\proxy-chain\build\tcp_tunnel_tools.js and do this:

  1. On line 123, please replace resolve() to resolve(true), and do the same in the line 127;
  2. On line 131, please replace runningServers[port].close to runningServers[port].server.close.

If you have any questions or need more help, please let me know.

Kind regards,
André

PR merged!