Do not start TLS in onion connections

This commit is contained in:
Lee Miller 2023-04-13 17:36:15 +03:00
parent a54a3fe409
commit acdcfae5c3
Signed by: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

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