From cae7c792bda2903fb3c28166182fb4b81e7ae400 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 12 Jun 2020 08:01:17 -0700 Subject: [PATCH] Add TLS for asyncio. --- dns/_asyncio_backend.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dns/_asyncio_backend.py b/dns/_asyncio_backend.py index 07e9e5e2..5f14c4a3 100644 --- a/dns/_asyncio_backend.py +++ b/dns/_asyncio_backend.py @@ -99,7 +99,7 @@ class StreamSocket(dns._asyncbackend.DatagramSocket): pass async def getpeername(self): - return self.reader.get_extra_info('peername') + return self.writer.get_extra_info('peername') class Backend(dns._asyncbackend.Backend): @@ -119,9 +119,11 @@ class Backend(dns._asyncbackend.Backend): (r, w) = await _maybe_wait_for( asyncio.open_connection(destination[0], destination[1], + ssl=ssl_context, family=af, proto=proto, - local_addr=source), + local_addr=source, + server_hostname=server_hostname), timeout) return StreamSocket(af, r, w) raise NotImplementedError(f'unsupported socket type {socktype}') -- 2.47.3