From 36eb04003d680c60c8c12a7411f4d5d5f0958cee Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Thu, 13 Apr 2023 17:36:15 +0300 Subject: [PATCH] Do not start TLS in onion connections --- minode/connection.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/minode/connection.py b/minode/connection.py index dccfddc..cd10e0c 100644 --- a/minode/connection.py +++ b/minode/connection.py @@ -79,9 +79,11 @@ class ConnectionBase(threading.Thread): self.s.settimeout(0) if not self.server: if self.network == 'ip': + version_kwargs = ( + {'services': 1} if self.host.endswith('.onion') else {}) self.send_queue.put(message.Version( ('127.0.0.1' if shared.socks_proxy else self.host), - self.port)) + self.port, **version_kwargs)) else: self.send_queue.put(message.Version('127.0.0.1', 7656)) while True: @@ -260,8 +262,11 @@ class ConnectionBase(threading.Thread): 'Established Bitmessage protocol connection to %s:%s', self.host_print, self.port) self.on_connection_fully_established_scheduled = False - if self.remote_version.services & 2 and self.network == 'ip': - self._do_tls_handshake() # NODE_SSL + if ( # NODE_SSL + self.remote_version.services & 2 and self.network == 'ip' + and not self.host.endswith('.onion') + ): + self._do_tls_handshake() addr = { structure.NetAddr(c.remote_version.services, c.host, c.port)