%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__/secondary.cpython-312.pyc

�

Ϫ�f����ddgZddlmZddlmZmZddlmZmZm	Z	m
Z
ddlmZddl
mZmZddlmZGd	�dej$�ZGd
�de�Zy)�SecondaryAuthority�SecondaryAuthorityService�)�service)�defer�task)�client�common�dns�resolve)�
FileAuthority)�failure�log)�nativeStringc�@�eZdZdZdZdZd�Zed��Zd�Z	d�Z
d�Zy)	ra:
    A service that keeps one or more authorities up to date by doing hourly
    zone transfers from a master.

    @ivar primary: IP address of the master.
    @type primary: L{str}

    @ivar domains: An authority for each domain mirrored from the master.
    @type domains: L{list} of L{SecondaryAuthority}
    N�5c�l�t|�|_|D�cgc]}t||���c}|_ycc}w)a
        @param primary: The IP address of the server from which to perform
        zone transfers.
        @type primary: L{str}

        @param domains: A sequence of domain names for which to perform
        zone transfers.
        @type domains: L{list} of L{bytes}
        N)r�primaryr�domains)�selfrr�ds    �9/usr/lib/python3/dist-packages/twisted/names/secondary.py�__init__z"SecondaryAuthorityService.__init__ s-��$�G�,���@G�H�1�*�7�A�6�H����Hs�1c��|\}}||g�}||_|D�cgc]}tj||���c}|_|Scc}w)a�
        Construct a new L{SecondaryAuthorityService} from a tuple giving a
        server address and a C{str} giving the name of a domain for which this
        is an authority.

        @param serverAddress: A two-tuple, the first element of which is a
            C{str} giving an IP address and the second element of which is a
            C{int} giving a port number.  Together, these define where zone
            transfers will be attempted from.

        @param domains: Domain names for which to perform zone transfers.
        @type domains: sequence of L{bytes}

        @return: A new instance of L{SecondaryAuthorityService}.
        )�_portr�fromServerAddressAndDomainr)�cls�
serverAddressrr�portrrs       r�fromServerAddressAndDomainsz5SecondaryAuthorityService.fromServerAddressAndDomains-sU��"&�
����g�r�"����
��
��
�9�9�-��K�
������	
s�Ac�@�tj|j�S)z_
        Get a resolver for the transferred domains.

        @rtype: L{ResolverChain}
        )r�
ResolverChainr�rs r�getAuthorityz&SecondaryAuthorityService.getAuthorityGs���$�$�T�\�\�2�2�c�:�tjj|�|jD�cgc]!}t	j
|j���#c}|_d}ddlm	}|jD]$}|j||jd�|dz
}�&ycc}w)Nr��reactori�)r�Service�startServicerr�LoopingCall�transfer�calls�twisted.internetr'�	callLater�start)rr�ir'�cs     rr*z&SecondaryAuthorityService.startServiceOsy�����$�$�T�*�<@�L�L�I�q�d�&�&�q�z�z�2�I��
�
��,����	�A����a����'�2�
��F�A�	��	Js�&Bc��tjj|�|jD]}|j	��y�N)rr)�stopServicer-�stop)rr2s  rr5z%SecondaryAuthorityService.stopServiceZs0�����#�#�D�)����	�A�
�F�F�H�	r$)�__name__�
__module__�__qualname__�__doc__r-rr�classmethodrr#r*r5�r$rrrs<��	�
�E��E�I�����23�	�r$c�f�eZdZdZdZdxZZdZdZd�Z	e
d��Zd�Zdd�Z
d	�Zd
�Zd�Zd�Zd
�Zy)ra
    An Authority that keeps itself updated by performing zone transfers.

    @ivar primary: The IP address of the server from which zone transfers will
    be attempted.
    @type primary: L{str}

    @ivar _port: The port number of the server from which zone transfers will
    be attempted.
    @type _port: L{int}

    @ivar domain: The domain for which this is the secondary authority.
    @type domain: L{bytes}

    @ivar _reactor: The reactor to use to perform the zone transfers, or
    L{None} to use the global reactor.
    FNrc��tjj|�t|�|_tj|�|_y)z�
        @param domain: The domain for which this will be the secondary
            authority.
        @type domain: L{bytes} or L{str}
        N)r	�ResolverBaserrrr
