Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/protocols/__pycache__/tls.cpython-39.pyc
Ðазад
a k�h�~ � @ sV d Z ddlmZmZmZmZmZmZ zeee�d� W n: eyp Z z"e e �dkrT� ed��W Y dZ [ n dZ [ 0 0 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 ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/protocols/tls.py�__init__Y s z_ProducerMembrane.__init__c C s | j r dS d| _ | j�� dS )zP C{pauseProducing} the underlying producer, if it's not paused. NT)�_producerPausedr �pauseProducing�r r r r r# \ s z _ProducerMembrane.pauseProducingc C s | j s dS d| _ | j�� dS )zM C{resumeProducing} the underlying producer, if it's paused. NF)r"