§
    Ètºf—I  ã                   ó¼  — d Z ddlZ	 ddlmZ n# e$ r Y nw xY wddlmZmZ ddl	m
Z
mZ ddlmZmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZ  G d„ d¦  «        Z eej        ¦  «         G d„ d¦  «        ¦   «         Z eej        ej        ¦  «         G d„ d¦  «        ¦   «         Zd„ Zd„ Z G d„ d¦  «        Z 	 	 	 dd„Z!eedddfd„Z"d„ Z# G d„ d¦  «        Z$dd„Z%dS )z0
Utilities and helpers for simulating a network
é    N)ÚError)ÚdirectlyProvidesÚimplementer)ÚerrorÚ
interfaces)ÚTCP4ClientEndpointÚTCP4ServerEndpoint)ÚConnectionRefusedError)ÚFactoryÚProtocol)ÚMemoryReactorClock)ÚFailurec                   ó&   — e Zd Zd„ Zdefd„Zd„ ZdS )ÚTLSNegotiationc                 ó>   — || _         || _        d| _        || _        d S )NF)ÚobjÚconnectStateÚsentÚreadyToSend)Úselfr   r   s      úQ/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/test/iosim.pyÚ__init__zTLSNegotiation.__init__   s&   € ØˆŒØ(ˆÔØˆŒ	Ø'ˆÔÐÐó    Úreturnc                 ó   — d| j         ›d�S )NzTLSNegotiation(ú))r   ©r   s    r   Ú__repr__zTLSNegotiation.__repr__!   s   € Ø. ¤Ð.Ð.Ð.Ð.r   c                 ó–   — | j                              |j         ¦  «        s)t          ¦   «         |_        |                     ¦   «          d S d S ©N)r   ÚiosimVerifyÚNativeOpenSSLErrorÚdisconnectReasonÚloseConnection)r   ÚotherÚtpts      r   ÚpretendToVerifyzTLSNegotiation.pretendToVerify$   sN   € ð Œx×#Ò# E¤IÑ.Ô.ð 	!Ý#5Ñ#7Ô#7ˆCÔ Ø×ÒÑ Ô Ð Ð Ð ð	!ð 	!r   N)Ú__name__Ú
__module__Ú__qualname__r   Ústrr   r'   © r   r   r   r      sM   € € € € € ð(ð (ð (ð/˜#ð /ð /ð /ð /ð!ð !ð !ð !ð !r   r   c                   ó   — e Zd ZdZdS )ÚFakeAddressz]
    The default address type for the host and peer of L{FakeTransport}
    connections.
    N)r(   r)   r*   Ú__doc__r,   r   r   r.   r.   -   s   € € € € € ðð ð ð r   r.   c                   ó   — e Zd ZdZ e ej        ¦   «         fd„¦  «        ZdZdZ	dZ
 ej        d¦  «        ZdZdZdZd!d„Zdefd„Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d"d„Z#d„ Z$d„ Z%d„ Z&d„ Z'd„ Z(d„ Z)d „ Z*dS )#ÚFakeTransportzØ
    A wrapper around a file-like object to make it behave as a Transport.

    This doesn't actually stream the file to the attached protocol,
    and is thus useful mainly as a utility for debugging protocols.
    c                 ó:   — t          t          | ¦  «        ¦  «        S r    )ÚintÚnext)Úcounters    r   ú<lambda>zFakeTransport.<lambda>>   s   € ÅÅTÈ'Á]Ä]ÑASÔAS€ r   r   zConnection doneNc                 ó¾   — || _         || _        g | _        |                      ¦   «         | _        |€t          ¦   «         }|| _        |€t          ¦   «         }|| _        dS )aÔ  
        @param protocol: This transport will deliver bytes to this protocol.
        @type protocol: L{IProtocol} provider

        @param isServer: C{True} if this is the accepting side of the
            connection, C{False} if it is the connecting side.
        @type isServer: L{bool}

        @param hostAddress: The value to return from C{getHost}.  L{None}
            results in a new L{FakeAddress} being created to use as the value.
        @type hostAddress: L{IAddress} provider or L{None}

        @param peerAddress: The value to return from C{getPeer}.  L{None}
            results in a new L{FakeAddress} being created to use as the value.
        @type peerAddress: L{IAddress} provider or L{None}
        N)ÚprotocolÚisServerÚstreamÚ_nextserialÚserialr.   ÚhostAddressÚpeerAddress)r   r8   r9   r=   r>   s        r   r   zFakeTransport.__init__G   s`   € ð" !ˆŒØ ˆŒØˆŒØ×&Ò&Ñ(Ô(ˆŒØÐÝ%™-œ-ˆKØ&ˆÔØÐÝ%™-œ-ˆKØ&ˆÔÐÐr   r   c                 ój   — d                      | j        rdpd| j        | j        j        j        ¦  «        S )NzFakeTransport<{},{},{}>ÚSÚC)Úformatr9   r<   r8   Ú	__class__r(   r   s    r   r   zFakeTransport.__repr__c   s9   € Ø(×/Ò/ØŒMÐ!˜cÐ( SØŒKØŒMÔ#Ô,ñ
ô 
ð 	
r   c                 ó’   — | j         rd S | j        �| j                             |¦  «         d S | j                             |¦  «         d S r    )ÚdisconnectingÚtlsÚtlsbufÚappendr:   )r   Údatas     r   ÚwritezFakeTransport.writej   sR   € àÔð 	ØˆFàŒ8ÐØŒK×Ò˜tÑ$Ô$Ð$Ð$Ð$àŒK×Ò˜tÑ$Ô$Ð$Ð$Ð$r   c                 ó\   — | j         r"| j        s| j                              ¦   «          d S d S d S r    ©ÚproducerÚstreamingProducerÚresumeProducingr   s    r   Ú_checkProducerzFakeTransport._checkProducert   sF   € ð Œ=ð 	, Ô!7ð 	,ØŒM×)Ò)Ñ+Ô+Ð+Ð+Ð+ð	,ð 	,ð 	,ð 	,r   c                 óR   — || _         || _        |s|                     ¦   «          dS dS )z.
        From abstract.FileDescriptor
        NrL   )r   rM   Ú	streamings      r   ÚregisterProducerzFakeTransport.registerProducerz   s=   € ð !ˆŒØ!*ˆÔØð 	'Ø×$Ò$Ñ&Ô&Ð&Ð&Ð&ð	'ð 	'r   c                 ó   — d | _         d S r    )rM   r   s    r   ÚunregisterProducerz FakeTransport.unregisterProducerƒ   s   € ØˆŒˆˆr   c                 óV   — |                       ¦   «          |                      ¦   «          d S r    )rU   r$   r   s    r   ÚstopConsumingzFakeTransport.stopConsuming†   s,   € Ø×ÒÑ!Ô!Ð!Ø×ÒÑÔÐÐÐr   c                 óV   — |                       d                     |¦  «        ¦  «         d S )Nr   )rJ   Újoin)r   Úiovecs     r   ÚwriteSequencezFakeTransport.writeSequenceŠ   s$   € Ø�
Š
�3—8’8˜E‘?”?Ñ#Ô#Ð#Ð#Ð#r   c                 ó   — d| _         d S ©NT©rE   r   s    r   r$   zFakeTransport.loseConnection�   s   € Ø!ˆÔÐÐr   c                 ó   — d| _         dS )zp
        For the time being, this is the same as loseConnection; no buffered
        data will be lost.
        TNr^   r   s    r   ÚabortConnectionzFakeTransport.abortConnection�   s   € ð
 "ˆÔÐÐr   c                 óŽ   — | j         �t          ¦   «         }n| j        }| j                             t          |¦  «        ¦  «         d S r    )rF   r"   r#   r8   ÚconnectionLostr   )r   Úerrs     r   ÚreportDisconnectzFakeTransport.reportDisconnect—   sC   € ØŒ8Ðõ %Ñ&Ô&ˆCˆCàÔ'ˆCØŒ×$Ò$¥W¨S¡\¤\Ñ2Ô2Ð2Ð2Ð2r   c                 ó   — dS )zM
        Identify this transport/event source to the logging system.
        Úiosimr,   r   s    r   Ú	logPrefixzFakeTransport.logPrefix    s	   € ð ˆwr   c                 ó   — | j         S r    )r>   r   s    r   ÚgetPeerzFakeTransport.getPeer¦   ó   € ØÔÐr   c                 ó   — | j         S r    )r=   r   s    r   ÚgetHostzFakeTransport.getHost©   rj   r   c                 ó   — d S r    r,   r   s    r   rO   zFakeTransport.resumeProducing¬   ó   € àˆr   c                 ó   — d S r    r,   r   s    r   ÚpauseProducingzFakeTransport.pauseProducing°   rn   r   c                 ó.   — |                       ¦   «          d S r    )r$   r   s    r   ÚstopProducingzFakeTransport.stopProducing´   s   € Ø×ÒÑÔÐÐÐr   Tc                 óR   — | j         |z  }t          ||¦  «        | _        g | _        d S r    )r9   r   rF   rG   )r   ÚcontextFactoryÚbeNormalr   s       r   ÚstartTLSzFakeTransport.startTLS·   s,   € ð ”} xÑ/ˆÝ! .°,Ñ?Ô?ˆŒØˆŒˆˆr   c                 ó    — | j         }|rg | _         d                     |¦  «        S | j        �!| j        j        rd| j        _        | j        S dS dS )zÁ
        Get the pending writes from this transport, clearing them from the
        pending buffer.

        @return: the bytes written with C{transport.write}
        @rtype: L{bytes}
        r   NT)r:   rY   rF   r   r   )r   r@   s     r   ÚgetOutBufferzFakeTransport.getOutBuffer¿   sY   € ð ŒKˆØð 	ØˆDŒKØ—8’8˜A‘;”;ÐØŒXÐ!ØŒxÔ#ð à $�””Ø”x�à�tà�4r   c                 ón  — t          |t          ¦  «        r…| j        €J ‚| j        j        rb| j                             || ¦  «         d | _        | j        d c}| _        |                      |¦  «         t          | t          j	        ¦  «         d S d| j        _
        d S | j                             |¦  «         d S r]   )Ú
isinstancer   rF   r   r'   rG   r[   r   r   ÚISSLTransportr   r8   ÚdataReceived)r   ÚbufÚbs      r   ÚbufferReceivedzFakeTransport.bufferReceivedÕ   s»   € Ý�c�>Ñ*Ô*ð 	,Ø”8Ð'Ð'Ð'ð ŒxŒ}ð 
,Ø”×(Ò(¨¨dÑ3Ô3Ð3Ø�”ð "&¤¨d���4”;Ø×"Ò" 1Ñ%Ô%Ð%Ý  ¥zÔ'?Ñ@Ô@Ð@Ð@Ð@ð (,�”Ô$Ð$Ð$àŒM×&Ò& sÑ+Ô+Ð+Ð+Ð+r   c                 ó   — d S r    r,   r   s    r   ÚgetTcpKeepAlivezFakeTransport.getTcpKeepAliveè   rn   r   c                 ó   — d S r    r,   r   s    r   ÚgetTcpNoDelayzFakeTransport.getTcpNoDelayì   rn   r   c                 ó   — d S r    r,   r   s    r   ÚloseWriteConnectionz!FakeTransport.loseWriteConnectionð   rn   r   c                 ó   — d S r    r,   ©r   Úenableds     r   ÚsetTcpKeepAlivezFakeTransport.setTcpKeepAliveô   rn   r   c                 ó   — d S r    r,   r‡   s     r   ÚsetTcpNoDelayzFakeTransport.setTcpNoDelayø   rn   r   )NN)T)+r(   r)   r*   r/   ÚstaticmethodÚ	itertoolsÚcountr;   ÚclosedrE   Údisconnectedr   ÚConnectionDoner#   rM   rN   rF   r   r+   r   rJ   rP   rS   rU   rW   r[   r$   r`   rd   rg   ri   rl   rO   rp   rr   rv   rx   r   r�   rƒ   r…   r‰   r‹   r,   r   r   r1   r1   5   s  € € € € € ðð ð �,¨o¨i¬oÑ.?Ô.?ÐSÐSÐSÑTÔT€KØ€FØ€MØ€LØ+�uÔ+Ð,=Ñ>Ô>ÐØ€HØÐØ
€Cð'ð 'ð 'ð 'ð8
˜#ð 
ð 
ð 
ð 
ð%ð %ð %ð,ð ,ð ,ð'ð 'ð 'ðð ð ðð ð ð$ð $ð $ð"ð "ð "ð"ð "ð "ð3ð 3ð 3ðð ð ð ð  ð  ð ð  ð  ðð ð ðð ð ðð ð ðð ð ð ðð ð ð,,ð ,ð ,ð&ð ð ðð ð ðð ð ðð ð ðð ð ð ð r   r1   c                 ó$   — t          | d¬¦  «        S )zø
    Create and return a new in-memory transport hooked up to the given protocol.

    @param clientProtocol: The client protocol to use.
    @type clientProtocol: L{IProtocol} provider

    @return: The transport.
    @rtype: L{FakeTransport}
    F©r9   ©r1   )ÚclientProtocols    r   ÚmakeFakeClientr–   ý   s   € õ ˜°%Ð8Ñ8Ô8Ð8r   c                 ó$   — t          | d¬¦  «        S )zø
    Create and return a new in-memory transport hooked up to the given protocol.

    @param serverProtocol: The server protocol to use.
    @type serverProtocol: L{IProtocol} provider

    @return: The transport.
    @rtype: L{FakeTransport}
    Tr“   r”   )ÚserverProtocols    r   ÚmakeFakeServerr™   
  s   € õ ˜°$Ð7Ñ7Ô7Ð7r   c                   ó*   — e Zd ZdZdd„Zd	d„Zd	d„ZdS )
