Skip to content

Tor new IP on each request or at will #36

@MilosHavranek

Description

@MilosHavranek

Is your feature request related to a problem? Please describe.
I want to use this Tor library to make requests to single/similar URL multiple times from different IP.
Each time the URL will be called, it requires new IP since the service that will be accessed limits usage per IP.
What is not required for this to work is speed. If i were to make 10 requests to the URL it would be fine if accessing all those took ~1-2 minutes.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Currently this library or it's dependencies does not provide a way to restart Tor connection in runtime without killing the Tor process.

Describe the solution you'd like
I really like the solution i've seen used in python stem library.
https://stem.torproject.org/faq.html#how-do-i-reload-my-torrc

from stem import Signal
from stem.control import Controller

with Controller.from_port(port = 9051) as controller:
  controller.authenticate()
  controller.signal(Signal.HUP)

As the documentation states, this can be achieved via sending a singla RELOAD: HUP. https://github.com/torproject/torspec/blob/main/control-spec.txt

A clear and concise description of what you want to happen.
Obtain new IP address.

Describe alternatives you've considered

  • Abillity to call some function/method tor.reload() to obtain new IP address.
  • Or abillity to create new instance of Tor Controller without killing it's Tor process to obtain new IP address like the python stem library is able to do..

Additional context
I tried sending the RELOAD signal with local build of com.github.bisq-network.netlayer:tor, but that only closed Tor circuits and the Tor Socks port got closed as well (without opening a new one).
I am not exactly sure what should be done in the terms of this/dependant java implementations to open new Tor Socks port.
Maybe my attempt with the RELOAD was wrong in the first place, but it works fine here: https://github.com/setnicka/ulozto-downloader/blob/0e3b810f7676f543bf403f2f6b998c9ea02fb893/uldlib/torrunner.py#L59.

I also tried using NEWNYM, but that does not provide deterministic outcome, since the new circuits provided can ultimately have the same IP or the signal is ignored by Tor at some point.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions