commit c707674ba9b0d7931038c12bbe2d01585a88eb22
Merge: dfec0b8 b8f1e5c
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Thu Aug 27 10:38:21 2020 +0200
Merge branch 'phw-enhancement-33432-3' into develop
CHANGELOG.md | 4 ++
onionperf/measurement.py | 139 +++++++++++++++++++-----------------
onionperf/model.py | 98 ++++++++++++++-----------
onionperf/onionperf | 60 ++++++++++++----
onionperf/tests/test_measurement.py | 12 ++--
5 files changed, 185 insertions(+), 128 deletions(-)
diff --cc CHANGELOG.md
index c31a40e,ac6897b..4b7fcb2
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -1,9 -1,11 +1,13 @@@
# Changes in version 0.7 - 2020-??-??
+ - Add `onionperf measure --drop-guards` parameter to use and drop
+ guards after a given number of hours. Implements #33399.
+ - Remove the `onionperf measure --oneshot` switch and replace it with
+ new switches `--tgen-pause-initial`, `--tgen-pause-between`,
+ `--tgen-transfer-size`, and `--tgen-num-transfers ` to further
+ configure the generated TGen model.
-# Changes in version 0.6 - 2020-??-??
+# Changes in version 0.6 - 2020-08-08
- Update to TGen 1.0.0, use TGenTools for parsing TGen log files, and
update analysis results file version to 3.0. Implements #33974.
diff --cc onionperf/measurement.py
index 709fbc6,d699292..f198be0
--- a/onionperf/measurement.py
+++ b/onionperf/measurement.py
@@@ -173,7 -188,7 +188,7 @@@ def logrotate_thread_task(writables, tg
class Measurement(object):
- def __init__(self, tor_bin_path, tgen_bin_path, datadir_path, privatedir_path, nickname, oneshot, additional_client_conf=None, torclient_conf_file=None, torserver_conf_file=None, single_onion=False, drop_guards_interval_hours=0):
- def __init__(self, tor_bin_path, tgen_bin_path, datadir_path, privatedir_path, nickname, additional_client_conf=None, torclient_conf_file=None, torserver_conf_file=None, single_onion=False):
++ def __init__(self, tor_bin_path, tgen_bin_path, datadir_path, privatedir_path, nickname, additional_client_conf=None, torclient_conf_file=None, torserver_conf_file=None, single_onion=False, drop_guards_interval_hours=0):
self.tor_bin_path = tor_bin_path
self.tgen_bin_path = tgen_bin_path
self.datadir_path = datadir_path
@@@ -189,13 -203,11 +203,12 @@@
self.torclient_conf_file = torclient_conf_file
self.torserver_conf_file = torserver_conf_file
self.single_onion = single_onion
+ self.drop_guards_interval_hours = drop_guards_interval_hours
- def run(self, do_onion=True, do_inet=True, client_tgen_listen_port=58888, client_tgen_connect_ip='0.0.0.0', client_tgen_connect_port=8080, client_tor_ctl_port=59050, client_tor_socks_port=59000,
- server_tgen_listen_port=8080, server_tor_ctl_port=59051, server_tor_socks_port=59001):
+ def run(self, do_onion=True, do_inet=True, tgen_model=None, tgen_client_conf=None, tgen_server_conf=None):
'''
- only `server_tgen_listen_port` are "public" and need to be opened on the firewall.
- if `client_tgen_connect_port` != `server_tgen_listen_port`, then you should have installed a forwarding rule in the firewall.
+ only `tgen_server_conf.listen_port` are "public" and need to be opened on the firewall.
+ if `tgen_client_conf.connect_port` != `tgen_server_conf.listen_port`, then you should have installed a forwarding rule in the firewall.
all ports need to be unique though, and unique among multiple onionperf instances.
here are some sane defaults:
diff --cc onionperf/onionperf
index 641db70,6a16da2..e6aa44a
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@@ -195,12 -190,30 +190,36 @@@ def main()
action="store", dest="tgenconnectport",
default=8080)
+ measure_parser.add_argument('--tgen-pause-initial',
+ help="""the number of seconds TGen should wait before walking through its action graph""",
+ metavar="N", type=int,
+ action="store", dest="tgenpauseinitial",
+ default=300)
+
+ measure_parser.add_argument('--tgen-pause-between',
+ help="""the number of seconds TGen should wait in between two transfers""",
+ metavar="N", type=int,
+ action="store", dest="tgenpausebetween",
+ default=300)
+
+ measure_parser.add_argument('--tgen-transfer-size',
+ help="""the size of the file transfer that TGen will perform (e.g., '5 MiB' or '10 KiB')""",
+ metavar="STRING", type=str,
+ action="store", dest="tgentransfersize",
+ default="5 MiB")
+
+ measure_parser.add_argument('--tgen-num-transfers',
+ help="""the number of file transfers that TGen will perform""",
+ metavar="N", type=int,
+ action="store", dest="tgennumtransfers",
+ default=0)
+
+ measure_parser.add_argument('--drop-guards',
+ help="""Use and drop guards every N > 0 hours, or do not use guards at all if N = 0""",
+ metavar="N", type=type_nonnegative_integer,
+ action="store", dest="drop_guards_interval_hours",
+ default=0)
+
onion_or_inet_only_group = measure_parser.add_mutually_exclusive_group()
onion_or_inet_only_group.add_argument('-o', '--onion-only',