talmobi/tor-request

multi instances of tor

Closed this issue · 2 comments

hi
how can i use multi instances of tor-request with multi instances of tor?

The module assumed you're only connecting to a single tor client. Not exactly sure why you would want to connect to multiple ones at the same time (usually you're connecting to your own tor client which handles all the actual tor related networking details).

You could spawn child processes or fork and wrap the code with an create/init function that.

The crux of your problem is that the tor client configuration (address, password, port) are mutable and "global" to the module once it's required (so you don't have to pass an instance around across multiple files):

tor-request/index.js

Lines 315 to 318 in ae9b258

setTorAddress: function ( ipaddress, port ) {
// update the default proxy settings
_defaultProxySettings = createProxySettings( ipaddress, port )
},

But, like I said, not sure why this is desirable or practical (you only run one tor client locally that you connect to).

tanks