�domainString�domain)r�	primaryIPrAs   rrzSecondaryAuthority.__init__xs6��	���$�$�T�*�#�I�.����&�&�v�.��r$c�0�|\}}|||�}||_|S)af
        Construct a new L{SecondaryAuthority} from a tuple giving a server
        address and a C{bytes} giving the name of a domain for which this is an
        authority.

        @param serverAddress: A two-tuple, the first element of which is a
            C{str} giving an IP address and the second element of which is a
            C{int} giving a port number.  Together, these define where zone
            transfers will be attempted from.

        @param domain: A C{bytes} giving the domain to transfer.
        @type domain: L{bytes}

        @return: A new instance of L{SecondaryAuthority}.
        )r)rrrArr�	secondarys      rrz-SecondaryAuthority.fromServerAddressAndDomain�s&��"&�
������(�	��	���r$c�H�|jryd|_|j}|�ddlm}tj|j|jfg|��}|j|j�j|j�j|j�S)z�
        Attempt a zone transfer.

        @returns: A L{Deferred} that fires with L{None} when attempted zone
            transfer has completed.
        NTrr&)�serversr')�transferring�transfering�_reactorr.r'r�Resolverrr�
lookupZonerA�addCallback�_cbZone�
addErrback�_ebZone)rr'�resolvers   rr,zSecondaryAuthority.transfer�s�����������-�-���?�0��?�?��l�l�D�J�J�/�0�'�
��
������,�
�[����
&�
�Z����
%�	
r$c���|jr|js;tjt	j
t
j|���Stj|||||�Sr4)
�soa�recordsr�failr
�Failurer
�DomainErrorr�_lookup)r�namer�type�timeouts     rrWzSecondaryAuthority._lookup�sK���x�x�t�|�|��:�:�g�o�o�c�o�o�d�.C�D�E�E��$�$�T�4��d�G�D�Dr$c��|\}}}ix|_}|D]�}|jsS|jtjk(r6|j
j
j
�|jf|_�b|j|j
j
j
�g�j|j���yr4)
rSrRrYr
�SOArX�lower�payload�
setdefault�append)r�zone�ans�_�r�recs      rrMzSecondaryAuthority._cbZone�s����	��Q������q��	L�C��8�8����C�G�G� 3��H�H�M�M�/�/�1�3�;�;�?������S�X�X�]�]�0�0�2�B�7�>�>�s�{�{�K�		Lr$c��tjd|j�d|j�d��tj|�y)Nz	Updating � from z failed during zone transfer)r�msgrAr�err�rr
s  rrOzSecondaryAuthority._ebZone�s.������{�{�D�L�L�
*�	
�	����r$c�l�|j�j|j|j�yr4)r,�addCallbacks�_cbTransferred�_ebTransferredr"s r�updatezSecondaryAuthority.update�s$���
�
��$�$�T�%8�%8�$�:M�:M�Nr$c��d|_y)NF)rG)r�results  rrmz!SecondaryAuthority._cbTransferred�s
��!��r$c��d|_tjd|j�d|j�d��tj
|�y)NFz
Transferring rgz failed after zone transfer)�transferredrrhrArrirjs  rrnz!SecondaryAuthority._ebTransferred�s6�� �������{�{�D�L�L�
*�	
�	����r$r4)r7r8r9r:rGrRrSrrIrr;rr,rWrMrOrormrnr<r$rrr`sa���$�L���C�'��E��H�/�����*
�4E�L��O�"�r$N)�__all__�twisted.applicationrr.rr�
twisted.namesrr	r
r�twisted.names.authorityr�twisted.pythonr
r�twisted.python.compatrr)rrr<r$r�<module>rzsH�� �!<�
=��'�(�6�6�1�'�.�M����M�`x��xr$

Zerion Mini Shell 1.0