Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/names/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/names/__pycache__/secondary.cpython-310.pyc
o

�b��@s�ddgZddlmZddlmZmZddlmZmZm	Z	m
Z
ddlmZddl
mZmZddlmZGd	d�dej�ZGd
d�de�ZdS)�SecondaryAuthority�SecondaryAuthorityService�)�service)�defer�task)�client�common�dns�resolve)�
FileAuthority)�failure�log)�nativeStringc@sDeZdZdZdZdZdd�Zedd��Zdd	�Z	d
d�Z
dd
�ZdS)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�5cs"t��|_�fdd�|D�|_dS)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}
        csg|]}t�|��qS�)r��.0�d��primaryr�9/usr/lib/python3/dist-packages/twisted/names/secondary.py�
<listcomp>+sz6SecondaryAuthorityService.__init__.<locals>.<listcomp>N)rr�domains)�selfrrrrr�__init__ s

z"SecondaryAuthorityService.__init__cs0�\}}||g�}||_�fdd�|D�|_|S)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}.
        csg|]}t��|��qSr)r�fromServerAddressAndDomainr��
serverAddressrrrAs
��zISecondaryAuthorityService.fromServerAddressAndDomains.<locals>.<listcomp>)�_portr)�clsrrr�portrrrr�fromServerAddressAndDomains-s

�z5SecondaryAuthorityService.fromServerAddressAndDomainscCst�|j�S)z_
        Get a resolver for the transferred domains.

        @rtype: L{ResolverChain}
        )r
�
ResolverChainr�rrrr�getAuthorityGsz&SecondaryAuthorityService.getAuthoritycCsVtj�|�dd�|jD�|_d}ddlm}|jD]}|�||jd�|d7}qdS)NcSsg|]}t�|j��qSr)r�LoopingCall�transferrrrrrQsz:SecondaryAuthorityService.startService.<locals>.<listcomp>r��reactori�)	r�Service�startServicer�calls�twisted.internetr(�	callLater�start)r�ir(�crrrr+Os

�z&SecondaryAuthorityService.startServicecCs$tj�|�|jD]}|��q	dS�N)rr*�stopServicer,�stop)rr1rrrr3Zs

�z%SecondaryAuthorityService.stopService)�__name__�
__module__�__qualname__�__doc__r,rr�classmethodr!r$r+r3rrrrrs
c@sreZdZdZdZdZZdZdZdd�Z	e
dd��Zd	d
�Zddd�Z
d
d�Zdd�Zdd�Zdd�Zdd�ZdS)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.
    FNrcCs&tj�|�t|�|_t�|�|_dS)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�	primaryIPr<rrrrxs	
zSecondaryAuthority.__init__cCs|\}}|||�}||_|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)rrr<rr �	secondaryrrrr�s
z-SecondaryAuthority.fromServerAddressAndDomaincCs^|jrdSd|_|j}|durddlm}tj|j|jfg|d�}|�	|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�
lookupZoner<�addCallback�_cbZone�
addErrback�_ebZone)rr(�resolverrrrr&�s	�
�zSecondaryAuthority.transfercCs4|jr|jst�t�t�|���St�	|||||�Sr2)
�soa�recordsr�failr�Failurer	�DomainErrorr�_lookup)r�namer�type�timeoutrrrrO�szSecondaryAuthority._lookupcCsf|\}}}i|_}|D]$}|js"|jtjkr"|jj��|jf|_q|�|jj��g��	|j�qdSr2)
rKrJrQr	�SOArP�lower�payload�
setdefault�append)r�zone�ans�_�r�recrrrrF�s

�zSecondaryAuthority._cbZonecCs$t�d|j|jf�t�|�dS)Nz/Updating %s from %s failed during zone transfer)r
�msgr<r�err�rrrrrrH�s
��zSecondaryAuthority._ebZonecCs|���|j|j�dSr2)r&�addCallbacks�_cbTransferred�_ebTransferredr#rrr�update�szSecondaryAuthority.updatecCs
d|_dS)NF)r@)r�resultrrrra�s
z!SecondaryAuthority._cbTransferredcCs*d|_t�d|j|jf�t�|�dS)NFz2Transferring %s from %s failed after zone transfer)�transferredr
r]r<rr^r_rrrrb�s
��z!SecondaryAuthority._ebTransferredr2)r5r6r7r8r@rJrKrrBrr9rr&rOrFrHrcrarbrrrrr`s 

	N)�__all__�twisted.applicationrr-rr�
twisted.namesrrr	r
�twisted.names.authorityr�twisted.pythonrr
�twisted.python.compatrr*rrrrrr�<module>sP

Spamworldpro Mini