%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/names/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/names/__pycache__/common.cpython-312.pyc

�

Ϫ�f�$�
��dZddlZddlmZddlmZmZmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZed�\ZZZd	Zeej0�Gd
�d��Zd$d�Ziej6d
�ej8d�ej:d�ej<d�ej>d�ej@d�ejBd�ejDd�ejFd�ejHd�ejJd�ejLd�ejNd�ejPd�ejRd�ejTd�ejVd�ejXdejZdej\d ej^d!ej`d"ejbd#i�Z2y)%z>
Base functionality useful to various parts of Twisted Names.
�N)�implementer)�defer�error�
interfaces)�Logger)�dns)�DNSFormatError�DNSNameError�DNSNotImplementedError�DNSQueryRefusedError�DNSServerError�DNSUnknownError�)�rrc
�~�eZdZdZe�Zejeeje
ejeejeejeiZdZd�Zd�Zd d�Zd�Zd d�Zd d�Zd d	�Zd d
�Zd d�Zd d�Zd d
�Zd d�Zd d�Zd d�Z d d�Z!d d�Z"d d�Z#d d�Z$d d�Z%d d�Z&d d�Z'd d�Z(d d�Z)d d�Z*d d�Z+d d�Z,d d�Z-d!d�Z.d�Z/y)"�ResolverBaseaN
    L{ResolverBase} is a base class for implementations of
    L{interfaces.IResolver} which deals with a lot
    of the boilerplate of implementing all of the lookup methods.

    @cvar _errormap: A C{dict} mapping DNS protocol failure response codes
        to exception classes which will be used to represent those failures.
    Nc�|�i|_tj�D]\}}t||�|j|<� y�N)�typeToMethod�items�getattr)�self�k�vs   �6/usr/lib/python3/dist-packages/twisted/names/common.py�__init__zResolverBase.__init__7s=����� �&�&�(�	4�D�A�q�#*�4��#3�D���a� �	4�c�B�|jj|t�S)z�
        Convert a response code (one of the possible values of
        L{dns.Message.rCode} to an exception instance representing it.

        @since: 10.0
        )�	_errormap�getr)r�responseCodes  r�exceptionForCodezResolverBase.exceptionForCode<s���~�~�!�!�,��@�@rc��	|j|j}tj||jj|�S#t
$ro|jjd|��tj|j|jjtj|j|�cYSwxYw)Nz:Query of unknown type {query.type} for {query.name.name!r})�query)r�typer�
maybeDeferred�name�KeyError�_log�debug�_lookupr�IN)rr$�timeout�methods    rr$zResolverBase.queryEs���	I��&�&�u�z�z�2�F��&�&�v�u�z�z����H�H���	��I�I�O�O�L��
�
��&�&����e�j�j�o�o�s�v�v�u�z�z�7��
�	�s�A�A5B>�=B>c�>�tjtd��S)NzResolverBase._lookup)r�fail�NotImplementedError)rr'�clsr%r-s     rr+zResolverBase._lookupSs���z�z�-�.D�E�F�Frc��|jtj|�tjtj|�Sr)r+r�domainStringr,�A�rr'r-s   r�
lookupAddresszResolverBase.lookupAddressVs*���|�|�C�,�,�T�2�C�F�F�C�E�E�7�K�Krc��|jtj|�tjtj|�Sr)r+rr4r,�AAAAr6s   r�lookupIPV6AddresszResolverBase.lookupIPV6AddressY�*���|�|�C�,�,�T�2�C�F�F�C�H�H�g�N�Nrc��|jtj|�tjtj|�Sr)r+rr4r,�A6r6s   r�lookupAddress6zResolverBase.lookupAddress6\�*���|�|�C�,�,�T�2�C�F�F�C�F�F�G�L�Lrc��|jtj|�tjtj|�Sr)r+rr4r,�MXr6s   r�lookupMailExchangezResolverBase.lookupMailExchange_r?rc��|jtj|�tjtj|�Sr)r+rr4r,�NSr6s   r�lookupNameserverszResolverBase.lookupNameserversbr?rc��|jtj|�tjtj|�Sr)r+rr4r,�CNAMEr6s   r�lookupCanonicalNamez ResolverBase.lookupCanonicalNamee�*���|�|�C�,�,�T�2�C�F�F�C�I�I�w�O�Orc��|jtj|�tjtj|�Sr)r+rr4r,�MBr6s   r�
lookupMailBoxzResolverBase.lookupMailBoxhr?rc��|jtj|�tjtj|�Sr)r+rr4r,�MGr6s   r�lookupMailGroupzResolverBase.lookupMailGroupkr?rc��|jtj|�tjtj|�Sr)r+rr4r,�MRr6s   r�lookupMailRenamezResolverBase.lookupMailRenamenr?rc��|jtj|�tjtj|�Sr)r+rr4r,�PTRr6s   r�
lookupPointerzResolverBase.lookupPointerq�*���|�|�C�,�,�T�2�C�F�F�C�G�G�W�M�Mrc��|jtj|�tjtj|�Sr)r+rr4r,�SOAr6s   r�lookupAuthorityzResolverBase.lookupAuthoritytrVrc��|jtj|�tjtj|�Sr)r+rr4r,�NULLr6s   r�
lookupNullzResolverBase.lookupNullwr;rc��|jtj|�tjtj|�Sr)r+rr4r,�WKSr6s   r�lookupWellKnownServicesz$ResolverBase.lookupWellKnownServiceszrVrc��|jtj|�tjtj|�Sr)r+rr4r,�SRVr6s   r�
lookupServicezResolverBase.lookupService}rVrc��|jtj|�tjtj|�Sr)r+rr4r,�HINFOr6s   r�lookupHostInfozResolverBase.lookupHostInfo�rIrc��|jtj|�tjtj|�Sr)r+rr4r,�MINFOr6s   r�lookupMailboxInfozResolverBase.lookupMailboxInfo�rIrc��|jtj|�tjtj|�Sr)r+rr4r,�TXTr6s   r�
lookupTextzResolverBase.lookupText�rVrc��|jtj|�tjtj|�Sr)r+rr4r,�SPFr6s   r�lookupSenderPolicyzResolverBase.lookupSenderPolicy�rVrc��|jtj|�tjtj|�Sr)r+rr4r,�RPr6s   r�lookupResponsibilityz!ResolverBase.lookupResponsibility�r?rc��|jtj|�tjtj|�Sr)r+rr4r,�AFSDBr6s   r�lookupAFSDatabasezResolverBase.lookupAFSDatabase�rIrc��|jtj|�tjtj|�Sr)r+rr4r,�AXFRr6s   r�
lookupZonezResolverBase.lookupZone�r;rc��|jtj|�tjtj|�Sr)r+rr4r,�NAPTRr6s   r�lookupNamingAuthorityPointerz)ResolverBase.lookupNamingAuthorityPointer�rIrc��|jtj|�tjtj|�Sr)r+rr4r,�ALL_RECORDSr6s   r�lookupAllRecordszResolverBase.lookupAllRecords�s*���|�|�C�,�,�T�2�C�F�F�C�O�O�W�U�Urc��tj|�}|j||�}|j|j||�|Sr)rr4r}�addCallback�
_cbRecords)rr'r-�effort�ds     r�
getHostByNamezResolverBase.getHostByName�s?������%��
�!�!�$��0��	�
�
�d�o�o�t�V�4��rc��|\}}}t|tj|�||z|z|�}|stj|��|Sr)�
extractRecordr�Namer�DNSLookupError)r�recordsr'r��ans�auth�add�results        rr�zResolverBase._cbRecords�sH��"���d�C��t�S�X�X�d�^�S�4�Z�#�5E�v�N����&�&�t�,�,��
rr)N�
)0�__name__�
__module__�__qualname__�__doc__rr)r�EFORMATr	�ESERVERr
�ENAMEr
�ENOTIMPr�EREFUSEDrrrrr"r$r+r7r:r>rBrErHrLrOrRrUrYr\r_rbrerhrkrnrqrtrwrzr}r�r�rrrrr!s�����8�D����^����^��	�	�<����+����*��I��L�4�
A�I�G�L�O�M�M�M�P�M�M�M�N�N�O�N�N�P�P�N�N�M�P�O�P�V��rrc�H�����syttd�r�|D]i}|j�k(s�|jtj
k(s�1tjtj|jj�cS|D]i}|j�k(s�|jtjk(s�1tjtj|jj�cS|D]i}|j�k(s�|jtjk(s�1tjtj|jj�cS|D]�}|j�k(s�|jtjk(s�1t||jj|�dz
�}|s6|j|jjj�dz
��cS|cS|D]�}|jtj k7r�!ddlm}|j'|jjjj)d�tj*fg������fd	�}�j-�j�j/|�cSy)
am
    Resolve a name to an IP address, following I{CNAME} records and I{NS}
    referrals recursively.

    This is an implementation detail of L{ResolverBase.getHostByName}.

    @param resolver: The resolver to use for the next query (unless handling
    an I{NS} referral).
    @type resolver: L{IResolver}

    @param name: The name being looked up.
    @type name: L{dns.Name}

    @param answers: All of the records returned by the previous query (answers,
    authority, and additional concatenated).
    @type answers: L{list} of L{dns.RRHeader}

    @param level: Remaining recursion budget. This is decremented at each
    recursion. The query returns L{None} when it reaches 0.
    @type level: L{int}

    @returns: The first IPv4 or IPv6 address (as a dotted quad or colon
    quibbles), or L{None} when no result is found.
    @rtype: native L{str} or L{None}
    N�	inet_ntop�)r�r)�client�ascii)�serversc�>��|\}}}t��||z|z�dz
�S)Nr�)r�)r�r�r�r��levelr'�
nsResolvers    ���r�
queryAgainz!extractRecord.<locals>.queryAgain�s-���&��S�$�� ��T�3��:��3C�U�Q�Y�O�Or)�hasattr�socketr'r%rr=r��AF_INET6�payload�addressr9r5�AF_INETrGr�r�rD�
twisted.namesr��Resolver�decode�PORTr7r)	�resolverr'�answersr��rr�r�r�r�s	 ` `    @rr�r��s���4���v�{�#��	L�A��v�v��~�!�&�&�C�F�F�"2��'�'�������9J�9J�K�K�	L��	L�A��v�v��~�!�&�&�C�H�H�"4��'�'�������9J�9J�K�K�	L��G���6�6�T�>�a�f�f����o��#�#�F�N�N�A�I�I�4E�4E�F�F�G�����6�6�T�>�a�f�f��	�	�1�"�8�Q�Y�Y�^�^�W�e�a�i�P�F���-�-�a�i�i�n�n�.A�.A�%�RS�)�-�T�T��M���K���6�6�S�V�V���(��_�_������$�$�+�+�G�4�c�h�h�?��%�
�
�	P��'�'��	�	�2�>�>�z�J�J�Krr7r:r>rErHrYrLrOrRr\r_rUrerhrBrkrnrqrtrbrzrwr})r�)3r�r��zope.interfacer�twisted.internetrrr�twisted.loggerrr�r�twisted.names.errorr	r
rrr
r�range�_ANS�_AUTH�_ADD�EMPTY_RESULT�	IResolverrr�r5r9r=rDrGrXrKrNrQr[r^rTrdrgrArjrmrprsraryrvr|rrrr�<module>r�s���
�
�&�5�5�!�����!�H���e�T���
�Z�
!�
!�"�H�H�#�H�V?K�D��E�E�?���H�H�!���F�F����F�F��	�
�I�I�$���G�G�
�
��F�F�O���F�F����F�F����H�H�l���G�G�
&���G�G�_���I�I����I�I�"���F�F� �� �G�G�\�!�"�G�G�
!�#�$�F�F�"��I�I�"��G�G�_��I�I�-��H�H�l��O�O�'�/�r

Zerion Mini Shell 1.0