X-Git-Url: https://git.mxchange.org/?p=quix0rs-apt-p2p.git;a=blobdiff_plain;f=apt_dht%2Fapt_dht_conf.py;h=4f77d6f61188ad0550cce674c182b18b9d9cff2a;hp=038819e0b4b422797aa803b4aa03fcb5f9aca52f;hb=61a8482b596a221a97e0f3cdcc7452468bee85f1;hpb=925b712a25f84ef20887cd575c86fb9ab2cfa3e5 diff --git a/apt_dht/apt_dht_conf.py b/apt_dht/apt_dht_conf.py index 038819e..4f77d6f 100644 --- a/apt_dht/apt_dht_conf.py +++ b/apt_dht/apt_dht_conf.py @@ -20,26 +20,38 @@ if home == '${HOME}' or not os.path.isdir(home): DEFAULTS = { # Port to listen on for all requests (TCP and UDP) - 'port': '9977', + 'PORT': '9977', # Directory to store the downloaded files in - 'cache_dir': home + '/.apt-dht/cache', + 'CACHE_DIR': home + '/.apt-dht/cache', + + # Other directories containing packages to share with others + # WARNING: all files in these directories will be hashed and available + # for everybody to download + 'OTHER_DIRS': """""", # User name to try and run as - 'username': '', + 'USERNAME': '', + + # Whether it's OK to use an IP addres from a known local/private range + 'LOCAL_OK': 'no', # Which DHT implementation to use. - # It must be possile to do "from import DHT" to get a class that + # It must be possile to do "from .DHT import DHT" to get a class that # implements the IDHT interface. - 'DHT': 'apt_dht_Khashmir.DHT', + 'DHT': 'apt_dht_Khashmir', - # Whether to only run the DHT (for providing a login node) - 'DHT-only': 'no', + # Whether to only run the DHT (for providing only a bootstrap node) + 'DHT-ONLY': 'no', } DHT_DEFAULTS = { - # magic id to use before we know a peer's id - 'NULL_ID': 20 * '\0', + # bootstrap nodes to contact to join the DHT + 'BOOTSTRAP': """www.camrdale.org:9977 + steveholt.hopto.org:9976""", + + # whether this node is a bootstrap node + 'BOOTSTRAP_NODE': "no", # Kademlia "K" constant, this should be an even number 'K': '8', @@ -76,6 +88,9 @@ DHT_DEFAULTS = { # expire entries older than this 'KE_AGE': '1h', # 60 minutes + + # whether to spew info about the requests/responses in the protocol + 'SPEW': 'yes', } class AptDHTConfigParser(SafeConfigParser): @@ -103,6 +118,8 @@ class AptDHTConfigParser(SafeConfigParser): return self.get(section,option) def getstringlist(self, section, option): return self.get(section,option).split() + def optionxform(self, option): + return option.upper() config = AptDHTConfigParser(DEFAULTS) config.add_section(config.get('DEFAULT', 'DHT'))