quzwelsuziwqgpt2.onion:8444 is also a bootstrap server

This commit is contained in:
Dmitri Bogomolov 2019-09-02 14:19:45 +03:00
parent a7cfe5ba32
commit 88f2c51595
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 12 additions and 12 deletions

View File

@ -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()

View File

@ -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