[tor-commits] [onionperf/master] Adds code to read and append files to tor_config configuration string

irl at torproject.org irl at torproject.org
Thu Mar 14 17:16:36 UTC 2019


commit 02a05543c95f3fbb87783ddd45e92f945ff504bc
Author: Ana Custura <ana at netstat.org.uk>
Date:   Mon Mar 4 20:40:48 2019 +0100

     Adds code to read and append files to tor_config configuration string
---
 onionperf/measurement.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/onionperf/measurement.py b/onionperf/measurement.py
index e35e439..d76d493 100644
--- a/onionperf/measurement.py
+++ b/onionperf/measurement.py
@@ -368,6 +368,12 @@ class Measurement(object):
         tor_config_template = self.base_config + "RunAsDaemon 0\nORPort 0\nDirPort 0\nControlPort {0}\nSocksPort {1}\nSocksListenAddress 127.0.0.1\nClientOnly 1\n\
 WarnUnsafeSocks 0\nSafeLogging 0\nMaxCircuitDirtiness 60 seconds\nDataDirectory {2}\nLog INFO stdout\n"
         tor_config = tor_config_template.format(control_port, socks_port, tor_datadir)
+        if name == "server" and self.torserver_conf_file:
+            with open(self.torserver_conf_file, 'r') as f:
+                tor_config += f.read()
+        if name == "client" and self.torclient_conf_file:
+            with open(self.torclient_conf_file, 'r') as f:
+                tor_config = tor_config + f.read()
         if name == "client" and self.additional_client_conf:
             tor_config += self.additional_client_conf
         if not 'UseEntryGuards' in tor_config and not 'UseBridges' in tor_config:





More information about the tor-commits mailing list