ÚIOPumpz�
    Utility to pump data between clients and servers for protocol testing.

    Perhaps this is a utility worthy of being in protocol.py?
    Nc                 óz   — || _         || _        || _        || _        || _        |€t          ¦   «         }|| _        d S r    )ÚclientÚserverÚclientIOÚserverIOÚdebugr   Úclock)r   r�   rž   rŸ   r    r¡   r¢   s          r   r   zIOPump.__init__  s@   € ØˆŒØˆŒØ ˆŒØ ˆŒØˆŒ
Øˆ=Ý&Ñ(Ô(ˆEØˆŒ
ˆ
ˆ
r   FTc                 óv   — d}t          d¦  «        D ]}|                      ||¦  «        rd}Œ n
J d¦   «         ‚|S )zk
        Pump until there is no more input or output.

        Returns whether any data was moved.
        Fiè  Tr   zToo long)ÚrangeÚpump)r   r¡   ÚadvanceClockÚresultÚ_s        r   ÚflushzIOPump.flush(  sS   € ð ˆÝ�t‘”ð 	!ð 	!ˆAØ�yŠy˜ Ñ-Ô-ð Ø��à�à �jÑ Ô Ð Øˆr   c                 óò  — |r| j                              d¦  «         | j        s|rt          d¦  «         | j                             ¦   «         }| j                             ¦   «         }| j                             ¦   «          | j                             ¦   «          | j        s|rQt          d¦  «         |rt          dt          |¦  «        z   ¦  «         |rt          dt          |¦  «        z   ¦  «         |r| j         	                    |¦  «         |r| j         	                    |¦  «         |s|rdS | j        j
        rW| j        j        sK| j        s|rt          d¦  «         d| j        _        d| j        _
        | j                             ¦   «          dS | j        j
        rW| j        j        sK| j        s|rt          d¦  «         d| j        _        d| j        _
        | j                             ¦   «          dS d	S )
z·
        Move data back and forth, while also triggering any currently pending
        scheduled calls (i.e. C{callLater(0, f)}).

        Returns whether any data was moved.
        r   z
-- GLUG --ú.zC: zS: Tz* Cz* SF)r¢   Úadvancer¡   Úprintr    rx   rŸ   rP   Úreprr   rE   r�   rd   )r   r¡   r¦   ÚsDataÚcDatas        r   r¥   zIOPump.pump8  s  € ð ð 	"ØŒJ×Ò˜qÑ!Ô!Ð!ØŒ:ð 	 ˜ð 	 Ý�,ÑÔÐØ”×*Ò*Ñ,Ô,ˆØ”×*Ò*Ñ,Ô,ˆØŒ×$Ò$Ñ&Ô&Ð&ØŒ×$Ò$Ñ&Ô&Ð&ØŒ:ð 	+˜ð 	+Ý�#‰JŒJˆJàð +Ý�e�d 5™kœkÑ)Ñ*Ô*Ð*Øð +Ý�e�d 5™kœkÑ)Ñ*Ô*Ð*Øð 	0ØŒM×(Ò(¨Ñ/Ô/Ð/Øð 	0ØŒM×(Ò(¨Ñ/Ô/Ð/Øð 	�Eð 	Ø�4ØŒ=Ô&ð 	¨t¬}Ô/Ið 	ØŒzð ˜Uð Ý�e‘”�Ø)-ˆDŒMÔ&Ø*.ˆDŒMÔ'ØŒM×*Ò*Ñ,Ô,Ð,Ø�4ØŒ=Ô&ð 	¨t¬}Ô/Ið 	ØŒzð ˜Uð Ý�e‘”�Ø)-ˆDŒMÔ&Ø*.ˆDŒMÔ'ØŒM×*Ò*Ñ,Ô,Ð,Ø�4Øˆur   r    )FT)r(   r)   r*   r/   r   r©   r¥   r,   r   r   r›   r›     sZ   € € € € € ðð ðð ð ð ðð ð ð ð *ð *ð *ð *ð *ð *r   r›   FTc                 ó°   — |                       |¦  «         |                      |¦  «         t          || ||||¬¦  «        }|r|                     ¦   «          |S )aÓ  
    Create a new L{IOPump} connecting two protocols.

    @param serverProtocol: The protocol to use on the accepting side of the
        connection.
    @type serverProtocol: L{IProtocol} provider

    @param serverTransport: The transport to associate with C{serverProtocol}.
    @type serverTransport: L{FakeTransport}

    @param clientProtocol: The protocol to use on the initiating side of the
        connection.
    @type clientProtocol: L{IProtocol} provider

    @param clientTransport: The transport to associate with C{clientProtocol}.
    @type clientTransport: L{FakeTransport}

    @param debug: A flag indicating whether to log information about what the
        L{IOPump} is doing.
    @type debug: L{bool}

    @param greet: Should the L{IOPump} be L{flushed <IOPump.flush>} once before
        returning to put the protocols into their post-handshake or
        post-server-greeting state?
    @type greet: L{bool}

    @param clock: An optional L{Clock}. Pumping the resulting L{IOPump} will
        also increase clock time by a small increment.

    @return: An L{IOPump} which connects C{serverProtocol} and
        C{clientProtocol} and delivers bytes between them when it is pumped.
    @rtype: L{IOPump}
    ©r¢   )ÚmakeConnectionr›   r©   )r˜   ÚserverTransportr•   ÚclientTransportr¡   Úgreetr¢   r¥   s           r   Úconnectr·   e  so   € ðT ×!Ò! /Ñ2Ô2Ð2Ø×!Ò! /Ñ2Ô2Ð2ÝØØØØØØðñ ô €Dð ð à�
Š
‰ŒˆØ€Kr   c                 óˆ   —  |¦   «         } | ¦   «         } ||¦  «        }	 ||¦  «        }
||t          ||
||	|||¬¦  «        fS )a‰  
    Connect a given server and client class to each other.

    @param ServerClass: a callable that produces the server-side protocol.
    @type ServerClass: 0-argument callable returning L{IProtocol} provider.

    @param ClientClass: like C{ServerClass} but for the other side of the
        connection.
    @type ClientClass: 0-argument callable returning L{IProtocol} provider.

    @param clientTransportFactory: a callable that produces the transport which
        will be attached to the protocol returned from C{ClientClass}.
    @type clientTransportFactory: callable taking (L{IProtocol}) and returning
        L{FakeTransport}

    @param serverTransportFactory: a callable that produces the transport which
        will be attached to the protocol returned from C{ServerClass}.
    @type serverTransportFactory: callable taking (L{IProtocol}) and returning
        L{FakeTransport}

    @param debug: Should this dump an escaped version of all traffic on this
        connection to stdout for inspection?
    @type debug: L{bool}

    @param greet: Should the L{IOPump} be L{flushed <IOPump.flush>} once before
        returning to put the protocols into their post-handshake or
        post-server-greeting state?
    @type greet: L{bool}

    @param clock: An optional L{Clock}. Pumping the resulting L{IOPump} will
        also increase clock time by a small increment.

    @return: the client protocol, the server protocol, and an L{IOPump} which,
        when its C{pump} and C{flush} methods are called, will move data
        between the created client and server protocol instances.
    @rtype: 3-L{tuple} of L{IProtocol}, L{IProtocol}, L{IOPump}
    r²   )r·   )ÚServerClassÚClientClassÚclientTransportFactoryÚserverTransportFactoryr¡   r¶   r¢   ÚcÚsÚcioÚsios              r   ÚconnectedServerAndClientrÁ   Ÿ  s_   € ð\ 	ˆ‰Œ€AØˆ‰Œ€AØ
 Ð
  Ñ
