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:
parent
27c187283b
commit
52fe7105a9
|
@ -52,6 +52,8 @@ def dns():
|
||||||
except:
|
except:
|
||||||
logger.error('bootstrap8444.bitmessage.org DNS bootstrapping failed.')
|
logger.error('bootstrap8444.bitmessage.org DNS bootstrapping failed.')
|
||||||
elif shared.config.get('bitmessagesettings', 'socksproxytype') == 'SOCKS5':
|
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]:
|
for port in [8080, 8444]:
|
||||||
logger.debug("Resolving %i through SOCKS...", port)
|
logger.debug("Resolving %i through SOCKS...", port)
|
||||||
address_family = socket.AF_INET
|
address_family = socket.AF_INET
|
||||||
|
|
|
@ -143,7 +143,9 @@ def isInSqlInventory(hash):
|
||||||
return queryreturn != []
|
return queryreturn != []
|
||||||
|
|
||||||
def encodeHost(host):
|
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' + \
|
return '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + \
|
||||||
socket.inet_aton(host)
|
socket.inet_aton(host)
|
||||||
else:
|
else:
|
||||||
|
|
Reference in New Issue
Block a user