How to connect to Tor bridge from node.js?

I am new to Tor. I recently managed to make a request from node.js while running a tor tor instance on my PC.

I used the following piece of code:

var Agent = require('socks5-https-client/lib/Agent');
var request = require("request");

var q = "https://www.example.com/";

request({
    url: q,
    agentClass: Agent,
    agentOptions: {
        socksHost: 'localhost',
        socksPort: 9050 // Defaults to 1080.
    }
}, function(err, res) {
    console.log(err || res.body);
});

      

I would like to connect to Tor without running the Tor server on my PC. I believe this is possible with the Tor bridge. I got the IP address from https://bridges.torproject.org/bridges :

2.91.117.71:443 3C2AAD50197ACE1A43C822BBE282E0534603A31F

      

I am not sure how to use this information. I tried to install:

    agentOptions: {
        socksHost: '2.91.117.71',
        socksPort: 443
    }

      

but i get timeout:

{ [Error: connect ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect' }

      

My questions:

  • Is it possible to connect to the public Tor server with https from node.js?
  • If so, how?
+3


source to share


2 answers


Tor-Bridge is used for people who cannot connect to the regular Tor network because their ISP is blocking the well-known Tor servers. If the first connection is made through Bridge, you will have no problem after that, because usually these bridges are not known to everyone, so they are usually not blocked by ISPs, since they look like regular servers.

You still need Tor-Client to connect to them.

It is impossible to connect to the Tor network without a Tor client.



In your first code, your Tor client acts as a socks proxy and simply proxies your requests through the Tor network.

You can try if this library works.

+1


source


Tor bridges are not what you want to use. What worked for me was to set up a VPS (look at digitalocean $ 5 per month on SSD) with Debian (Ubuntu 14.04 is what I prefer) and install tor and nodejs if you don't want to try a language that already has a mature body documentation connecting and managing like Python (my preferred language for Tor).

Then you can run the same code from that VPS and it will work, that way you won't be executing the code on your local machine and you can change your IP address on the VPS when it suits you and use things like this, as proxychains to scan traffic that you are viewing through proxies other than just TOR.



Hope it helps.

+2


source







All Articles