![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/twisted/protocols/__pycache__/ |
o �b�~ � @ sJ d Z ddlmZmZmZmZmZmZ z eee�d� W n ey2 Z ze e �dkr*� ed��dZ [ ww ddlm Z mZmZ ddlmZ ddlmZ dd lmZmZmZmZmZmZmZmZ dd lmZ ddlm Z ddl!m"Z"m#Z# dd l$m%Z% ee�G dd� d��Z&eee�G dd� de"��Z'eee�G dd� d��Z(G dd� de#�Z)dS )a� Implementation of a TLS transport (L{ISSLTransport}) as an L{IProtocol<twisted.internet.interfaces.IProtocol>} layered on top of any L{ITransport<twisted.internet.interfaces.ITransport>} implementation, based on U{OpenSSL<http://www.openssl.org>}'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. � )� Connection�Context�Error�TLSv1_METHOD� WantReadError�ZeroReturnErrorNz3argument must be an int, or have a fileno() method.z7twisted.protocols.tls requires pyOpenSSL 0.10 or newer.)�directlyProvides�implementer� providedBy)�_PullToPush)�_setAcceptableProtocols)�IHandshakeListener�ILoggingContext�INegotiated�IOpenSSLClientConnectionCreator�IOpenSSLServerConnectionCreator�IProtocolNegotiationFactory� IPushProducer� ISystemHandle)�CONNECTION_LOST)�Protocol)�ProtocolWrapper�WrappingFactory)�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)�self�producer� 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 �pauseProducing�r 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'