]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Add TLS for asyncio.
authorBob Halley <halley@dnspython.org>
Fri, 12 Jun 2020 15:01:17 +0000 (08:01 -0700)
committerBob Halley <halley@dnspython.org>
Fri, 12 Jun 2020 15:01:17 +0000 (08:01 -0700)
dns/_asyncio_backend.py

index 07e9e5e252121217791e00313ee2116b575296ba..5f14c4a38092e3dba570e8ef6f8db122509ac836 100644 (file)
@@ -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}')