Is there any method to get the available bandwidth of a Tor Relay. (Not the one the relay publishes itself.)

Plus I wrote the following sets of code:

from stem.descriptor.remote import DescriptorDownloader
downloader_1 = DescriptorDownloader()

  for desc in downloader_1.get_consensus().run():
    print desc.bandwidth
except Exception as exc:
  print("Unable to retrieve the consensus: %s" % exc)

I wanted to know the difference between these two. Does the first script return the available bandwidth?

from stem.descriptor.remote import DescriptorDownloader
downloader_0 = DescriptorDownloader()

  for desc in downloader_0.get_server_descriptors().run(): # Information that relays publish about themselves.
    print desc.average_bandwidth
    print desc.burst_bandwidth
    print desc.observed_bandwidth
except Exception as exc:
  print("Unable to retrieve the server descriptors: %s" % exc)

Can someone explain in detail what values that these code scripts return represent and is one of them the available bandwidth and if not how can one find the available bandwidth.


Not really. You can know it's observed bandwidth, and what it's throughput has been seen to be but not "available" bandwidth. That would require knowledge of, for example, the upperbounds of throughput in any given situation which would be infeasible to calculate and wouldn't be consistent as it would necessarily depend on factors outside of the control or visibility of the tor process.

The information you have about relays comes from the consensus. There are a few values that are published. The relay itself publishes it's bandwidth, the values you are retrieving are:

average_bandwidth (int) -- * average rate it's willing to relay in bytes/s

burst_bandwidth (int) -- * burst rate it's willing to relay in bytes/s

observed_bandwidth (int) -- * estimated capacity based on usage in bytes/s

The first two are the values published by the relay, the third is the bandwidth observed by the bwauths, defined in dirspec.txt

You may also be interested in the "extrainfo" descriptor values of read-history and write-history.

All other descriptor values are also defined in dirspec.txt.


The point is that you should monitor it's server descriptor. If the bandwidth is limited in it's torrc config, you will see it constant or almost-constant. If it's not limited in torrc - even in firewall shaping, for example - you have to measure speed by using it as an exit.... Your script will probe a server descriptor data, add speed verification and you will be just fine in all cases

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.