I am new to Tor. I have recently managed to execute a query from node.js while running a tor server instance on my PC.
I have 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 a Tor server on my PC. I believe this is possible with a Tor bridge. I have retrieved an IP address from https://bridges.torproject.org/bridges:
2.91.117.71:443 3C2AAD50197ACE1A43C822BBE282E0534603A31F
I am not really sure how to use this information. I have tried to set:
agentOptions: {
socksHost: '2.91.117.71',
socksPort: 443
}
but I get a timeout:
{ [Error: connect ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect' }
My questions are:
A Tor-Bridge is used for people who are not able to connect to the normal Tor-Network because their ISP is blocking the publicly known Tor-Servers. If the first connection is done through a Bridge you wont have problems afterwards because usually these Bridges are not known to everyone so they are usually not blocked by the ISPs as they look like normal servers.
You still need a Tor-Client to connect to them.
There is no way to connect to the Tor network without having a Tor Client.
In your first code your Tor-Client is acting like a socks-proxy and just proxying your requests through the Tor network.
You could try if this library works.