[tor-commits] [oonib/master] Parametrise the DNS test helper remote resolver.
art at torproject.org
art at torproject.org
Wed Sep 11 09:13:52 UTC 2013
commit 639e23d7341c4a12a3cf5b901d1479e2f4fee38b
Author: Arturo Filastò <art at fuffa.org>
Date: Tue Sep 10 19:52:33 2013 +0200
Parametrise the DNS test helper remote resolver.
---
oonib.conf.example | 1 +
oonib/testhelpers/dns_helpers.py | 11 ++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/oonib.conf.example b/oonib.conf.example
index 323b2af..c25d405 100644
--- a/oonib.conf.example
+++ b/oonib.conf.example
@@ -50,6 +50,7 @@ helpers:
address: null
udp_port: 57004
tcp_port: 57005
+ resolver_address: '8.8.8.8:53'
ssl:
address: null
diff --git a/oonib/testhelpers/dns_helpers.py b/oonib/testhelpers/dns_helpers.py
index dc9c772..8959215 100644
--- a/oonib/testhelpers/dns_helpers.py
+++ b/oonib/testhelpers/dns_helpers.py
@@ -3,11 +3,20 @@ from twisted.internet import reactor
from twisted.names import dns
from twisted.names import client, server
+from oonib import config
+
class DNSTestHelper(server.DNSServerFactory):
def __init__(self, authorities = None,
caches = None, clients = None,
verbose = 0):
- resolver = client.Resolver(servers=[('8.8.8.8', 53)])
+ try:
+ host, port = config.helpers.dns.split(':')
+ port = int(port)
+ # XXX remove this when we have configuration file versioning.
+ # https://github.com/TheTorProject/ooni-probe/issues/190
+ except:
+ host, port = '8.8.8.8', 53
+ resolver = client.Resolver(servers=[(host, port)])
server.DNSServerFactory.__init__(self, authorities = authorities,
caches = caches, clients = [resolver],
verbose = verbose)
More information about the tor-commits
mailing list