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.
This commit is contained in:
mailchuck 2015-11-27 12:13:10 +01:00 committed by Peter Surda
parent 27c187283b
commit 52fe7105a9
2 changed files with 5 additions and 1 deletions

View File

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

View File

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