
    tf                         d Z ddlmZ  ed          ZerddlmZ ddlmZ ddlm	Z	 ddl
mZmZ ddlmZ  G d	 d
ej                  ZdS )z,
Tests for L{twisted.conch.ssh.forwarding}.
    )requireModulecryptography)
forwarding)IPv6Address)deterministicResolvingReactor)MemoryReactorClockStringTransport)unittestc                   2    e Zd ZdZesdZdeddfdZddZdS )	TestSSHConnectForwardingChannelzH
    Unit and integration tests for L{SSHConnectForwardingChannel}.
    zCannot run without cryptographyreactorreturnNc                     |j         d         d         }|j        d         }|                    d          }t          |                                          }|                    |           dS )z
        Fake that connection was established for first connectTCP request made
        on C{reactor}.

        @param reactor: Reactor on which to fake the connection.
        @type  reactor: A reactor.
        r      N)peerAddress)
tcpClients
connectorsbuildProtocolr	   getDestinationmakeConnection)selfr   factory	connectorprotocol	transports         a/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/conch/test/test_forwarding.pymakeTCPConnectionz1TestSSHConnectForwardingChannel.makeTCPConnection   sl     $Q'*&q)	((..#	0H0H0J0JKKK		*****    c                    t          j        d          }t                      }t          |dg          |_        |                    d           |                     |           |                     |j                   | 	                    |j
        t           j                   |                     t          ddd          |j
        j                                                   dS )z
        When a hostname is sent as part of forwarding requests, it
        is resolved using HostnameEndpoint's resolver.
        )zfwd.example.org  )hostportz::1NTCPr    )r   SSHConnectForwardingChannelr   r   _reactorchannelOpenr   successResultOf_channelOpenDeferredassertIsInstanceclientSSHForwardingClientassertEqualr   r   getPeer)r   sutmemoryReactors      r    test_channelOpenHostnameRequestsz@TestSSHConnectForwardingChannel.test_channelOpenHostnameRequests+   s    
 4>WXXX*,,4]UGLL}---S5666 	cj**HIIIud++SZ-A-I-I-K-K	
 	
 	
 	
 	
r   )r   N)	__name__
__module____qualname____doc__r   skipr   r   r/    r   r   r   r      sd           10+); + + + + +
 
 
 
 
 
r   r   N)r3   twisted.python.reflectr   r   twisted.conch.sshr   twisted.internet.addressr   $twisted.internet.test.test_endpointsr   twisted.internet.testingr   r	   twisted.trialr
   TestCaser   r5   r   r   <module>r=      s    
 1 0 0 0 0 0}^,, -,,,,,, 0 0 0 0 0 0 N N N N N N H H H H H H H H " " " " " "(
 (
 (
 (
 (
h&7 (
 (
 (
 (
 (
r   