📄 defaultargs.py
字号:
# The contents of this file are subject to the BitTorrent Open Source License# Version 1.1 (the License). You may not copy or use this file, in either# source code or executable form, except in compliance with the License. You# may obtain a copy of the License at http://www.bittorrent.com/license/.## Software distributed under the License is distributed on an AS IS basis,# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License# for the specific language governing rights and limitations under the# License.# Needs redesign. Too many modifications to add a ui. Adding a UI# can easily break existing UIs unintentionally. --Daveimport osfrom BitTorrent.translation import _### add your favorite hereBAD_LIBC_WORKAROUND_DEFAULT = Falseif os.name == 'posix': if os.uname()[0] in ['Darwin']: BAD_LIBC_WORKAROUND_DEFAULT = TrueMAX_INCOMPLETE = 100MAX_FILES_OPEN = 50if os.name == 'nt': import ctypes from BitTorrent.platform import win_version_num # starting in XP SP2 the incomplete outgoing connection limit was set to 10 if win_version_num >= (2, 5, 1, 2, 0): MAX_INCOMPLETE = 10 # try to set it as high as possible # technically 2048 is max, but I see 512 sometimes, and I think win98 # defaults to 50. If we're not the last person to call it, I think we get # errors, so screw it for now. #ctypes.cdll.msvcrt._setmaxstdio(512) # -3 for stdin, stdout, and stderr # -15 for a buffer MAX_FILES_OPEN = ctypes.cdll.msvcrt._getmaxstdio() - 3 - 15from BitTorrent import languages, app_namebasic_options = [ ('data_dir', u'', _("directory under which variable data such as fastresume information " "and GUI state is saved. Defaults to subdirectory 'data' of the " "bittorrent config directory.")), ('language', '', _("ISO Language code to use") + ': ' + ', '.join(languages)), ('use_factory_defaults', False, _("Starts the application in a debug mode. All settings revert to " "default except those provided as command-line options. Creates " "temporary directories for dot, data, incomplete torrents and " "complete torrents. Allows multiple clients on the same machine to " "communicate with each other." )), ]common_options = [ ('ip', '', _("ip to report to the tracker (has no effect unless you are on the same " "local network as the tracker)")), ('forwarded_port', 0, _("world-visible port number if it's different from the one the client " "listens on locally")), ('minport', 6881, _("minimum port to listen on, counts up if unavailable")), ('maxport', 6999, _("maximum port to listen on")), ('bind', '', _("ip to bind to locally")), ('display_interval', 1.0, _("seconds between updates of displayed information")), ('rerequest_interval', 5 * 60, _("minutes to wait between requesting more peers")), ('min_peers', 20, _("minimum number of peers to not do rerequesting")), ('max_initiate', 60, _("number of peers at which to stop initiating new connections")), ('max_incomplete', MAX_INCOMPLETE, _("max number of outgoing incomplete connections")), ('max_allow_in', 80, _("maximum number of connections to allow, after this new incoming " "connections will be immediately closed")), ('check_hashes', True, _("whether to check hashes on disk")), ('max_upload_rate', 125000000, # 1 GBit local net = 125MB/s _("maximum B/s to upload at")), ('max_download_rate', 125000000, # 1 GBit local net = 125MB/s _("average maximum B/s to download at")), ('bandwidth_management', os.name == 'nt', _("automatic bandwidth management (Windows only)")), ('min_uploads', 2, _("the number of uploads to fill out to with extra optimistic unchokes")), ('max_files_open', MAX_FILES_OPEN, _("the maximum number of files in a multifile torrent to keep open at a " "time, 0 means no limit. Used to avoid running out of file descriptors.")), ('start_trackerless_client', True, _("Initialize a trackerless client. This must be enabled in order to download trackerless torrents.")), ('upnp', True, _("Enable automatic port mapping")+' (UPnP)'), ('xmlrpc_port', -1, _("Start the XMLRPC interface on the specified port. This " "XML-RPC-based RPC allows a remote program to control the client " "to enable automated hosting, conformance testing, and benchmarking.")), ]rare_options = [ ('keepalive_interval', 120.0, _("number of seconds to pause between sending keepalives")), ('download_slice_size', 2 ** 14, _("how many bytes to query for per request.")), ('max_message_length', 2 ** 23, _("maximum length prefix encoding you'll accept over the wire - larger " "values get the connection dropped.")), ('socket_timeout', 300.0, _("seconds to wait between closing sockets which nothing has been " "received on")), ('timeout_check_interval', 60.0, _("seconds to wait between checking if any connections have timed out")), ('max_slice_length', 32768, _("maximum length slice to send to peers, close connection if a larger " "request is received")), ('max_rate_period', 20.0, _("maximum time interval over which to estimate the current upload and download rates")), ('max_announce_retry_interval', 1800, _("maximum time to wait between retrying announces if they keep failing")), ('snub_time', 30.0, _("seconds to wait for data to come in over a connection before assuming " "it's semi-permanently choked")), ('rarest_first_cutoff', 4, _("number of downloads at which to switch from random to rarest first")), ('upload_unit_size', 1380, _("how many bytes to write into network buffers at once.")), ('retaliate_to_garbled_data', True, _("refuse further connections from addresses with broken or intentionally " "hostile peers that send incorrect data")), ('one_connection_per_ip', True, _("do not connect to several peers that have the same IP address")), ('one_download_per_torrent', True, _("do not allow simultaneous downloads of the same torrent.")), ('peer_socket_tos', 8, _("if nonzero, set the TOS option for peer connections to this value")), ('bad_libc_workaround', BAD_LIBC_WORKAROUND_DEFAULT, _("enable workaround for a bug in BSD libc that makes file reads very slow.")), ('tracker_proxy', '', _("address of HTTP proxy to use for tracker connections")), ('close_with_rst', 0, _("close connections with RST and avoid the TCP TIME_WAIT state")), ('num_disk_threads', 10, _("number of read threads to use in the storage object")), ('num_piece_checks', 2, _("number of simultaneous piece checks to run per torrent, set to a low number like 2 or 3")), ('twisted', -1, _("Use Twisted network libraries for network connections. 1 means use twisted, 0 means do not use twisted, -1 means autodetect, and prefer twisted")), ('num_fast', 10, _("Number of pieces allowed fast.")), # Future. #('stream_priority', 2, # _("Priority for pieces that are needed soon.")), ]tracker_options = [ ('port', 80, _("Port to listen on.")), ('dfile', u'', _("file to store recent downloader info in")), ('bind', '', _("ip to bind to locally")), ('socket_timeout', 15, _("timeout for closing connections")), ('close_with_rst', 0, _("close connections with RST and avoid the TCP TIME_WAIT state")), ('save_dfile_interval', 5 * 60, _("seconds between saving dfile")), ('timeout_downloaders_interval', 45 * 60, _("seconds between expiring downloaders")), ('reannounce_interval', 30 * 60, _("seconds downloaders should wait between reannouncements")), ('response_size', 50, _("default number of peers to send an info message to if the " "client does not specify a number")), ('timeout_check_interval', 5, _("time to wait between checking if any connections have timed out")), ('nat_check', 3, _("how many times to check if a downloader is behind a NAT " "(0 = don't check)")), ('log_nat_checks', 0, _("whether to add entries to the log for nat-check results")), ('min_time_between_log_flushes', 3.0, _("minimum time it must have been since the last flush to do " "another one")), ('min_time_between_cache_refreshes', 600.0, _("minimum time in seconds before a cache is considered stale " "and is flushed")), ('allowed_dir', u'', _("only allow downloads for .torrents in this dir (and recursively in " "subdirectories of directories that have no .torrent files " "themselves). If set, torrents in this directory show up on " "infopage/scrape whether they have peers or not")), ('parse_dir_interval', 60, _("how often to rescan the torrent directory, in seconds")), ('allowed_controls', 0, _("allow special keys in torrents in the allowed_dir to affect " "tracker access")), ('hupmonitor', 0, _("whether to reopen the log file upon receipt of HUP signal")), ('show_infopage', 1, _("whether to display an info page when the tracker's root dir " "is loaded")), ('infopage_redirect', '', _("a URL to redirect the info page to")), ('show_names', 1, _("whether to display names from allowed dir")), ('favicon', '', _("file containing x-icon data to return when browser requests " "favicon.ico")), ('only_local_override_ip', 2, _("ignore the ip GET parameter from machines which aren't on " "local network IPs (0 = never, 1 = always, 2 = ignore if NAT " "checking is not enabled). HTTP proxy headers giving address " "of original client are treated the same as --ip.")), ('logfile', '', _("file to write the tracker logs, use - for stdout (default)")), ('allow_get', 0, _("use with allowed_dir; adds a /file?hash={hash} url that " "allows users to download the torrent file")), ('keep_dead', 0, _("keep dead torrents after they expire (so they still show up on your "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -