§
    Ètºfæ  ã                   ó¬   — d dgZ ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
 ddlmZ ddlmZmZ ddlmZ  G d	„ dej        ¦  «        Z G d
„ d e¦  «        ZdS )ÚSecondaryAuthorityÚSecondaryAuthorityServiceé    )Úservice)ÚdeferÚtask)ÚclientÚcommonÚdnsÚresolve)ÚFileAuthority)ÚfailureÚlog)ÚnativeStringc                   óH   — e Zd ZdZdZdZd„ Zed„ ¦   «         Zd„ Z	d„ Z
d„ ZdS )	r   a:  
    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é5   c                 óV   ‡— t          ‰¦  «        | _        ˆfd„|D ¦   «         | _        dS )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}
        c                 ó0   •— g | ]}t          ‰|¦  «        ‘ŒS © )r   )Ú.0ÚdÚprimarys     €úV/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/names/secondary.pyú
<listcomp>z6SecondaryAuthorityService.__init__.<locals>.<listcomp>+   s$   ø€ ÐHÐHÐH¸1Õ*¨7°AÑ6Ô6ÐHÐHÐHó    N)r   r   Údomains)Úselfr   r   s    ` r   Ú__init__z"SecondaryAuthorityService.__init__    s3   ø€ õ $ GÑ,Ô,ˆŒØHÐHÐHÐHÀÐHÑHÔHˆŒˆˆr   c                 ó^   ‡— ‰\  }} | |g ¦  «        }||_         ˆfd„|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}.
        c                 óF   •— g | ]}t                                ‰|¦  «        ‘ŒS r   )r   ÚfromServerAddressAndDomain)r   r   ÚserverAddresss     €r   r   zISecondaryAuthorityService.fromServerAddressAndDomains.<locals>.<listcomp>A   s9   ø€ ð 
ð 
ð 
àõ ×9Ò9¸-ÈÑKÔKð
ð 
ð 
r   )Ú_portr   )Úclsr!   r   r   Úportr   s    `    r   ÚfromServerAddressAndDomainsz5SecondaryAuthorityService.fromServerAddressAndDomains-   sW   ø€ ð" &‰ˆ�Ø�#�g˜rÑ"Ô"ˆØˆŒð
ð 
ð 
ð 
àð
ñ 
ô 
ˆŒð ˆr   c                 ó4   — t          j        | j        ¦  «        S )z_
        Get a resolver for the transferred domains.

        @rtype: L{ResolverChain}
        )r   ÚResolverChainr   ©r   s    r   ÚgetAuthorityz&SecondaryAuthorityService.getAuthorityG   s   € õ Ô$ T¤\Ñ2Ô2Ð2r   c                 óÖ   — t           j                             | ¦  «         d„ | j        D ¦   «         | _        d}ddlm} | j        D ]#}|                     ||j        d¦  «         |dz  }Œ$d S )Nc                 ó@   — g | ]}t          j        |j        ¦  «        ‘ŒS r   )r   ÚLoopingCallÚtransfer)r   r   s     r   r   z:SecondaryAuthorityService.startService.<locals>.<listcomp>Q   s%   € ÐIÐIÐI°q•dÔ& q¤zÑ2Ô2ÐIÐIÐIr   r   ©Úreactori  é   )	r   ÚServiceÚstartServicer   ÚcallsÚtwisted.internetr/   Ú	callLaterÚstart)r   Úir/   Úcs       r   r2   z&SecondaryAuthorityService.startServiceO   s†   € ÝŒ×$Ò$ TÑ*Ô*Ð*ØIÐI¸D¼LÐIÑIÔIˆŒ
ØˆØ,Ð,Ð,Ð,Ð,Ð,à”ð 	ð 	ˆAà×Ò˜a ¤¨'Ñ2Ô2Ð2Ø�‰FˆAˆAð	ð 	r   c                 ó€   — t           j                             | ¦  «         | j        D ]}|                     ¦   «          Œd S ©N)r   r1   ÚstopServicer3   Ústop)r   r8   s     r   r;   z%SecondaryAuthorityService.stopServiceZ   sB   € ÝŒ×#Ò# DÑ)Ô)Ð)Ø”ð 	ð 	ˆAØ�FŠF‰HŒHˆHˆHð	ð 	r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r3   r"   r   Úclassmethodr%   r)   r2   r;   r   r   r   r   r      s„   € € € € € ð	ð 	ð €Eà€EðIð Ið Ið ðð ñ „[ðð23ð 3ð 3ð	ð 	ð 	ðð ð ð ð r   c                   ón   — e Zd ZdZdZdxZZdZdZd„ Z	e
d„ ¦   «         Zd„ Zdd„Zd	„ Zd
„ Zd„ Zd„ Zd„ ZdS )r   a  
    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.
    FNr   c                 óž   — t           j                             | ¦  «         t          |¦  «        | _        t          j        |¦  «        | _        dS )z�
        @param domain: The domain for which this will be the secondary
            authority.
        @type domain: L{bytes} or L{str}
        N)r	   ÚResolverBaser   r   r   r
   ÚdomainStringÚdomain)r   Ú	primaryIPrF   s      r   r   zSecondaryAuthority.__init__x   s@   € õ 	Ô×$Ò$ TÑ*Ô*Ð*Ý# IÑ.Ô.ˆŒÝÔ& vÑ.Ô.ˆŒˆˆr   c                 ó6   — |\  }} | ||¦  «        }||_         |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"   )r#   r!   rF   r   r$   Ú	secondarys         r   r    z-SecondaryAuthority.fromServerAddressAndDomain…   s+   € ð" &‰ˆ�Ø�C˜ Ñ(Ô(ˆ	Øˆ	ŒØÐr   c                 ó  — | j         rdS d| _        | j        }|€ddlm} t          j        | j        | j        fg|¬¦  «        }| 	                    | j
        ¦  «                             | j        ¦  «                             | j        ¦  «        S )z›
        Attempt a zone transfer.

        @returns: A L{Deferred} that fires with L{None} when attempted zone
            transfer has completed.
        NTr   r.   )Úserversr/   )ÚtransferringÚtransferingÚ_reactorr4   r/   r   ÚResolverr   r"   Ú
lookupZonerF   ÚaddCallbackÚ_cbZoneÚ
addErrbackÚ_ebZone)r   r/   Úresolvers      r   r-   zSecondaryAuthority.transfer›   s™   € ð Ôð 	ØˆFØˆÔà”-ˆØˆ?Ø0Ð0Ð0Ð0Ð0Ð0å”?Ø”l D¤JÐ/Ð0¸'ð
ñ 
ô 
ˆð ×Ò ¤Ñ,Ô,ßŠ[˜œÑ&Ô&ßŠZ˜œÑ%Ô%ð	
r   c                 ó¾   — | j         r| j        s8t          j        t	          j        t          j        |¦  «        ¦  «        ¦  «        S t          j	        | ||||¦  «        S r:   )
ÚsoaÚrecordsr   Úfailr   ÚFailurer
   ÚDomainErrorr   Ú_lookup)r   Únamer#   ÚtypeÚtimeouts        r   r\   zSecondaryAuthority._lookupµ   sV   € ØŒxð 	F˜tœ|ð 	Fõ ”:�gœo­c¬o¸dÑ.CÔ.CÑDÔDÑEÔEÐEÝÔ$ T¨4°°d¸GÑDÔDÐDr   c                 óP  — |\  }}}i x| _         }|D ]“}| j        s@|j        t          j        k    r+|j        j                             ¦   «         |j        f| _        ŒI|                     |j        j                             ¦   «         g ¦  «         	                    |j        ¦  «         Œ”d S r:   )
rX   rW   r^   r
   ÚSOAr]   ÚlowerÚpayloadÚ
setdefaultÚappend)r   ÚzoneÚansÚ_ÚrÚrecs         r   rR   zSecondaryAuthority._cbZone¼   s¦   € Ø‰	ˆˆQ�ØÐˆŒ�qØð 	Lð 	LˆCØ”8ð L ¤­C¬GÒ 3Ð 3ØœHœM×/Ò/Ñ1Ô1°3´;Ð?�”�à—’˜SœXœ]×0Ò0Ñ2Ô2°BÑ7Ô7×>Ò>¸s¼{ÑKÔKÐKÐKð		Lð 	Lr   c                 óx   — t          j        d| j        ›d| j        ›d�¦  «         t          j        |¦  «         d S )Nz	Updating ú from z failed during zone transfer)r   ÚmsgrF   r   Úerr©r   r   s     r   rT   zSecondaryAuthority._ebZoneÅ   sF   € ÝŒˆàŒ{ˆ{ˆ{˜DœL˜L˜Lð*ñ	
ô 	
ð 	
õ 	Œ�ÑÔÐÐÐr   c                 ój   — |                       ¦   «                              | j        | j        ¦  «         d S r:   )r-   ÚaddCallbacksÚ_cbTransferredÚ_ebTransferredr(   s    r   ÚupdatezSecondaryAuthority.updateÌ   s,   € Ø�Š‰Œ×$Ò$ TÔ%8¸$Ô:MÑNÔNÐNÐNÐNr   c                 ó   — d| _         d S )NF)rL   )r   Úresults     r   rr   z!SecondaryAuthority._cbTransferredÏ   s   € Ø!ˆÔÐÐr   c                 ó†   — d| _         t          j        d| j        ›d| j        ›d�¦  «         t          j        |¦  «         d S )NFzTransferring rl   z failed after zone transfer)Útransferredr   rm   rF   r   rn   ro   s     r   rs   z!SecondaryAuthority._ebTransferredÒ   sN   € Ø ˆÔÝŒˆàŒ{ˆ{ˆ{˜DœL˜L˜Lð*ñ	
ô 	
ð 	
õ 	Œ�ÑÔÐÐÐr   r:   )r=   r>   r?   r@   rL   rW   rX   r"   rN   r   rA   r    r-   r\   rR   rT   rt   rr   rs   r   r   r   r   r   `   sÛ   € € € € € ðð ð$ €LØÐ€Cˆ'Ø€EØ€Hð/ð /ð /ð ðð ñ „[ðð*
ð 
ð 
ð4Eð Eð Eð EðLð Lð Lðð ð ðOð Oð Oð"ð "ð "ðð ð ð ð r   N)Ú__all__Útwisted.applicationr   r4   r   r   Útwisted.namesr   r	   r
   r   Útwisted.names.authorityr   Útwisted.pythonr   r   Útwisted.python.compatr   r1   r   r   r   r   r   ú<module>r      s  ðð  Ð!<Ð
=€à 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø .Ð .Ð .Ð .Ð .Ð .ðMð Mð Mð Mð M ¤ñ Mô Mð Mð`xð xð xð xð x˜ñ xô xð xð xð xr   