⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 const.py

📁 bittorrent source by python. please enjoy
💻 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.# magic id to use before we know a peer's idNULL_ID =  20 * '\0'# Kademlia "K" constant, this should be an even numberK = 8# SHA1 is 160 bits longHASH_LENGTH = 160# checkpoint every this many secondsCHECKPOINT_INTERVAL = 60 * 5 # five minutes# how often to find our own nodesFIND_CLOSE_INTERVAL = 60 * 15 # fifteen minutes### SEARCHING/STORING# concurrent krpc calls per find node/value request!CONCURRENT_REQS = K# how many hosts to post toSTORE_REDUNDANCY = 3###  ROUTING TABLE STUFF# how many times in a row a node can fail to respond before it's booted from the routing tableMAX_FAILURES = 3# never ping a node more often than thisMIN_PING_INTERVAL = 60 * 15 # fifteen minutes# refresh buckets that haven't been touched in this longBUCKET_STALENESS = 60 * 15 # fifteen minutes###  KEY EXPIRER# time before expirer starts runningKEINITIAL_DELAY = 15 # 15 seconds - to clean out old stuff in persistent db# time between expirer runsKE_DELAY = 60 * 5 # 5 minutes# expire entries older than thisKE_AGE = 60 * 30 # 30 minutes## krpc errback codesKRPC_TIMEOUT = 20KRPC_ERROR = 1KRPC_ERROR_METHOD_UNKNOWN = 2KRPC_ERROR_RECEIVED_UNKNOWN = 3KRPC_ERROR_TIMEOUT = 4KRPC_SOCKET_ERROR = 5KRPC_CONNECTION_CACHE_TIME = KRPC_TIMEOUT * 2## krpc erorr response codesKERR_ERROR = (201, "Generic Error")KERR_SERVER_ERROR = (202, "Server Error")KERR_PROTOCOL_ERROR = (203, "Protocol Error")KERR_METHOD_UNKNOWN = (204, "Method Unknown")KERR_INVALID_ARGS = (205, "Invalid Argements")KERR_INVALID_TOKEN = (206, "Invalid Token")

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -