talmobi/tor-request

Multiple SOCKSPorts

Closed this issue · 3 comments

kaue commented

Hello, i would like to know if its possible to use this module with multiple SOCKSPorts configured to make multiple requests at the same time with different ips.

for(var i = 0; i <= 1; i++){
  console.log("Sending request using SOCKSPorts" + (9050 + i));
  var tr = require('tor-request');
  tr.TorControlPort.password = "hidden";
  tr.setTorAddress('localhost', 9050 + i);
  tr.newTorSession(function(err){
    if(err) console.error(err);
    tr.request('https://api.ipify.org', function (err, res, body) {  
      if(err) return console.error(err);  
      console.log("Your public (through Tor) IP is: " + body);  
    });  
  });  
}

Result:

Sending request using SOCKSPort 9050
Sending request using SOCKSPort 9051
Your public (through Tor) IP is: 109.163.234.8
Your public (through Tor) IP is: 109.163.234.8

kaue commented

With #7 i was able to send requests with multiple ips.

Closing this due to old age, lack of updates and no clear usage design that could be implemented.