HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/names/__pycache__/secondary.cpython-38.pyc
U


W[��@s�ddlmZmZddgZddlmZmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lm
Z
dd
lmZmZddlmZGdd�dej�ZGd
d�de
�ZdS)�)�absolute_import�division�SecondaryAuthority�SecondaryAuthorityService)�task�defer)�dns)�common)�client)�resolve)�
FileAuthority)�log�failure)�servicec@s@eZdZdZdZdd�Zedd��Zdd�Zd	d
�Z	dd�Z
dS)
rN�5cs�|_�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)r�domains)�selfrrrrr�__init__s
z"SecondaryAuthorityService.__init__cs6|dg�}�d|_�d|_�fdd�|D�|_|S)aS
        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 domain: A C{bytes} giving the domain to transfer.

        @return: A new instance of L{SecondaryAuthorityService}.
        Nr�csg|]}t��|��qSr)r�fromServerAddressAndDomainr��
serverAddressrrr9s�zISecondaryAuthorityService.fromServerAddressAndDomains.<locals>.<listcomp>)r�_portr)�clsrrrrrr�fromServerAddressAndDomains&s



�z5SecondaryAuthorityService.fromServerAddressAndDomainscCst�|j�S�N)rZ
ResolverChainr�rrrr�getAuthority?sz&SecondaryAuthorityService.getAuthoritycCsVtj�|�dd�|jD�|_d}ddlm}|jD]}|�||jd�|d7}q4dS)NcSsg|]}t�|j��qSr)rZLoopingCall�transferrrrrrDsz:SecondaryAuthorityService.startService.<locals>.<listcomp>r��reactorir)	r�Service�startServicer�calls�twisted.internetr(Z	callLater�start)r�ir(�crrrr*Bs
z&SecondaryAuthorityService.startServicecCs$tj�|�|jD]}|��qdSr#)rr)�stopServicer+�stop)rr/rrrr0Ls
z%SecondaryAuthorityService.stopService)�__name__�
__module__�__qualname__r+r r�classmethodr"r%r*r0rrrrrs

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: C{str}

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

    @ivar _reactor: The reactor to use to perform the zone transfers, or L{None}
        to use the global reactor.
    FNrcCstj�|�||_||_dS)z�
        @param domain: The domain for which this will be the secondary
            authority.
        @type domain: L{bytes}
        N)r	ZResolverBaserr�domain)rZ	primaryIPr6rrrrhs	zSecondaryAuthority.__init__cCs(|dd�}|d|_|d|_||_|S)aG
        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.

        @return: A new instance of L{SecondaryAuthority}.
        Nrr)rr r6)r!rr6Z	secondaryrrrrvs



z-SecondaryAuthority.fromServerAddressAndDomaincCs^|jr
dSd|_|j}|dkr*ddlm}tj|j|jfg|d�}|�	|j
��|j��
|j�S)NTrr')Zserversr()�transferringZtransfering�_reactorr,r(r
ZResolverrr Z
lookupZoner6ZaddCallback�_cbZoneZ
addErrback�_ebZone)rr(Zresolverrrrr&�s���zSecondaryAuthority.transfercCs4|jr|js"t�t�t�|���St�	|||||�Sr#)
�soa�recordsrZfailrZFailurerZDomainErrorr�_lookup)r�namer!�typeZtimeoutrrrr=�szSecondaryAuthority._lookupcCsj|\}}}i|_}|D]L}|jsF|jtjkrFt|j���|jf|_q|�	t|j���g��
|j�qdSr#)r<r;r?rZSOA�strr>�lowerZpayload�
setdefault�append)rZzoneZans�_�rZrecrrrr9�s

zSecondaryAuthority._cbZonecCs$t�d|j|jf�t�|�dS)Nz/Updating %s from %s failed during zone transfer)r
�msgr6r�err�rrrrrr:�szSecondaryAuthority._ebZonecCs|���|j|j�dSr#)r&ZaddCallbacks�_cbTransferred�_ebTransferredr$rrr�update�szSecondaryAuthority.updatecCs
d|_dS)NF)r7)r�resultrrrrI�sz!SecondaryAuthority._cbTransferredcCs*d|_t�d|j|jf�t�|�dS)NFz2Transferring %s from %s failed after zone transfer)Ztransferredr
rFr6rrGrHrrrrJ�sz!SecondaryAuthority._ebTransferred)N)r2r3r4�__doc__r7r;r<r r8rr5rr&r=r9r:rKrIrJrrrrrSs


N)Z
__future__rr�__all__r,rrZ
twisted.namesrr	r
rZtwisted.names.authorityrZtwisted.pythonr
rZtwisted.applicationrr)rrrrrr�<module>s@