
    8'hH                         d dl mZ d dlZd dlmZ d dlmZmZ 	 d dlm	Z	 	 d dlmZ dZd	Zdd
Zd Zd Zy# e
$ r  ed      Z	Y %w xY w# e
$ r dZY )w xY w)    )absolute_importN)Deferred)IPv4AddressUNIXAddress)PipeAddress)IPv6AddressTF)sleeppeer2strtransport_channel_idc                 d    |sddl m} t               }|j                  | |j                  d       |S )aD  
    Inline sleep for use in co-routines (Twisted ``inlineCallback`` decorated functions).

    .. seealso::
       * `twisted.internet.defer.inlineCallbacks <http://twistedmatrix.com/documents/current/api/twisted.internet.defer.html#inlineCallbacks>`__
       * `twisted.internet.interfaces.IReactorTime <http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorTime.html>`__

    :param delay: Time to sleep in seconds.
    :type delay: float
    :param reactor: The Twisted reactor to use.
    :type reactor: None or provider of ``IReactorTime``.
    r   )reactorN)twisted.internetr   r   	callLatercallback)delayr   ds      Q/var/www/html/trade_iq/venv/lib/python3.12/site-packages/autobahn/twisted/util.pyr	   r	   4   s,     ,
AeQZZ.H    c                    t        | t              r(dj                  | j                  | j                        }|S t
        r8t        | t              r(dj                  | j                  | j                        }|S t        | t              rdj                  | j                        }|S t        | t              rd}|S dj                  |       }|S )z
    Convert a Twisted address as returned from ``self.transport.getPeer()`` to a string.

    :returns: Returns a string representation of the peer on a Twisted transport.
    :rtype: unicode
    ztcp4:{0}:{1}ztcp6:{0}:{1}zunix:{0}z<pipe>z?:{0})

isinstancer   formathostport	_HAS_IPV6r   r   namer   )addrress     r   r
   r
   H   s     $$$$TYY		: J 
z$4$$TYY		: J 
D+	&  + J 
D+	&
 J ood#Jr   c                 6   |dvrt        dj                  |            t        | d      ro|r| j                  j	                         }n| j                  j                         }|yt        j                         }|j                  |       |j                         S y)aq  
    Application-layer user authentication protocols are vulnerable to generic
    credential forwarding attacks, where an authentication credential sent by
    a client C to a server M may then be used by M to impersonate C at another
    server S. To prevent such credential forwarding attacks, modern authentication
    protocols rely on channel bindings. For example, WAMP-cryptosign can use
    the tls-unique channel identifier provided by the TLS layer to strongly bind
    authentication credentials to the underlying channel, so that a credential
    received on one TLS channel cannot be forwarded on another.

    )z
tls-uniquezinvalid channel ID type {}_tlsConnectionN)
	Exceptionr   hasattrr   get_peer_finishedget_finishedhashlibsha256updatedigest)	transport	is_serverchannel_id_typetls_finished_msgms        r   r   r   ^   s     o-4;;OLMMy*+   )77IIK  )77DDF# NN	!"xxz r   )N)
__future__r   r$   twisted.internet.deferr   twisted.internet.addressr   r   twisted.internet.stdior   ImportErrortyper   r   __allr	   r
   r    r   r   <module>r5      sn   6 '  + =2
4I	(,'w  t*K  Is    6 A	 AA	AA