/usr/lib/python3/dist-packages/twisted/protocols/__pycache__
Edit: /usr/lib/python3/dist-packages/twisted/protocols/__pycache__/tls.cpython-310.pyc (25237B)
o
b~
@ sJ d Z ddlmZmZmZmZmZmZ z eeed W n ey2 Z ze
e dkr* eddZ [ ww ddlm
Z
mZmZ ddlmZ ddlmZ dd lmZmZmZmZmZmZmZmZ dd
lmZ ddlm Z ddl!m"Z"m#Z# dd
l$m%Z% eeG dd dZ&eeeG dd de"Z'eeeG dd dZ(G dd de#Z)dS )a
Implementation of a TLS transport (L{ISSLTransport}) as an
L{IProtocol
} layered on top of any
L{ITransport} implementation, based on
U{OpenSSL}'s memory BIO features.
L{TLSMemoryBIOFactory} is a L{WrappingFactory} which wraps protocols created by
the factory it wraps with L{TLSMemoryBIOProtocol}. L{TLSMemoryBIOProtocol}
intercedes between the underlying transport and the wrapped protocol to
implement SSL and TLS. Typical usage of this module looks like this::
from twisted.protocols.tls import TLSMemoryBIOFactory
from twisted.internet.protocol import ServerFactory
from twisted.internet.ssl import PrivateCertificate
from twisted.internet import reactor
from someapplication import ApplicationProtocol
serverFactory = ServerFactory()
serverFactory.protocol = ApplicationProtocol
certificate = PrivateCertificate.loadPEM(certPEMData)
contextFactory = certificate.options()
tlsFactory = TLSMemoryBIOFactory(contextFactory, False, serverFactory)
reactor.listenTCP(12345, tlsFactory)
reactor.run()
This API offers somewhat more flexibility than
L{twisted.internet.interfaces.IReactorSSL}; for example, a
L{TLSMemoryBIOProtocol} instance can use another instance of
L{TLSMemoryBIOProtocol} as its transport, yielding TLS over TLS - useful to
implement onion routing. It can also be used to run TLS over unusual
transports, such as UNIX sockets and stdio.
)
ConnectionContextErrorTLSv1_METHOD
WantReadErrorZeroReturnErrorNz3argument must be an int, or have a fileno() method.z7twisted.protocols.tls requires pyOpenSSL 0.10 or newer.)directlyProvidesimplementer
providedBy)_PullToPush)_setAcceptableProtocols)IHandshakeListenerILoggingContextINegotiatedIOpenSSLClientConnectionCreatorIOpenSSLServerConnectionCreatorIProtocolNegotiationFactory
IPushProducer
ISystemHandle)CONNECTION_LOST)Protocol)ProtocolWrapperWrappingFactory)Failurec @ s4 e Zd ZdZdZdd Zdd Zdd Zd d
ZdS )_ProducerMembranea
Stand-in for producer registered with a L{TLSMemoryBIOProtocol} transport.
Ensures that producer pause/resume events from the undelying transport are
coordinated with pause/resume events from the TLS layer.
@ivar _producer: The application-layer producer.
Fc C s
|| _ d S N) _producer)selfproducer r 7/usr/lib/python3/dist-packages/twisted/protocols/tls.py__init__Y
z_ProducerMembrane.__init__c C s | j rdS d| _ | j dS )zP
C{pauseProducing} the underlying producer, if it's not paused.
NT)_producerPausedr pauseProducingr r r r r$ \ z _ProducerMembrane.pauseProducingc C s | j sdS d| _ | j dS )zM
C{resumeProducing} the underlying producer, if it's paused.
NF)r# r resumeProducingr% r r r r' e r&