#Ô
#€CØ
 Ð
  Ñ
#Ô
#€CØˆa•˜˜C  C¨°¸UÐCÑCÔCÐCÐCr   c                 ó8   — | \  }}}}}|\  }}}	}
||k    r||fS dS )a'  
    Should the client and server described by the arguments be connected to
    each other, i.e. do their port numbers match?

    @param clientInfo: the args for connectTCP
    @type clientInfo: L{tuple}

    @param serverInfo: the args for listenTCP
    @type serverInfo: L{tuple}

    @return: If they do match, return factories for the client and server that
        should connect; otherwise return L{None}, indicating they shouldn't be
        connected.
    @rtype: L{None} or 2-L{tuple} of (L{ClientFactory},
        L{IProtocolFactory})
    Nr,   )Ú
clientInfoÚ
serverInfoÚ
clientHostÚ
clientPortÚclientFactoryÚclientTimeoutÚclientBindAddressÚ
serverPortÚserverFactoryÚserverBacklogÚserverInterfaces              r   Ú_factoriesShouldConnectrÎ   Ô  sD   € ð. 	ñØØØØØàBLÑ?€Z� ¨Ø�ZÒÐØ˜mÐ+Ð+àˆtr   c                   óL   — e Zd ZdZd„ Zdd„Z e e¦   «         ¦  «        fd„ZdS )ÚConnectionCompleterz¬
    A L{ConnectionCompleter} can cause synthetic TCP connections established by
    L{MemoryReactor.connectTCP} and L{MemoryReactor.listenTCP} to succeed or
    fail.
    c                 ó   — || _         dS )z±
        Create a L{ConnectionCompleter} from a L{MemoryReactor}.

        @param memoryReactor: The reactor to attach to.
        @type memoryReactor: L{MemoryReactor}
        N)Ú_reactor)r   ÚmemoryReactors     r   r   zConnectionCompleter.__init__ú  s   € ð &ˆŒˆˆr   Fc           	      ó°  — | j         }t          |j        ¦  «        D ]¹\  }}|j        D ]¬}t	          ||¦  «        }|r˜|j                             |¦  «         |j                             |¦  «         |\  }}|                     d¦  «        }	|                     d¦  «        }
