commit a5a7da490aa10af857456ebe643a7cdae1eb53a1 Author: teor teor@torproject.org Date: Thu Jun 20 18:11:02 2019 +1000
TorNet: refactor IPv4 and IPv6 templates into a single string constant
Turns out it's easy for these to get out of sync. --- lib/chutney/TorNet.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py index 087cef9..fd00088 100644 --- a/lib/chutney/TorNet.py +++ b/lib/chutney/TorNet.py @@ -649,17 +649,19 @@ class LocalNodeBuilder(NodeBuilder): transport = "" extra = ""
- bridgelines = "Bridge %s %s:%s %s %s\n" % (transport, - self._env['ip'], - port, - self._env['fingerprint'], - extra) + BRIDGE_LINE_TEMPLATE = "Bridge %s %s:%s %s %s\n" + + bridgelines = BRIDGE_LINE_TEMPLATE % (transport, + self._env['ip'], + port, + self._env['fingerprint'], + extra) if self._env['ipv6_addr'] is not None: - bridgelines += "Bridge %s %s:%s %s %s\n" % (transport, - self._env['ipv6_addr'], - port, - self._env['fingerprint'], - extra) + bridgelines += BRIDGE_LINE_TEMPLATE % (transport, + self._env['ipv6_addr'], + port, + self._env['fingerprint'], + extra) return bridgelines