talmobi / tor-request

light Tor proxy wrapper for request library
http://tor.jin.fi/
311 stars 43 forks source link

multi instances of tor #35

Closed TheServat closed 5 years ago

TheServat commented 5 years ago

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

talmobi commented 5 years ago

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): https://github.com/talmobi/tor-request/blob/ae9b25835f852dbaf5cbb58949dca7cb3b71e34d/index.js#L315-L318

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

TheServat commented 5 years ago

tanks