t          |
¦  «        }t          |	¦  «        }t          |
||	||¦  «        c c S Œ­ŒºdS )a“  
        Complete a single TCP connection established on this
        L{ConnectionCompleter}'s L{MemoryReactor}.

        @param debug: A flag; whether to dump output from the established
            connection to stdout.
        @type debug: L{bool}

        @return: a pump for the connection, or L{None} if no connection could
            be established.
        @rtype: L{IOPump} or L{None}
        N)rÒ   Ú	enumerateÚ
tcpClientsÚ
tcpServersrÎ   ÚremoveÚ
connectorsÚpopÚbuildProtocolr™   r–   r·   )r   r¡   rÓ   Ú	clientIdxrÃ   rÄ   Ú	factoriesrÇ   rË   r•   r˜   r´   rµ   s                r   ÚsucceedOncezConnectionCompleter.succeedOnce  s  € ð œˆÝ%.¨}Ô/GÑ%HÔ%Hð 	ð 	Ñ!ˆI�zØ+Ô6ð ð �
Ý3°JÀ
ÑKÔK�	Øð Ø!Ô,×3Ò3°JÑ?Ô?Ð?Ø!Ô,×0Ò0°Ñ;Ô;Ð;Ø3<Ñ0�M =Ø%2×%@Ò%@ÀÑ%FÔ%F�NØ%2×%@Ò%@ÀÑ%FÔ%F�NÝ&4°^Ñ&DÔ&D�OÝ&4°^Ñ&DÔ&D�OÝ"Ø&Ø'Ø&Ø'Øñô ð ð ð ð ð ððð	ð 	r   c                 ó²   — | j         j                             d¦  «        d                              | j         j                             d¦  «        |¦  «         dS )zà
        Fail a single TCP connection established on this
        L{ConnectionCompleter}'s L{MemoryReactor}.

        @param reason: the reason to provide that the connection failed.
        @type reason: L{Failure}
        r   é   N)rÒ   rÖ   rÚ   ÚclientConnectionFailedrÙ   )r   Úreasons     r   ÚfailOncezConnectionCompleter.failOnce$  sV   € ð 	ŒÔ ×$Ò$ QÑ'Ô'¨Ô*×AÒAØŒMÔ$×(Ò(¨Ñ+Ô+¨Vñ	
ô 	
ð 	
ð 	
ð 	
r   N©F)	r(   r)   r*   r/   r   rÞ   r   r
   rã   r,   r   r   rÐ   rÐ   ó  so   € € € € € ðð ð&ð &ð &ðð ð ð ðB &˜gÐ&<Ð&<Ñ&>Ô&>Ñ?Ô?ð 

ð 

ð 

ð 

ð 

ð 

r   rÐ   c                 óÚ   — t          ¦   «         }t          |dd¦  «        }t          |d¦  «        }|                     t	          j        t          ¦  «        ¦  «         |t          |¦  «        fS )a…  
    Create an endpoint that can be fired on demand.

    @param debug: A flag; whether to dump output from the established
        connection to stdout.
    @type debug: L{bool}

    @return: A client endpoint, and an object that will cause one of the
        L{Deferred}s returned by that client endpoint.
    @rtype: 2-L{tuple} of (L{IStreamClientEndpoint}, L{ConnectionCompleter})
    z0.0.0.0iá  )r   r   r	   Úlistenr   ÚforProtocolr   rÐ   )r¡   ÚreactorÚclientEndpointÚserverEndpoints       r   ÚconnectableEndpointrë   1  sb   € õ !Ñ"Ô"€GÝ'¨°¸DÑAÔA€NÝ'¨°Ñ6Ô6€NØ×Ò�'Ô-­hÑ7Ô7Ñ8Ô8Ð8ØÕ.¨wÑ7Ô7Ð7Ð7r   )FTNrä   )&r/   r�   ÚOpenSSL.SSLr   r"   ÚImportErrorÚzope.interfacer   r   Útwisted.internetr   r   Útwisted.internet.endpointsr   r	   Útwisted.internet.errorr
   Útwisted.internet.protocolr   r   Útwisted.internet.testingr   Útwisted.python.failurer   r   ÚIAddressr.   Ú
