From 88f2c51595470bc83f1f10740b01a7eab4dc5e62 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Mon, 2 Sep 2019 14:19:45 +0300 Subject: [PATCH] quzwelsuziwqgpt2.onion:8444 is also a bootstrap server --- src/knownnodes.py | 13 +++---------- src/network/connectionpool.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/knownnodes.py b/src/knownnodes.py index 2735edbf..ba21bac7 100644 --- a/src/knownnodes.py +++ b/src/knownnodes.py @@ -34,10 +34,6 @@ DEFAULT_NODES = ( state.Peer('178.11.46.221', 8444) ) -DEFAULT_NODES_ONION = ( - state.Peer('quzwelsuziwqgpt2.onion', 8444), -) - def json_serialize_knownnodes(output): """ @@ -66,8 +62,7 @@ def json_deserialize_knownnodes(source): if ( not (knownNodesActual or info.get('self')) and - peer not in DEFAULT_NODES and - peer not in DEFAULT_NODES_ONION + peer not in DEFAULT_NODES ): knownNodesActual = True @@ -102,9 +97,9 @@ def addKnownNode(stream, peer, lastseen=None, is_self=False): } -def createDefaultKnownNodes(onion=False): +def createDefaultKnownNodes(): past = time.time() - 2418600 # 28 days - 10 min - for peer in DEFAULT_NODES_ONION if onion else DEFAULT_NODES: + for peer in DEFAULT_NODES: addKnownNode(1, peer, past) saveKnownNodes() @@ -122,8 +117,6 @@ def readKnownNodes(): logger.debug( 'Failed to read nodes from knownnodes.dat', exc_info=True) createDefaultKnownNodes() - if BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'SOCKS5': - createDefaultKnownNodes(onion=True) config = BMConfigParser() diff --git a/src/network/connectionpool.py b/src/network/connectionpool.py index 1554a585..4d16df49 100644 --- a/src/network/connectionpool.py +++ b/src/network/connectionpool.py @@ -165,10 +165,14 @@ class BMConnectionPool(object): proxy_type = BMConfigParser().safeGet( 'bitmessagesettings', 'socksproxytype') # A plugins may be added here + hostname = None if not proxy_type or proxy_type == 'none': connection_base = TCPConnection elif proxy_type == 'SOCKS5': connection_base = Socks5BMConnection + hostname = helper_random.randomchoice([ + 'quzwelsuziwqgpt2.onion', None + ]) elif proxy_type == 'SOCKS4a': connection_base = Socks4aBMConnection # FIXME: I cannot test else: @@ -177,8 +181,11 @@ class BMConnectionPool(object): return bootstrapper = bootstrap(connection_base) - port = helper_random.randomchoice([8080, 8444]) - hostname = 'bootstrap%s.bitmessage.org' % port + if not hostname: + port = helper_random.randomchoice([8080, 8444]) + hostname = 'bootstrap%s.bitmessage.org' % port + else: + port = 8444 self.addConnection(bootstrapper(hostname, port)) def loop(self): # pylint: disable=too-many-branches,too-many-statements