commit ccf03a04fcc160a2b87fd0361e7b4c31c562f1b1
Author: Damian Johnson <atagar(a)torproject.org>
Date: Sun Aug 4 16:49:14 2013 -0700
Additions for our examples page
Adding Robert's RTT Prober and updating the entry for my descriptor monitors.
---
docs/tutorials/double_double_toil_and_trouble.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/tutorials/double_double_toil_and_trouble.rst b/docs/tutorials/double_double_toil_and_trouble.rst
index 129a302..f207b95 100644
--- a/docs/tutorials/double_double_toil_and_trouble.rst
+++ b/docs/tutorials/double_double_toil_and_trouble.rst
@@ -19,7 +19,8 @@ something you would like to have included on this page then `let me know
including system resource usage, connection information, and much more.
=========================================================================================================== ==========
-`Consensus Tracker <https://gitweb.torproject.org/atagar/tor-utils.git/blob/HEAD:/consensusTracβ¦>`_ Script that performs an hourly check for the number of relays within the Tor network, looking for large jumps that may indicate a sybil attack.
+`Descriptor Monitors <https://gitweb.torproject.org/atagar/tor-utils.git/tree>`_ Scripts that perform hourly checks on the tor network's present status.
+`RTT Prober <https://bitbucket.org/ra_/tor-rtt/>`_ Measures round-trip times for tor circuits.
`Metrics Tasks <https://gitweb.torproject.org/metrics-tasks.git/tree>`_ One-off tasks related to Tor metrics. These mostly involve using descriptor information to answer a particular question. Tasks that involve stem are: `1854 <https://gitweb.torproject.org/metrics-tasks.git/blob/HEAD:/task-1854/pylinfβ¦>`_, `6232 <https://gitweb.torproject.org/metrics-tasks.git/blob/HEAD:/task-6232/pyentrβ¦>`_, and `7241 <https://gitweb.torproject.org/metrics-tasks.git/blob/HEAD:/task-7241/first_β¦>`_.
`check_tor <http://anonscm.debian.org/gitweb/?p=users/lunar/check_tor.git;a=blob;f=checβ¦>`_ Nagios check to verify that a relay is participating in the Tor network.
=========================================================================================================== ==========
commit e78f1b74efac02ed09f963c65a652b87ea80f5f2
Author: Damian Johnson <atagar(a)torproject.org>
Date: Sun Aug 4 16:25:09 2013 -0700
Having get_server_descriptor() warn when using microdescriptors
Tor presently gets microdescriptors rather than server descriptors by default.
More than one person has been confused by this, so adding a warning to our
Controller when server descriptors are unavailable...
>>> controller.get_server_descriptor('9695DFC35FFEB861329B9F1AB04C46397020CE31')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "stem/control.py", line 1207, in get_server_descriptor
raise ValueError(SERVER_DESCRIPTORS_UNSUPPORTED)
ValueError: Tor is presently not configured to retrieve server descriptors. As
of Tor version 0.2.3.25 it downloads microdescriptors instead unless you set
'UseMicrodescriptors 0' in your torrc.
This was suggested by Robert in...
https://lists.torproject.org/pipermail/tor-dev/2013-July/005196.html
---
stem/control.py | 18 ++++++++++++++++++
test/integ/control/controller.py | 3 +++
2 files changed, 21 insertions(+)
diff --git a/stem/control.py b/stem/control.py
index 0f589e1..7e7aab4 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -222,6 +222,10 @@ CACHEABLE_GETINFO_PARAMS = (
# is unavailable
GEOIP_FAILURE_THRESHOLD = 5
+SERVER_DESCRIPTORS_UNSUPPORTED = "Tor is presently not configured to retrieve \
+server descriptors. As of Tor version 0.2.3.25 it downloads microdescriptors \
+instead unless you set 'UseMicrodescriptors 0' in your torrc."
+
class BaseController(object):
"""
@@ -1199,6 +1203,9 @@ class Controller(BaseController):
return stem.descriptor.server_descriptor.RelayDescriptor(desc_content)
except Exception as exc:
if default == UNDEFINED:
+ if not self._is_server_descriptors_available():
+ raise ValueError(SERVER_DESCRIPTORS_UNSUPPORTED)
+
raise exc
else:
return default
@@ -1231,6 +1238,9 @@ class Controller(BaseController):
desc_content = self.get_info("desc/all-recent", get_bytes = True)
+ if not desc_content and not self._is_server_descriptors_available():
+ raise ValueError(SERVER_DESCRIPTORS_UNSUPPORTED)
+
for desc in stem.descriptor.server_descriptor._parse_file(io.BytesIO(desc_content)):
yield desc
except Exception as exc:
@@ -1241,6 +1251,14 @@ class Controller(BaseController):
for entry in default:
yield entry
+ def _is_server_descriptors_available(self):
+ """
+ Checks to see if tor server descriptors should be available or not.
+ """
+
+ return self.get_version() < stem.version.Requirement.MICRODESCRIPTOR_IS_DEFAULT or \
+ self.get_conf('UseMicrodescriptors', None) == '0'
+
def get_network_status(self, relay, default = UNDEFINED):
"""
Provides the router status entry for the relay with the given fingerprint
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 801d979..69112cf 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -921,6 +921,9 @@ class TestController(unittest.TestCase):
if test.runner.require_control(self):
return
+ elif runner.get_tor_version() >= Requirement.MICRODESCRIPTOR_IS_DEFAULT:
+ test.runner.skip(self, "(requires server descriptors)")
+ return
with runner.get_tor_controller() as controller:
count = 0