WIP: Add support for tor using PySocks and optionally stem #2
|
@ -79,9 +79,11 @@ class ConnectionBase(threading.Thread):
|
||||||
self.s.settimeout(0)
|
self.s.settimeout(0)
|
||||||
if not self.server:
|
if not self.server:
|
||||||
if self.network == 'ip':
|
if self.network == 'ip':
|
||||||
|
version_kwargs = (
|
||||||
|
{'services': 1} if self.host.endswith('.onion') else {})
|
||||||
self.send_queue.put(message.Version(
|
self.send_queue.put(message.Version(
|
||||||
('127.0.0.1' if shared.socks_proxy else self.host),
|
('127.0.0.1' if shared.socks_proxy else self.host),
|
||||||
self.port))
|
self.port, **version_kwargs))
|
||||||
else:
|
else:
|
||||||
self.send_queue.put(message.Version('127.0.0.1', 7656))
|
self.send_queue.put(message.Version('127.0.0.1', 7656))
|
||||||
while True:
|
while True:
|
||||||
|
@ -260,8 +262,11 @@ class ConnectionBase(threading.Thread):
|
||||||
'Established Bitmessage protocol connection to %s:%s',
|
'Established Bitmessage protocol connection to %s:%s',
|
||||||
self.host_print, self.port)
|
self.host_print, self.port)
|
||||||
self.on_connection_fully_established_scheduled = False
|
self.on_connection_fully_established_scheduled = False
|
||||||
if self.remote_version.services & 2 and self.network == 'ip':
|
if ( # NODE_SSL
|
||||||
self._do_tls_handshake() # NODE_SSL
|
self.remote_version.services & 2 and self.network == 'ip'
|
||||||
|
and not self.host.endswith('.onion')
|
||||||
|
):
|
||||||
|
self._do_tls_handshake()
|
||||||
|
|
||||||
addr = {
|
addr = {
|
||||||
structure.NetAddr(c.remote_version.services, c.host, c.port)
|
structure.NetAddr(c.remote_version.services, c.host, c.port)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user