I noticed a significant variance in bandwidth with different TOR circuits. Some are fast enough for streaming HD videos, while others take ages just loading web pages unless Javascript is deactivated. Therefore, when first launching the TOR browser, I usually keep hitting the "New Identity" button (which AFAIK builds a new circuit) until the loading time for a certain web page is reasonably short. In most cases, this takes 4-5 attempts. The difference in speed can be huge, so I always do this before streaming media or browsing script-heavy sites.

Is it possible to automatize this startup procedure, i.e. have the TOR browser start, build a circuit, gauge the bandwidth, and build a new circuit if a certain bandwidth threshold isn't reached? Could this, for instance, be done with a Bash or Python script?

Something along the lines of:

WHILE i < 10:
    START tor_browser
    DOWNLOAD https://blah.com/test.png
    bw = DOWNLOAD.bandwidth()
    IF bw > bw_min:    #e.g. 2 Mbps
        QUIT tor_browser

Where would one even start? Does the TOR browser have an API that can interface e.g. with Python? How does one make the browser download a file (in contrast to using curl or the like) and how measure the bandwidth? Is it something like "TOR uses a certain port and there exists a Python package that can monitor the traffic through it"?

  • I don't have an answer, but I'll mention that there has been a lot of research into different circuit path selection algorithms to try to choose circuits with better bandwidth or latency. The problem is generally that if an adversary knows that your circuit selection is biased to certain types of circuits (like fast ones), it can hurt your anonymity. This is why Tor hasn't added something like this already.
    – Steve
    Jul 13, 2020 at 20:30
  • Yeah, I had the same thought! ;) But let's neglect anonymity for now as this touches on a different problem set
    – david
    Jul 14, 2020 at 1:20


You must log in to answer this question.

Browse other questions tagged .