99from bwscanner .logger import setup_logging , log
1010from bwscanner .measurement import BwScan
1111from bwscanner .aggregate import write_aggregate_data
12+ from bwscanner .config import TOR_OPTIONS , DEFAULT , BW_FILES
1213from bwscanner import __version__
1314
1415
@@ -58,7 +59,7 @@ def cli(ctx, data_dir, loglevel, logfile, launch_tor, circuit_build_timeout):
5859
5960 # Create a connection to a Tor instance
6061 ctx .obj .tor_state = connect_to_tor (launch_tor , circuit_build_timeout ,
61- ctx .obj .tor_dir )
62+ TOR_OPTIONS , ctx .obj .tor_dir )
6263
6364 # Set up the logger to only output log lines of level `loglevel` and above.
6465 setup_logging (log_level = loglevel , log_name = logfile )
@@ -74,13 +75,15 @@ def cli(ctx, data_dir, loglevel, logfile, launch_tor, circuit_build_timeout):
7475@click .option ('--request-limit' , default = 10 ,
7576 help = 'Limit the number of simultaneous bandwidth measurements '
7677 '(default: %d).' % 10 )
78+ @click .option ('--baseurl' , default = DEFAULT .get ('baseurl' ),
79+ help = 'File server URL' )
7780@pass_scan
78- def scan (scan , partitions , current_partition , timeout , request_limit ):
81+ def scan (scan , partitions , current_partition , timeout , request_limit , baseurl ):
7982 """
8083 Start a scan through each Tor relay to measure it's bandwidth.
8184 """
8285 log .info ("Using {data_dir} as the data directory." , data_dir = scan .data_dir )
83-
86+ assert isinstance ( BW_FILES , dict )
8487 # XXX: check that each run is producing the same input set!
8588 scan_time = str (int (time .time ()))
8689 scan_data_dir = os .path .join (scan .measurement_dir , '{}.running' .format (scan_time ))
@@ -92,6 +95,8 @@ def rename_finished_scan(deferred):
9295 os .rename (scan_data_dir , os .path .join (scan .measurement_dir , scan_time ))
9396
9497 scan .tor_state .addCallback (BwScan , reactor , scan_data_dir ,
98+ baseurl = baseurl ,
99+ bw_files = BW_FILES ,
95100 request_timeout = timeout ,
96101 request_limit = request_limit ,
97102 partitions = partitions ,
0 commit comments