Beispiel #1
0
 def test_str_transport(self):
     details = TransportDetails(
         peer="example.com",
         is_secure=False,
         secure_channel_id={},
     )
     # we can str() this and it doesn't fail
     str(details)
Beispiel #2
0
 def _create_transport_details(self):
     """
     Internal helper.
     Base class calls this to create a TransportDetails
     """
     is_secure = self.transport.get_extra_info('peercert', None) is not None
     if is_secure:
         secure_channel_id = {
             'tls-unique': transport_channel_id(self.transport, False, 'tls-unique'),
         }
     else:
         secure_channel_id = {}
     return TransportDetails(peer=self.peer, is_secure=is_secure, secure_channel_id=secure_channel_id)
Beispiel #3
0
 def _create_transport_details(self):
     """
     Internal helper.
     Base class calls this to create a TransportDetails
     """
     # note that ITLSTransport exists too, which is "a TCP
     # transport that *can be upgraded* to TLS" .. if it *is*
     # upgraded to TLS, then the transport will implement
     # ISSLTransport at that point according to Twisted
     # documentation
     # the peer we are connected to
     is_secure = ISSLTransport.providedBy(self.transport)
     if is_secure:
         secure_channel_id = {
             'tls-unique': transport_channel_id(self.transport, False, 'tls-unique'),
         }
     else:
         secure_channel_id = {}
     return TransportDetails(peer=self.peer, is_secure=is_secure, secure_channel_id=secure_channel_id)