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) state.Peer('178.11.46.221', 8444)
) )
DEFAULT_NODES_ONION = (
state.Peer('quzwelsuziwqgpt2.onion', 8444),
)
def json_serialize_knownnodes(output): def json_serialize_knownnodes(output):
""" """
@ -66,8 +62,7 @@ def json_deserialize_knownnodes(source):
if ( if (
not (knownNodesActual or info.get('self')) and not (knownNodesActual or info.get('self')) and
peer not in DEFAULT_NODES and peer not in DEFAULT_NODES
peer not in DEFAULT_NODES_ONION
): ):
knownNodesActual = True 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 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) addKnownNode(1, peer, past)
saveKnownNodes() saveKnownNodes()
@ -122,8 +117,6 @@ def readKnownNodes():
logger.debug( logger.debug(
'Failed to read nodes from knownnodes.dat', exc_info=True) 'Failed to read nodes from knownnodes.dat', exc_info=True)
createDefaultKnownNodes() createDefaultKnownNodes()
if BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'SOCKS5':
createDefaultKnownNodes(onion=True)
config = BMConfigParser() config = BMConfigParser()

View File

@ -165,10 +165,14 @@ class BMConnectionPool(object):
proxy_type = BMConfigParser().safeGet( proxy_type = BMConfigParser().safeGet(
'bitmessagesettings', 'socksproxytype') 'bitmessagesettings', 'socksproxytype')
# A plugins may be added here # A plugins may be added here
hostname = None
if not proxy_type or proxy_type == 'none': if not proxy_type or proxy_type == 'none':
connection_base = TCPConnection connection_base = TCPConnection
elif proxy_type == 'SOCKS5': elif proxy_type == 'SOCKS5':
connection_base = Socks5BMConnection connection_base = Socks5BMConnection
hostname = helper_random.randomchoice([
'quzwelsuziwqgpt2.onion', None
])
elif proxy_type == 'SOCKS4a': elif proxy_type == 'SOCKS4a':
connection_base = Socks4aBMConnection # FIXME: I cannot test connection_base = Socks4aBMConnection # FIXME: I cannot test
else: else:
@ -177,8 +181,11 @@ class BMConnectionPool(object):
return return
bootstrapper = bootstrap(connection_base) bootstrapper = bootstrap(connection_base)
port = helper_random.randomchoice([8080, 8444]) if not hostname:
hostname = 'bootstrap%s.bitmessage.org' % port port = helper_random.randomchoice([8080, 8444])
hostname = 'bootstrap%s.bitmessage.org' % port
else:
port = 8444
self.addConnection(bootstrapper(hostname, port)) self.addConnection(bootstrapper(hostname, port))
def loop(self): # pylint: disable=too-many-branches,too-many-statements def loop(self): # pylint: disable=too-many-branches,too-many-statements