ITransportÚITLSTransportr1   r–   r™   r›   r·   rÁ   rÎ   rÐ   rë   r,   r   r   ú<module>rø      s˜  ðð
ð ð Ð Ð Ð ð	Ø7Ð7Ð7Ð7Ð7Ð7Ð7øØð 	ð 	ð 	Ø€Dð	øøøð 9Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8à .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ø MÐ MÐ MÐ MÐ MÐ MÐ MÐ MØ 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø *Ð *Ð *Ð *Ð *Ð *ð!ð !ð !ð !ð !ñ !ô !ð !ð& €ˆZÔ Ñ!Ô!ðð ð ð ð ñ ô ñ "Ô!ðð €ˆZÔ" JÔ$<Ñ=Ô=ðDð Dð Dð Dð Dñ Dô Dñ >Ô=ðDðN
9ð 
9ð 
9ð
8ð 
8ð 
8ðKð Kð Kð Kð Kñ Kô Kð Kðf Ø
Ø
ð7ð 7ð 7ð 7ðz *Ø)Ø
Ø
Ø
ð2Dð 2Dð 2Dð 2Dðjð ð ð>;
ð ;
ð ;
ð ;
ð ;
ñ ;
ô ;
ð ;
ð|8ð 8ð 8ð 8ð 8ð 8s   ˆ �–