From 52fe7105a93ac27758265693ef3fa1c71e3e0158 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Fri, 27 Nov 2015 12:13:10 +0100 Subject: [PATCH] Allow bootstrap from a Tor hidden service I run a modified node as a Tor hidden service for bootstrapping node addresses, and PyBitmessage can now connect to it. --- src/helper_bootstrap.py | 2 ++ src/shared.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/helper_bootstrap.py b/src/helper_bootstrap.py index d0de8622..fbb1a81b 100644 --- a/src/helper_bootstrap.py +++ b/src/helper_bootstrap.py @@ -52,6 +52,8 @@ def dns(): except: logger.error('bootstrap8444.bitmessage.org DNS bootstrapping failed.') elif shared.config.get('bitmessagesettings', 'socksproxytype') == 'SOCKS5': + shared.knownNodes[1][shared.Peer('quzwelsuziwqgpt2.onion', 8444)] = int(time.time()) + logger.debug("Adding quzwelsuziwqgpt2.onion:8444 to knownNodes.") for port in [8080, 8444]: logger.debug("Resolving %i through SOCKS...", port) address_family = socket.AF_INET diff --git a/src/shared.py b/src/shared.py index c49d9457..e6774f45 100644 --- a/src/shared.py +++ b/src/shared.py @@ -143,7 +143,9 @@ def isInSqlInventory(hash): return queryreturn != [] def encodeHost(host): - if host.find(':') == -1: + if host.find('.onion') > -1: + return '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x7F\x00\x00\x01' + elif host.find(':') == -1: return '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + \ socket.inet_aton(host) else: