('bittorrent.address', '', 'Address to listen/connect to ("" = auto)'), ('bittorrent.bytes.down', 0, 'Num of bytes to download (0 = auto)'), ('bittorrent.bytes.up', 0, 'Num of bytes to upload (0 = auto)'), ('bittorrent.daemonize', False, 'Become a daemon and run in background'), ('bittorrent.infohash', '', 'Set InfoHash ("" = auto)'), ('bittorrent.listen', False, 'Run in server mode'), ('bittorrent.negotiate', True, 'Enable negotiate client/server'), ('bittorrent.negotiate.port', 80, 'Negotiate port'), ('bittorrent.my_id', '', 'Set local PeerId ("" = auto)'), ('bittorrent.numpieces', NUMPIECES, 'Num of pieces in bitfield'), ('bittorrent.piece_len', PIECE_LEN, 'Length of each piece'), ('bittorrent.port', 6881, 'Port to listen/connect to (0 = auto)'), ('bittorrent.watchdog', WATCHDOG, 'Maximum test run-time in seconds'), ) CONFIG.register_defaults_helper(PROPERTIES) def register_descriptions(): ''' Registers the description of bittorrent variables ''' CONFIG.register_descriptions_helper(PROPERTIES) def _random_bytes(num): ''' Generates a random string of @num bytes ''' return ''.join([chr(random.randint(32, 126)) for _ in range(num)]) def finalize_conf(conf): ''' Finalize configuration and guess the proper value of all the undefined variables ''' if not conf['bittorrent.my_id']: