aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Finkel <Matthew.Finkel@gmail.com>2013-11-13 23:24:19 +0000
committerMatthew Finkel <Matthew.Finkel@gmail.com>2013-11-13 23:37:16 +0000
commitcd68031aec2bccad647cda5d1bb82454dfb0e158 (patch)
tree14da99ab24cce229e55c4a36fdcd57452cc09626
parent618ae49063f9b9398a3606d31d6c011ea861114f (diff)
downloadchutney-cd68031aec2bccad647cda5d1bb82454dfb0e158.tar
chutney-cd68031aec2bccad647cda5d1bb82454dfb0e158.tar.gz
Use AlternateDirAuthority when Bridge Authority exists in network
Setting both DirServer and AlternateBridgeAuthority are incompatible. We should use AlternateDirAuthority when we also have a Bridge Authority.
-rw-r--r--lib/chutney/TorNet.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index c377a03..77e768a 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -302,7 +302,7 @@ class LocalNodeBuilder(NodeBuilder):
assert re.match(r'^[A-F0-9]{40}$', fingerprint)
self._env['fingerprint'] = fingerprint
- def _getAltAuthLines(self):
+ def _getAltAuthLines(self, hasbridgeauth=False):
"""Return a combination of AlternateDirAuthority,
AlternateHSAuthority and AlternateBridgeAuthority lines for
this Node, appropriately. Non-authorities return ""."""
@@ -330,8 +330,10 @@ class LocalNodeBuilder(NodeBuilder):
# the 'hs' and 'v3ident' flags set.
# XXXX This next line is needed for 'bridges' but breaks
# 'basic'
- #options = ("AlternateDirAuthority",)
- options = ("DirServer",)
+ if hasbridgeauth:
+ options = ("AlternateDirAuthority",)
+ else:
+ options = ("DirAuthority",)
self._env['dirserver_flags'] += " hs v3ident=%s" % v3id
authlines = ""
@@ -470,6 +472,7 @@ class LocalNodeController(NodeController):
DEFAULTS = {
'authority' : False,
'bridgeauthority' : False,
+ 'hasbridgeauth' : False,
'relay' : False,
'bridge' : False,
'connlimit' : 60,
@@ -575,7 +578,8 @@ class Network(object):
for b in builders:
b.preConfig(network)
- altauthlines.append(b._getAltAuthLines())
+ altauthlines.append(b._getAltAuthLines(
+ self._dfltEnv['hasbridgeauth']))
bridgelines.append(b._getBridgeLines())
self._dfltEnv['authorities'] = "".join(altauthlines)
@@ -656,6 +660,8 @@ def ConfigureNodes(nodelist):
for n in nodelist:
network._addNode(n)
+ if n._env['bridgeauthority']:
+ network._dfltEnv['hasbridgeauth'] = True
def usage(network):
return "\n".join(["Usage: chutney {command} {networkfile}",