Do not start TLS in onion connections

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

View File

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