summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2020-05-26 23:05:02 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2020-05-26 23:08:01 +0200
commitf842dd181728bc3d01c25c474f6510a857e5fb0c (patch)
treea3cd61ab862732997a99ccc339ff27fbd1722b75
parentee8a005b41aaec456b3a08f188f3b3b7431d1793 (diff)
Make -o/-i arguments mutually exclusive.task-34316
Right now, it's possible to specify both -o and -i at the same time, which doesn't make any sense. Also, it's rather non-intuitive that both argument defaults are True and that setting either of them changes their value to False. This patch fixes both issues above. Fixes #34316.
-rwxr-xr-xonionperf/onionperf20
1 files changed, 11 insertions, 9 deletions
diff --git a/onionperf/onionperf b/onionperf/onionperf
index 38ef443..a594d25 100755
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@ -189,15 +189,17 @@ def main():
action="store", dest="tgenconnectport",
default=8080)
- measure_parser.add_argument('-o', '--onion-only',
- help="""disable measuring download times over Tor back to {0}""".format(hostname),
- action="store_false", dest="do_inet",
- default=True)
+ onion_or_inet_only_group = measure_parser.add_mutually_exclusive_group()
- measure_parser.add_argument('-i', '--inet-only',
- help="""disable measuring download times over Tor to an ephemeral onion service""",
- action="store_false", dest="do_onion",
- default=True)
+ onion_or_inet_only_group.add_argument('-o', '--onion-only',
+ help="""only measure download times over Tor to an ephemeral onion service""",
+ action="store_true", dest="onion_only",
+ default=False)
+
+ onion_or_inet_only_group.add_argument('-i', '--inet-only',
+ help="""only measure download times over Tor exiting to a public webserver""",
+ action="store_true", dest="inet_only",
+ default=False)
measure_parser.add_argument('-n', '--nickname',
help="""the 'SOURCE' STRING to use in measurement result files produced by OnionPerf""",
@@ -346,7 +348,7 @@ def measure(args):
server_tor_socks_port = util.get_random_free_port()
meas = Measurement(args.torpath, args.tgenpath, args.prefix, args.private_prefix, args.nickname, args.oneshot, args.additional_client_conf, args.torclient_conf_file, args.torserver_conf_file)
- meas.run(do_onion=args.do_onion, do_inet=args.do_inet,
+ meas.run(do_onion=not args.inet_only, do_inet=not args.onion_only,
client_tgen_listen_port=client_tgen_port, client_tgen_connect_ip=client_connect_ip, client_tgen_connect_port=client_connect_port, client_tor_ctl_port=client_tor_ctl_port, client_tor_socks_port=client_tor_socks_port,
server_tgen_listen_port=server_tgen_port, server_tor_ctl_port=server_tor_ctl_port, server_tor_socks_port=server_tor_socks_port)
else: