§
    Ètºf\¿  ã                   ó  — d Z ddlZddlZddlZddlmZmZ ddlmZ ddl	m
Z
 ddlmZmZmZ ddlmZ ddlmZmZmZ dd	lmZmZmZmZmZ dd
lmZ ddlmZmZ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* ddl+m,Z, ddl-m.Z. d„ Z/ G d„ dej0        ¦  «        Z1 ej"        dddddddd¬¦  «        Z2 ej"        ddddd d!d"d#¬¦  «        Z3 ej"        d$d%d&d'dd(d¬)¦  «        Z4 e1de2fe2 ej!        d*¦  «         ej5        d+¦  «         ej6        d,¦  «         ej6        d-d.¦  «         ej7        d/d0¦  «         ej8        d1d2¬3¦  «         ej9        d4¦  «         ej:        d5¦  «         ej;        d6¦  «         ej<        d7d8¦  «         ej=        dd9d:¦  «         ej=        d;d<d=¦  «         ej=        d>d?d@¦  «         ej<        dA¦  «         ej>        dB¦  «         ej?        dCdD¬E¦  «         ej@        ddF¬G¦  «         ejA        dHdI¬J¦  «         ejB        dKejC        dL¦  «         ejD        dd/dMdNdO¦  «         ejE        dP¦  «        g ejF        dQdRdSdT¦  «        g ej!        dU¦  «         ej!        dV¦  «        g ej!        dW¦  «         ej!        dX¦  «        g ej9        d¦  «        g ej!        dY¦  «        gdZœ¬[¦  «        ZG e1de3fd\ ejH        d]¦  «        e3gi¬[¦  «        ZI e1d^e4fd^e4 ej!        dYd_¬`¦  «         ej5        dadb¬`¦  «         ej5        dcdd¬`¦  «         ejF        dQdRdSdTde¬`¦  «        gi¬[¦  «        ZJ G df„ dge.jK        ¦  «        ZL G dh„ die.jK        ¦  «        ZM G dj„ dke.jK        ¦  «        ZN G dl„ dme.jK        ¦  «        ZO G dn„ doe.jK        ¦  «        ZP G dp„ dqe.jK        ¦  «        ZQ G dr„ dse.jK        ¦  «        ZR G dt„ due.jK        ¦  «        ZS G dv„ dwe.jK        ¦  «        ZTdxZU G dy„ dze.jK        ¦  «        ZVd{ZW G d|„ d}e.jK        ¦  «        ZXdS )~z
Test cases for twisted.names.
é    N)ÚpartialÚreduce)ÚBytesIO)Úpack)ÚdeferÚerrorÚreactor)Úsucceed)ÚMemoryReactorClockÚStringTransportÚwaitUntilAllDisconnected)Ú	authorityÚclientÚcommonÚdnsÚserver)ÚResolver)ÚSOAÚMessageÚQueryÚRecord_AÚ
Record_SOAÚRRHeader)ÚDomainError)ÚSecondaryAuthorityÚSecondaryAuthorityService)ÚnativeString)ÚFilePath)Úunittestc                 ó&   — d„ | d         D ¦   «         S )Nc                 ó   — g | ]	}|j         ‘Œ
S © ©Úpayload©Ú.0Úrs     ú\/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/names/test/test_names.pyú
<listcomp>zjustPayload.<locals>.<listcomp>"   s   € Ð*Ð*Ð*˜!ˆAŒIÐ*Ð*Ð*ó    r   r"   ©Úresultss    r(   ÚjustPayloadr-   !   s   € Ø*Ð*˜w qœzÐ*Ñ*Ô*Ð*r*   c                   ó   — e Zd Zd„ ZdS )ÚNoFileAuthorityc                 ób   — t           j                             | ¦  «         ||c| _        | _        d S ©N)r   ÚResolverBaseÚ__init__ÚsoaÚrecords)Úselfr4   r5   s      r(   r3   zNoFileAuthority.__init__&   s-   € åÔ×$Ò$ TÑ*Ô*Ð*Ø!$ gÐˆŒ�$”,�,�,r*   N)Ú__name__Ú
__module__Ú__qualname__r3   r"   r*   r(   r/   r/   %   s#   € € € € € ð.ð .ð .ð .ð .r*   r/   ó   test-domain.comzroot.test-domain.coméd   éÒ  iæ  éH?&é   é   ©ÚmnameÚrnameÚserialÚrefreshÚminimumÚexpireÚretryÚttls   93.84.28.in-addr.arpaéx   i1Ô  i~  éÎª é   é   úmy-domain.coms   postmaster.test-domain.comé‚   i90  i?B )rA   rB   rC   rD   rE   rF   rG   s	   127.0.0.1s   39.28.189.39ó#   v=spf1 mx/30 mx:example.org/30 -alló   v=spf1 +mx a: coloó   .example.com/28 -all not validé
   úhost.test-domain.comó   Linuxó   A Fast One, Dontcha know)ÚosÚcpus   canonical.name.coms   mailbox.test-domain.coms   mail.group.someplaceó   A First piece of Textó   a SecoNd pieces
   ABCD::4321r*   é   s	   0:0069::0s   some.network.tldé   s$   0:5634:1294:AFCB:56AC:48EF:34C3:01FFs   tra.la.la.netó+   Some more text, haha!  Yes.     Still here?s   mail.redirect.or.whatevers
   r mail boxs
   e mail box)ÚrmailbxÚemailbxs   afsdb.test-domain.com)ÚsubtypeÚhostnames   whatever.i.dunnos   some.more.text)ÚmboxÚtxts   12.54.78.12ó   þÁ ó   uó   sip+E2Uó!   !^.*$!sip:information@domain.tld!s'   AF43:5634:1294:AFCB:56AC:48EF:34C3:01FFé  éÿ?  éªª  s   some.other.place.fooló   123.242.1.5ó   0.255.0.255s   255.255.255.254s   0.0.0.0s   1.2.3.4)r:   s   http.tcp.test-domain.comó   host.test-domain.coms   host-two.test-domain.coms   cname.test-domain.coms   anothertest-domain.com©r4   r5   s   123.93.84.28.in-addr.arpas   test.host-reverse.lookup.coms   my-domain.comÚ1S©rH   s
   ns1.domains   2Ms
   ns2.domainÚ3HÚ4Dc                   óÀ   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z dS ) ÚServerDNSTestsz/
    Test cases for DNS server and client.
    c                 ó  — t          j        t          t          t          gd¬¦  «        | _        t          j        | j        ¦  «        }	 t          j	        d| j        d¬¦  «        }|  
                    |j        ¦  «         |                     ¦   «         j        }	 t          j        ||d¬¦  «        }|  
                    |j        ¦  «         n# t          j        $ r Y nw xY wŒ˜|| _        || _        t'          j        d|fg¬¦  «        | _        d S )Né   )Úverboser?   r   ú	127.0.0.1)Ú	interface©Úservers)r   ÚDNSServerFactoryÚtest_domain_comÚreverse_domainÚmy_domain_comÚfactoryr   ÚDNSDatagramProtocolr	   Ú	listenTCPÚ
addCleanupÚstopListeningÚgetHostÚportÚ	listenUDPr   ÚCannotListenErrorÚlistenerTCPÚlistenerUDPr   r   Úresolver)r6   Úprˆ   r…   r‰   s        r(   ÚsetUpzServerDNSTests.setUp�   s  € ÝÔ.Ý�n­mÐ<Àað
ñ 
ô 
ˆŒõ Ô# D¤LÑ1Ô1ˆð	Ý!Ô+¨A¨t¬|À{ÐSÑSÔSˆKð �OŠO˜KÔ5Ñ6Ô6Ð6Ø×&Ò&Ñ(Ô(Ô-ˆDðÝ%Ô/°°aÀ;ÐOÑOÔO�ð —’ Ô 9Ñ:Ô:Ð:Øøõ	 Ô*ð ð ð Ø�ðøøøð	ð& 'ˆÔØ&ˆÔÝœ°+¸tÐ1DÐ0EÐFÑFÔFˆŒˆˆs   ÂC
 Ã
CÃCc                 ó°   — | j         j        dd…         D ]}|j                             ¦   «          Œt	          t
          | j         j        dd…         ¦  «        S )zu
        Clean up any server connections associated with the
        L{DNSServerFactory} created in L{setUp}
        N)r   ÚconnectionsÚ	transportÚloseConnectionr   r	   )r6   Úconns     r(   ÚtearDownzServerDNSTests.tearDown»   sV   € ð ”LÔ,¨Q¨Q¨QÔ/ð 	,ð 	,ˆDØŒN×)Ò)Ñ+Ô+Ð+Ð+å'­°´Ô1IÈ!È!È!Ô1LÑMÔMÐMr*   c                 ó@   ‡ ‡— ˆˆ fd„}|                      |¦  «         |S )aD  
        Assert that the DNS response C{querying} will eventually fire with
        contains exactly a certain collection of records.

        @param querying: A L{Deferred} returned from one of the DNS client
            I{lookup} methods.

        @param expectedRecords: A L{list} of L{IRecord} providers which must be
            in the response or the test will be failed.

        @return: A L{Deferred} that fires when the assertion has been made.  It
            fires with a success result if the assertion succeeds and with a
            L{Failure} if it fails.
        c                 ó†   •— t          | ¦  «        }‰                     t          ‰¦  «        t          |¦  «        ¦  «         d S r1   )r-   ÚassertEqualÚset)ÚresponseÚreceivedRecordsÚexpectedRecordsr6   s     €€r(   ÚcheckResultsz.ServerDNSTests.namesTest.<locals>.checkResultsØ   s<   ø€ Ý)¨(Ñ3Ô3ˆOØ×Ò�S Ñ1Ô1µ3°Ñ3GÔ3GÑHÔHÐHÐHÐHr*   )ÚaddCallback)r6   Úqueryingr™   rš   s   ` ` r(   Ú	namesTestzServerDNSTests.namesTestÈ   sC   øø€ ð 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	×Ò˜\Ñ*Ô*Ð*Øˆr*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )z"Test simple DNS 'A' record queriesútest-domain.comrw   r=   ro   ©r�   rŠ   ÚlookupAddressr   r   ©r6   s    r(   Útest_addressRecord1z"ServerDNSTests.test_addressRecord1ß   sA   € à�~Š~ØŒM×'Ò'Ð(9Ñ:Ô:ÝŒ\˜+¨8Ð4Ñ4Ô4Ð5ñ
ô 
ð 	
r*   c                 ó²   — |                       | j                             d¦  «        t          j        dd¬¦  «        t          j        dd¬¦  «        g¦  «        S )z1Test DNS 'A' record queries with multiple answersrS   z123.242.1.5r=   ro   z0.255.0.255r    r¢   s    r(   Útest_addressRecord2z"ServerDNSTests.test_addressRecord2æ   sU   € à�~Š~ØŒM×'Ò'Ð(>Ñ?Ô?å”˜]°Ð9Ñ9Ô9Ý”˜]°Ð9Ñ9Ô9ðñ
ô 
ð 	
r*   c                 ó²   — |                       | j                             d¦  «        t          j        dd¬¦  «        t          j        dd¬¦  «        g¦  «        S )z+Test DNS 'A' record queries with edge caseszhost-two.test-domain.comz255.255.255.254r=   ro   ú0.0.0.0r    r¢   s    r(   Útest_addressRecord3z"ServerDNSTests.test_addressRecord3ð   sV   € à�~Š~ØŒM×'Ò'Ð(BÑCÔCå”Ð.°HÐ=Ñ=Ô=Ý”˜Y¨HÐ5Ñ5Ô5ðñ
ô 
ð 	
r*   c                 ój   — |                       | j                             d¦  «        t          g¦  «        S )zTest DNS 'SOA' record queriesrŸ   )r�   rŠ   ÚlookupAuthorityÚ
soa_recordr¢   s    r(   Útest_authorityzServerDNSTests.test_authorityú   s0   € à�~Š~ØŒM×)Ò)Ð*;Ñ<Ô<½z¸lñ
ô 
ð 	
r*   c           	      óÞ   — |                       | j                             d¦  «        t          j        ddd¬¦  «        t          j        dd¬¦  «        t          j        dd¬¦  «        g¦  «        S )z‹
        The DNS client can issue an MX query and receive a response including
        an MX record as well as any A record hints.
        r:   rR   rl   r=   ro   rj   rk   )r�   rŠ   ÚlookupMailExchanger   Ú	Record_MXr   r¢   s    r(   Útest_mailExchangeRecordz&ServerDNSTests.test_mailExchangeRecord   sl   € ð
 �~Š~ØŒM×,Ò,Ð-?Ñ@Ô@å”˜bÐ"9¸xÐHÑHÔHÝ”˜^°Ð:Ñ:Ô:Ý”˜^°Ð:Ñ:Ô:ðñ
ô 
ð 	
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )zTest DNS 'NS' record queriesrŸ   z39.28.189.39r=   ro   )r�   rŠ   ÚlookupNameserversr   Ú	Record_NSr¢   s    r(   Útest_nameserverzServerDNSTests.test_nameserver  sA   € à�~Š~ØŒM×+Ò+Ð,=Ñ>Ô>ÝŒ]˜>¨xÐ8Ñ8Ô8Ð9ñ
ô 
ð 	
r*   c                 óŠ   — |                       | j                             d¦  «        t          j        ddd¬¦  «        g¦  «        S )zTest DNS 'HINFO' record queriesrŸ   rT   rU   r=   )rV   rW   rH   )r�   rŠ   ÚlookupHostInfor   ÚRecord_HINFOr¢   s    r(   Ú
test_HINFOzServerDNSTests.test_HINFO  sN   € à�~Š~ØŒM×(Ò(Ð):Ñ;Ô;åÔ ØÐ%@Àhðñ ô ðñ
ô 
ð 	
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )zTest DNS 'PTR' record queriesz123.93.84.28.in-addr.arpaztest.host-reverse.lookup.comrJ   ro   )r�   rŠ   ÚlookupPointerr   Ú
Record_PTRr¢   s    r(   Útest_PTRzServerDNSTests.test_PTR   sB   € à�~Š~ØŒM×'Ò'Ð(CÑDÔDÝŒ^Ð:ÀÐIÑIÔIÐJñ
ô 
ð 	
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )zTest DNS 'CNAME' record queriesrŸ   zcanonical.name.comr=   ro   )r�   rŠ   ÚlookupCanonicalNamer   ÚRecord_CNAMEr¢   s    r(   Ú
test_CNAMEzServerDNSTests.test_CNAME'  sC   € à�~Š~ØŒM×-Ò-Ð.?Ñ@Ô@ÝÔÐ2¸ÐAÑAÔAÐBñ
ô 
ð 	
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )zTest DNS 'MB' record queriesrŸ   zmailbox.test-domain.comr=   ro   )r�   rŠ   ÚlookupMailBoxr   Ú	Record_MBr¢   s    r(   Útest_MBzServerDNSTests.test_MB.  sB   € à�~Š~ØŒM×'Ò'Ð(9Ñ:Ô:ÝŒ]Ð4¸(ÐCÑCÔCÐDñ
ô 
ð 	
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )zTest DNS 'MG' record queriesrŸ   zmail.group.someplacer=   ro   )r�   rŠ   ÚlookupMailGroupr   Ú	Record_MGr¢   s    r(   Útest_MGzServerDNSTests.test_MG5  sB   € à�~Š~ØŒM×)Ò)Ð*;Ñ<Ô<ÝŒ]Ð1°xÐ@Ñ@Ô@ÐAñ
ô 
ð 	
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )zTest DNS 'MR' record queriesrŸ   zmail.redirect.or.whateverr=   ro   )r�   rŠ   ÚlookupMailRenamer   Ú	Record_MRr¢   s    r(   Útest_MRzServerDNSTests.test_MR<  sB   € à�~Š~ØŒM×*Ò*Ð+<Ñ=Ô=ÝŒ]Ð6¸HÐEÑEÔEÐFñ
ô 
ð 	
r*   c                 óŠ   — |                       | j                             d¦  «        t          j        ddd¬¦  «        g¦  «        S )zTest DNS 'MINFO' record queriesrŸ   z
r mail boxz
e mail boxr=   )r]   r^   rH   )r�   rŠ   ÚlookupMailboxInfor   ÚRecord_MINFOr¢   s    r(   Ú
test_MINFOzServerDNSTests.test_MINFOC  sM   € à�~Š~ØŒM×+Ò+Ð,=Ñ>Ô>åÔ Ø(°,ÀHðñ ô ðñ
ô 
ð 	
r*   c           
      óŽ   — |                       | j                             d¦  «        t          j        ddddd¬¦  «        g¦  «        S )zTest DNS 'SRV' record querieszhttp.tcp.test-domain.comrg   rh   ri   úsome.other.place.foolr=   ro   )r�   rŠ   ÚlookupServicer   Ú
Record_SRVr¢   s    r(   Útest_SRVzServerDNSTests.test_SRVN  sH   € à�~Š~ØŒM×'Ò'Ð(BÑCÔCÝŒ^˜C ¨Ð/FÈHÐUÑUÔUÐVñ
ô 
ð 	
r*   c                 óŠ   — |                       | j                             d¦  «        t          j        ddd¬¦  «        g¦  «        S )zTest DNS 'AFSDB' record queriesrŸ   r?   zafsdb.test-domain.comr=   )r_   r`   rH   )r�   rŠ   ÚlookupAFSDatabaser   ÚRecord_AFSDBr¢   s    r(   Ú
test_AFSDBzServerDNSTests.test_AFSDBU  sN   € à�~Š~ØŒM×+Ò+Ð,=Ñ>Ô>åÔ ØÐ(?ÀXðñ ô ðñ
ô 
ð 	
r*   c                 óŠ   — |                       | j                             d¦  «        t          j        ddd¬¦  «        g¦  «        S )zTest DNS 'RP' record queriesrŸ   zwhatever.i.dunnozsome.more.textr=   )ra   rb   rH   )r�   rŠ   ÚlookupResponsibilityr   Ú	Record_RPr¢   s    r(   Útest_RPzServerDNSTests.test_RP`  sM   € à�~Š~ØŒM×.Ò.Ð/@ÑAÔAå”Ø+Ð1AÀxðñ ô ðñ
ô 
ð 	
r*   c                 ó´   — |                       | j                             d¦  «        t          j        ddd¬¦  «        t          j        dd¬¦  «        g¦  «        S )zTest DNS 'TXT' record queriesrŸ   rX   rY   r=   ro   r\   )r�   rŠ   Ú
lookupTextr   Ú
Record_TXTr¢   s    r(   Útest_TXTzServerDNSTests.test_TXTk  sh   € à�~Š~ØŒM×$Ò$Ð%6Ñ7Ô7å”Ø,Ð.?ÀXðñ ô õ ”ØCÈðñ ô ð	ñ

ô 

ð 
	
r*   c           	      ó´   — |                       | j                             d¦  «        t          j        dd¬¦  «        t          j        ddd¬¦  «        g¦  «        S )zH
        L{DNSServerFactory} can serve I{SPF} resource records.
        rŸ   rO   r=   ro   rP   rQ   )r�   rŠ   ÚlookupSenderPolicyr   Ú
Record_SPFr¢   s    r(   Útest_spfzServerDNSTests.test_spfy  sc   € ð �~Š~ØŒM×,Ò,Ð->Ñ?Ô?å”ÐEÈ8ÐTÑTÔTÝ”Ø*Ø5Ø ðñ ô ðñ

ô 

ð 
	
r*   c           	      ó    — |                       | j                             d¦  «        t          j        dt
          j        dd¬¦  «        g¦  «        S )zTest DNS 'WKS' record queriesrŸ   z12.54.78.12rc   r=   ro   )r�   rŠ   ÚlookupWellKnownServicesr   Ú
Record_WKSÚsocketÚIPPROTO_TCPr¢   s    r(   Útest_WKSzServerDNSTests.test_WKS‰  sT   € à�~Š~ØŒM×1Ò1Ð2CÑDÔDå”Ø!ÝÔ&Ø3Ø ð	ñ ô ðñ

ô 

ð 
	
r*   c                 ób  — t          j         t          ¦  «        }t          j        |_        |                      | j                             d¦  «        |t          j        dd¬¦  «        t          j	        dd¬¦  «        t          j	        dd¬¦  «        t          j
        d	d
ddd¬¦  «        g¦  «        S )NrM   ú1.2.3.4rn   ro   z
ns1.domainÚ2Mz
ns2.domainrp   rg   rh   ri   rÒ   rq   )ÚcopyÚmy_soarF   rH   r�   rŠ   ÚlookupAllRecordsr   r   r³   rÔ   )r6   Ú
result_soas     r(   Útest_someRecordsWithTTLsz'ServerDNSTests.test_someRecordsWithTTLs—  sš   € Ý”Y�vÑ&Ô&ˆ
Ýœˆ
ŒØ�~Š~ØŒM×*Ò*¨?Ñ;Ô;àÝ”˜Y¨DÐ1Ñ1Ô1Ý”˜l°Ð5Ñ5Ô5Ý”˜l°Ð5Ñ5Ô5Ý”˜s E¨5Ð2IÈtÐTÑTÔTðñ	
ô 	
ð 		
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )z%Test DNS 'AAAA' record queries (IPv6)rŸ   z'AF43:5634:1294:AFCB:56AC:48EF:34C3:01FFr=   ro   )r�   rŠ   ÚlookupIPV6Addressr   ÚRecord_AAAAr¢   s    r(   Ú	test_AAAAzServerDNSTests.test_AAAA¥  sB   € à�~Š~ØŒM×+Ò+Ð,=Ñ>Ô>ÝŒ_ÐFÈHÐUÑUÔUÐVñ
ô 
ð 	
r*   c                 óè   — |                       | j                             d¦  «        t          j        dddd¬¦  «        t          j        ddd	d¬¦  «        t          j        d
ddd¬¦  «        g¦  «        S )z#Test DNS 'A6' record queries (IPv6)rŸ   r   z
ABCD::4321Ú r=   ro   rZ   z	0:0069::0zsome.network.tldr[   z$0:5634:1294:AFCB:56AC:48EF:34C3:01FFztra.la.la.net)r�   rŠ   ÚlookupAddress6r   Ú	Record_A6r¢   s    r(   Útest_A6zServerDNSTests.test_A6¬  s~   € à�~Š~ØŒM×(Ò(Ð):Ñ;Ô;å”˜a ¨r°xÐ@Ñ@Ô@Ý”˜b +Ð/AÀxÐPÑPÔPÝ”ØØ:Ø#Ø ð	ñ ô ð	ñ
ô 
ð 	
r*   c                 óD  — t           j        }d„ t          t          j        t
          j                             ¦   «         ¦  «        D ¦   «         }|D ]}|j        €||_        Œ|  	                    | j
                             d¦  «                             d„ ¦  «        |¦  «        S )z9
        Test DNS 'AXFR' queries (Zone transfer)
        c                 ó6   — g | ]}t          j         |¦  «        ‘ŒS r"   )rï   r%   s     r(   r)   z4ServerDNSTests.test_zoneTransfer.<locals>.<listcomp>Á  s-   € ð 
ð 
ð 
Ø�DŒI�a‰LŒLð
ð 
ð 
r*   NrŸ   c                 ó$   — | d         d d…         fS )Nr   éÿÿÿÿr"   )r'   s    r(   ú<lambda>z2ServerDNSTests.test_zoneTransfer.<locals>.<lambda>É  s   € ˜1˜Qœ4   œ9˜,€ r*   )r«   rF   r   ÚoperatorÚaddr|   r5   ÚvaluesrH   r�   rŠ   Ú
lookupZoner›   )r6   Údefault_ttlr,   r'   s       r(   Útest_zoneTransferz ServerDNSTests.test_zoneTransfer¼  sª   € õ !Ô'ˆð
ð 
Ý"(­¬µÔ7N×7UÒ7UÑ7WÔ7WÑ"XÔ"Xð
ñ 
ô 
ˆð ð 	$ð 	$ˆAØŒuˆ}Ø#�”øØ�~Š~ØŒM×$Ò$Ð%6Ñ7Ô7×CÒCØ&Ð&ñô ð ñ	
ô 
ð 	
r*   c                 óŠ   — t          dg¬¦  «        }|                      |                     d¦  «        t          j        ¦  «        S )zu
        A failed AXFR TCP connection errbacks the L{Deferred} returned
        from L{Resolver.lookupZone}.
        )znameserver.invalidé5   ry   zimpossible.invalid)r   ÚassertFailurer  r   ÚDNSLookupError)r6   rŠ   s     r(   Ú test_zoneTransferConnectionFailsz/ServerDNSTests.test_zoneTransferConnectionFailsÎ  sG   € õ
 Ð%?Ð$@ÐAÑAÔAˆØ×!Ò!Ø×ÒÐ 4Ñ5Ô5µuÔ7Kñ
ô 
ð 	
r*   c                 óˆ   — |                       | j                             d¦  «        t          j        dd¬¦  «        g¦  «        S )z6Tests that unrelated zones don't mess with each other.zanothertest-domain.comrí   r=   ro   r    r¢   s    r(   Útest_similarZonesDontInterferez-ServerDNSTests.test_similarZonesDontInterfereØ  sA   € à�~Š~ØŒM×'Ò'Ð(@ÑAÔAÝŒ\˜)¨Ð2Ñ2Ô2Ð3ñ
ô 
ð 	
r*   c                 ó�   — |                       | j                             d¦  «        t          j        dddddd¬¦  «        g¦  «        S )	z2
        Test DNS 'NAPTR' record queries.
        rŸ   r;   rR   rd   re   rf   r=   ro   )r�   rŠ   ÚlookupNamingAuthorityPointerr   ÚRecord_NAPTRr¢   s    r(   Ú
test_NAPTRzServerDNSTests.test_NAPTRß  sZ   € ð �~Š~ØŒM×6Ò6Ð7HÑIÔIåÔ ØØØØØ8Ø ðñ ô ð	ñ
ô 
ð 	
r*   N)!r7   r8   r9   Ú__doc__rŒ   r’   r�   r£   r¥   r¨   r¬   r°   r´   r¸   r¼   rÀ   rÄ   rÈ   rÌ   rÐ   rÕ   rÙ   rÝ   rá   rå   rë   ró   r÷   rü   r  r  r  r  r"   r*   r(   rs   rs   ˜   s×  € € € € € ðð ðGð Gð Gð<Nð Nð Nðð ð ð.
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð	
ð 	
ð 	
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð	
ð 	
ð 	
ð
ð 
ð 
ð	
ð 	
ð 	
ð	
ð 	
ð 	
ð
ð 
ð 
ð
ð 
ð 
ð 
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð 
ð 
ð 
ð$
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ð 
ð 
r*   rs   c                   ó   — e Zd Zd„ ZdS )ÚHelperTestsc                 óØ   — |                       ¦   «         }t          j        |¦  «        }t          d¦  «        D ]1}t          j        |¦  «        }|                      ||k     ¦  «         |}Œ2d S )Né   )Úmktempr   Ú	getSerialÚrangeÚ
assertTrue)r6   ÚfÚaÚiÚbs        r(   Útest_serialGeneratorz HelperTests.test_serialGeneratoró  sk   € Ø�KŠK‰MŒMˆÝÔ Ñ"Ô"ˆÝ�r‘”ð 	ð 	ˆAÝÔ# AÑ&Ô&ˆAØ�OŠO˜A šEÑ"Ô"Ð"ØˆAˆAð	ð 	r*   N)r7   r8   r9   r   r"   r*   r(   r  r  ò  s#   € € € € € ðð ð ð ð r*   r  c                   ó,   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )Ú	AXFRTestsc                 ó  — d | _         t          j        ¦   «         | _        | j                             | j        ¦  «         t          j        d| j        ¦  «        | _        t          j
        dt          j        t          j        ddt          j        ddddddd	d
¬¦  «        ¬¦  «        | _        | j        t          j
        dt          j        t          j        ddt          j        dd¬¦  «        ¬¦  «        t          j
        dt          j        t          j        ddt          j        ddd¬¦  «        ¬¦  «        t          j
        dt          j        t          j        ddt          j        dd¬¦  «        ¬¦  «        | j        g| _        d S )Nú	fooby.comi€Q Fzhooj.fooby.comr;   éÈ   i,  i�  iô  iX  )rA   rB   rC   rD   rG   rF   rE   rH   ©ÚnameÚtypeÚclsrH   Úauthr$   é¼  úns.twistedmatrix.com©r'  rH   rR   zmail.mv3d.com)Ú
preferenceÚexchangerH   z64.123.27.105)ÚaddressrH   )r,   r   ÚDeferredÚdr›   Ú_gotResultsr   ÚAXFRControllerÚ
controllerr   r   r   ÚINr   r4   ÚNSr³   ÚMXr¯   ÚAr   r5   r¢   s    r(   rŒ   zAXFRTests.setUpý  sl  € ØˆŒÝ”Ñ!Ô!ˆŒØŒ×Ò˜4Ô+Ñ,Ô,Ð,Ý Ô/°¸T¼VÑDÔDˆŒå”<ØÝ”Ý”ØØÝ”NØ!Ø&ØØØØØØð	ñ 	ô 	ð
ñ 
ô 
ˆŒð& ŒHÝŒLØ Ý”VÝ”FØØÝœÐ+AÀsÐKÑKÔKðñ ô õ ŒLØ Ý”VÝ”FØØÝœ°¸oÐSVÐWÑWÔWðñ ô õ ŒLØ Ý”UÝ”FØØÝœ¨_À#ÐFÑFÔFðñ ô ð ŒHð5
ˆŒˆˆr*   c                 ó<   — t          j        ddddddddd¬¦	  «	        S )Néç  r?   r   ©	ÚidÚanswerÚopCodeÚrecDesÚrecAvr*  ÚrCodeÚtruncÚmaxSize)r   r   r¢   s    r(   Ú_makeMessagezAXFRTests._makeMessage2  s6   € åŒ{ØØØØØØØØØð

ñ 

ô 

ð 
	
r*   c                 ó  — |                       ¦   «         }t          j        dt          j        t          j        ¦  «        g|_        | j        |_        | j         	                    |d ¦  «         |  
                    | j        | j        ¦  «         d S )Nr$  )rE  r   r   ÚAXFRr6  Úqueriesr5   Úanswersr5  ÚmessageReceivedr•   r,   )r6   Úms     r(   Útest_bindAndTNamesStylez!AXFRTests.test_bindAndTNamesStyle@  sp   € à×ÒÑÔˆÝ”Y˜{­C¬Hµc´fÑ=Ô=Ð>ˆŒ	Ø”LˆŒ	ØŒ×'Ò'¨¨4Ñ0Ô0Ð0Ø×Ò˜œ t¤|Ñ4Ô4Ð4Ð4Ð4r*   c                 ó   — || _         d S r1   r+   )r6   Úresults     r(   r3  zAXFRTests._gotResultsH  s   € ØˆŒˆˆr*   c                 ó  — | j         d d …         }|rS|                      ¦   «         }g |_        |                     d¦  «        g|_        | j                             |d ¦  «         |°S|                      | j        | j         ¦  «         d S ©Nr   )	r5   rE  rH  ÚpoprI  r5  rJ  r•   r,   )r6   r5   rK  s      r(   Útest_DJBStylezAXFRTests.test_DJBStyleK  s‰   € à”,˜q˜q˜q”/ˆØð 	5Ø×!Ò!Ñ#Ô#ˆAØˆAŒIØ Ÿš Q™œÐ(ˆAŒIØŒO×+Ò+¨A¨tÑ4Ô4Ð4ð	 ð 	5ð
 	×Ò˜œ t¤|Ñ4Ô4Ð4Ð4Ð4r*   N)r7   r8   r9   rŒ   rE  rL  r3  rR  r"   r*   r(   r"  r"  ü  s`   € € € € € ð3
ð 3
ð 3
ðj
ð 
ð 
ð5ð 5ð 5ðð ð ð5ð 5ð 5ð 5ð 5r*   r"  c                   ó   — e Zd Zd„ Zd„ ZdS )ÚResolvConfHandlingTestsc                 óÂ   — |                       ¦   «         }t          j        |¬¦  «        }|                      |j        dg¦  «         |j                             ¦   «          d S )N©Úresolv©rw   r	  )r  r   r   r•   Ú
dynServersÚ
_parseCallÚcancel©r6   Ú
resolvConfr'   s      r(   Útest_missingz$ResolvConfHandlingTests.test_missingW  sW   € Ø—[’[‘]”]ˆ
ÝŒO :Ð.Ñ.Ô.ˆØ×Ò˜œÐ(9Ð':Ñ;Ô;Ð;Ø	Œ×ÒÑÔÐÐÐr*   c                 ó  — |                       ¦   «         }t          |d¦  «                             ¦   «          t          j        |¬¦  «        }|                      |j        dg¦  «         |j                             ¦   «          d S )NÚwrV  rX  )	r  ÚopenÚcloser   r   r•   rY  rZ  r[  r\  s      r(   Ú
test_emptyz"ResolvConfHandlingTests.test_empty]  ss   € Ø—[’[‘]”]ˆ
ÝˆZ˜ÑÔ×#Ò#Ñ%Ô%Ð%ÝŒO :Ð.Ñ.Ô.ˆØ×Ò˜œÐ(9Ð':Ñ;Ô;Ð;Ø	Œ×ÒÑÔÐÐÐr*   N)r7   r8   r9   r^  rc  r"   r*   r(   rT  rT  V  s2   € € € € € ðð ð ðð ð ð ð r*   rT  c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚAuthorityTestszs
    Tests for the basic response record selection code in L{FileAuthority}
    (independent of its fileness).
    c                 óÄ   — t           }d|j        d         z   }|                      |                     |¦  «        ¦  «        }|                      |j        t          ¦  «         dS )aJ  
        L{FileAuthority} lookup methods errback with L{DomainError} if
        the requested C{name} shares a common suffix with its zone but
        is not actually a descendant of its zone, in terms of its
        sequence of DNS name labels. eg www.the-example.com has
        nothing to do with the zone example.com.
        ó   nonexistent.prefix-r   N)r|   r4   ÚfailureResultOfr¡   ÚassertIsInstanceÚvaluer   )r6   Ú
testDomainÚtestDomainNamer  s       r(   Ú'test_domainErrorForNameWithCommonSuffixz6AuthorityTests.test_domainErrorForNameWithCommonSuffixk  sY   € õ %ˆ
Ø/°*´.ÀÔ2CÑCˆØ× Ò  ×!9Ò!9¸.Ñ!IÔ!IÑJÔJˆØ×Ò˜aœg¥{Ñ3Ô3Ð3Ð3Ð3r*   c           
      ó  — t          t          j        j        t          ft          j        j        t          t	          j        d¦  «        gi¬¦  «        }|                       |j        t          j        j        ¦  «        ¦  «        \  }}}|                      |g ¦  «         |                      |t	          j	        t          j        j        t          j
        t          j        t          d¬¦  «        g¦  «         |                      |g ¦  «         dS )a!  
        If a L{FileAuthority} has a zone which includes an I{NS} record for a
        particular name and that authority is asked for another record for the
        same name which does not exist, the I{NS} record is not included in the
        authority section of the response.
        rí   rm   T©rH   r$   r*  N)r/   r«   rA   r'  r   r³   ÚsuccessResultOfr¡   r•   r   ÚTYPErF   )r6   r   r>  Ú
additionals       r(   Útest_recordMissingz!AuthorityTests.test_recordMissingx  s  € õ $ÝÔ!Ô&­
Ð3åÔ Ô%ÝÝ”M )Ñ,Ô,ð(ðð
ñ 
ô 
ˆ	ð )-×(<Ò(<Ø#ˆIÔ#¥JÔ$4Ô$9Ñ:Ô:ñ)
ô )
Ñ%ˆ�	˜:ð 	×Ò˜ Ñ$Ô$Ð$Ø×ÒØå”ÝÔ$Ô)Ý”OÝ"Ô)Ý&Øðñ ô ðñ	
ô 	
ð 	
ð 	×Ò˜ RÑ(Ô(Ð(Ð(Ð(r*   c                 ó  — t           }d|j        d         z   }t          t          j        ¦  «        dz   }|                      |                     t          ||¬¦  «        ¦  «        ¦  «        }|                      |j	        t          ¦  «         dS )zˆ
        Requesting a record of unknown type where no records exist for the name
        in question results in L{DomainError}.
        rg  r   r?   ©r'  r(  N)r|   r4   Úmaxr   ÚtypeToMethodrh  Úqueryr   ri  rj  r   )r6   rk  rl  ÚunknownTyper  s        r(   Útest_unknownTypeNXDOMAINz'AuthorityTests.test_unknownTypeNXDOMAINš  s‚   € õ
 %ˆ
Ø/°*´.ÀÔ2CÑCˆÝ�&Ô-Ñ.Ô.°Ñ2ˆØ× Ò Ø×Ò�U¨¸[ÐIÑIÔIÑJÔJñ
ô 
ˆð 	×Ò˜aœg¥{Ñ3Ô3Ð3Ð3Ð3r*   c                 óê   — t          t          j        ¦  «        dz   }|                      t                               t          d|¬¦  «        ¦  «        ¦  «        \  }}}|                      |g ¦  «         dS )z�
        Requesting a record of unknown type where other records exist for the
        name in question results in an empty answer set.
        r?   rM   ru  N)rv  r   rw  rp  r~   rx  r   r•   )r6   ry  r>  r   rr  s        r(   Útest_unknownTypeMissingz&AuthorityTests.test_unknownTypeMissing§  sq   € õ
 �&Ô-Ñ.Ô.°Ñ2ˆØ(,×(<Ò(<Ý×Ò¥¨?ÀÐ MÑ MÔ MÑNÔNñ)
ô )
Ñ%ˆ�	˜:ð 	×Ò˜ Ñ$Ô$Ð$Ð$Ð$r*   c           
      óê  — dt           j        j        z   }t          j        d¦  «        }t          t           j        j        t           f||gi¬¦  «        } t          ||¦  «        |¦  «        }|                      |¦  «        \  }}}|                      |g ¦  «         |                      |t          j	        |t          j
        t           j        |d¬¦  «        g¦  «         |                      |g ¦  «         dS )zï
        Create an authority and make a request against it.  Then verify that the
        result is a referral, including no records in the answers or additional
        sections, but with an I{NS} record in the authority section.
        s   example.rí   rm   Fro  N)r«   rA   r'  r   r³   r/   Úgetattrrp  r•   r   r7  rF   )r6   ÚmethodÚ	subdomainÚ
nameserverr   r2  r>  rr  s           r(   Ú_referralTestzAuthorityTests._referralTest²  s  € ð  ¥*Ô"2Ô"7Ñ7ˆ	Ý”] 9Ñ-Ô-ˆ
Ý#ÝÔ!Ô&­
Ð3àØððð
ñ 
ô 
ˆ	ð '�G�I˜vÑ&Ô& yÑ1Ô1ˆØ(,×(<Ò(<¸QÑ(?Ô(?Ñ%ˆ�	˜:Ø×Ò˜ Ñ$Ô$Ð$Ø×ÒØå”ØÝ”FÝ"Ô)Ø&Øðñ ô ðñ	
ô 	
ð 	
ð 	×Ò˜ RÑ(Ô(Ð(Ð(Ð(r*   c                 ó0   — |                       d¦  «         dS )a  
        When an I{NS} record is found for a child zone, it is included in the
        authority section of the response. It is marked as non-authoritative if
        the authority is not also authoritative for the child zone (RFC 2181,
        section 6.1).
        r¡   N©r‚  r¢   s    r(   Útest_referralzAuthorityTests.test_referralÓ  s   € ð 	×Ò˜?Ñ+Ô+Ð+Ð+Ð+r*   c                 ó0   — |                       d¦  «         dS )zT
        A referral is also generated for a request of type C{ALL_RECORDS}.
        rñ   Nr„  r¢   s    r(   Útest_allRecordsReferralz&AuthorityTests.test_allRecordsReferralÜ  s   € ð 	×ÒÐ-Ñ.Ô.Ð.Ð.Ð.r*   N)r7   r8   r9   r  rm  rs  rz  r|  r‚  r…  r‡  r"   r*   r(   re  re  e  s‰   € € € € € ðð ð
4ð 4ð 4ð )ð  )ð  )ðD4ð 4ð 4ð	%ð 	%ð 	%ð)ð )ð )ðB,ð ,ð ,ð/ð /ð /ð /ð /r*   re  c                   ó¬   — e Zd ZdZ ej        d¦  «        Z ej        d¦  «        Zd„ Z	d„ Z
d„ Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚAdditionalProcessingTestszz
    Tests for L{FileAuthority}'s additional processing for those record types
    which require it (MX, CNAME, etc).
    s   10.0.0.1s   f080::1c                 ó¼   — t          |j        j        |f|j        j         ||¦  «        g||i¬¦  «        } t          ||¦  «        t          j        j        ¦  «        S )a  
        Perform a DNS lookup against a L{FileAuthority} configured with records
        as defined by C{makeRecord} and C{addresses}.

        @param method: The name of the lookup method to use; for example,
            C{"lookupNameservers"}.
        @type method: L{str}

        @param soa: A L{Record_SOA} for the zone for which the L{FileAuthority}
            is authoritative.

        @param makeRecord: A one-argument callable which accepts a name and
            returns an L{IRecord} provider.  L{FileAuthority} is constructed
            with this record.  The L{FileAuthority} is queried for a record of
            the resulting type with the given name.

        @param target: The extra name which the record returned by
            C{makeRecord} will be pointed at; this is the name which might
            require extra processing by the server so that all the available,
            useful information is returned.  For example, this is the target of
            a CNAME record or the mail exchange host pointed to by an MX record.
        @type target: L{bytes}

        @param addresses: A L{list} of records giving addresses of C{target}.

        @return: A L{Deferred} that fires with the result of the resolver
            method give by C{method}.
        rm   )r/   rA   r'  r~  r«   )r6   r  r4   Ú
makeRecordÚtargetÚ	addressesr   s          r(   Ú_lookupSomeRecordsz,AdditionalProcessingTests._lookupSomeRecordsì  sf   € õ: $Ø”” Ð%à”	”  ¨FÑ!3Ô!3Ð 4Ø˜	ðð
ñ 
ô 
ˆ	ð *�w�y &Ñ)Ô)­*Ô*:Ô*?Ñ@Ô@Ð@r*   c                 ót   — d„ }|                       t          ||¬¦  «        t          ||¬¦  «        ¦  «         dS )a  
        Assert that the L{RRHeader} instances given by C{expected} and
        C{computed} carry all the same information but without requiring the
        records appear in the same order.

        @param expected: A L{list} of L{RRHeader} instances giving the expected
            records.

        @param computed: A L{list} of L{RRHeader} instances giving the records
            computed by the scenario under test.

        @raise self.failureException: If the two collections of records
            disagree.
        c                 ó   — | j         S r1   )r(  )Úrrs    r(   r  z>AdditionalProcessingTests.assertRecordsMatch.<locals>.<lambda>$  s   € ˜œ€ r*   )ÚkeyN)r•   Úsorted)r6   ÚexpectedÚcomputedr’  s       r(   ÚassertRecordsMatchz,AdditionalProcessingTests.assertRecordsMatch  sB   € ð$ !Ð ˆØ×Ò� ¨cÐ2Ñ2Ô2µF¸8ÈÐ4MÑ4MÔ4MÑNÔNÐNÐNÐNr*   c                 óâ   ‡— dt           j        j        z   Š|                      |t           |‰|¦  «        }|                      |¦  «        \  }}}|                      ˆfd„|D ¦   «         |¦  «         dS )aT  
        Verify that certain address records are included in the I{additional}
        section of a response generated by L{FileAuthority}.

        @param method: See L{_lookupSomeRecords}

        @param makeRecord: See L{_lookupSomeRecords}

        @param addresses: A L{list} of L{IRecord} providers which the
            I{additional} section of the response is required to match
            (ignoring order).

        @raise self.failureException: If the I{additional} section of the
            response consists of different records than those given by
            C{addresses}.
        s   mail.c           	      ó`   •— g | ]*}t          j        ‰|j        t          j        |d ¬¦  «        ‘Œ+S ©Tro  ©r   r   rq  r«   rF   ©r&   r0  rŒ  s     €r(   r)   z=AdditionalProcessingTests._additionalTest.<locals>.<listcomp>=  óP   ø€ ð 	ð 	ð 	ð õ ”ØØ”LÝ"Ô)Ø#Øðñ ô ð	ð 	ð 	r*   N)r«   rA   r'  rŽ  rp  r–  )	r6   r  r‹  r�  r2  r>  r   rr  rŒ  s	           @r(   Ú_additionalTestz)AdditionalProcessingTests._additionalTest'  s™   ø€ ð" �JÔ,Ô1Ñ1ˆØ×#Ò# F­J¸
ÀFÈIÑVÔVˆØ(,×(<Ò(<¸QÑ(?Ô(?Ñ%ˆ�	˜:à×Òð	ð 	ð 	ð 	ð  )ð	ñ 	ô 	ð ñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 ód   — |                       dt          t          j        d¦  «        |¦  «         dS )z£
        Verify that a response to an MX query has certain records in the
        I{additional} section.

        @param addresses: See C{_additionalTest}
        r®   rR   N)r�  r   r   r¯   ©r6   r�  s     r(   Ú_additionalMXTestz+AdditionalProcessingTests._additionalMXTestJ  s9   € ð 	×ÒØ ¥'­#¬-¸Ñ"<Ô"<¸iñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 ó<   — |                       | j        g¦  «         dS )z„
        If the name of the MX response has A records, they are included in the
        additional section of the response.
        N)r   Ú_Ar¢   s    r(   Útest_mailExchangeAdditionalAz6AdditionalProcessingTests.test_mailExchangeAdditionalAU  ó"   € ð
 	×Ò ¤˜yÑ)Ô)Ð)Ð)Ð)r*   c                 ó<   — |                       | j        g¦  «         dS )z‡
        If the name of the MX response has AAAA records, they are included in
        the additional section of the response.
        N)r   Ú_AAAAr¢   s    r(   Útest_mailExchangeAdditionalAAAAz9AdditionalProcessingTests.test_mailExchangeAdditionalAAAA\  ó"   € ð
 	×Ò ¤
˜|Ñ,Ô,Ð,Ð,Ð,r*   c                 óH   — |                       | j        | j        g¦  «         dS )z–
        If the name of the MX response has both A and AAAA records, they are
        all included in the additional section of the response.
        N)r   r¢  r¦  r¢   s    r(   Útest_mailExchangeAdditionalBothz9AdditionalProcessingTests.test_mailExchangeAdditionalBothc  ó'   € ð
 	×Ò ¤¨¬Ð4Ñ5Ô5Ð5Ð5Ð5r*   c                 óH   — |                       dt          j        |¦  «         dS )z£
        Verify that a response to an NS query has certain records in the
        I{additional} section.

        @param addresses: See C{_additionalTest}
        r²   N)r�  r   r³   rŸ  s     r(   Ú_additionalNSTestz+AdditionalProcessingTests._additionalNSTestj  s%   € ð 	×ÒÐ0µ#´-ÀÑKÔKÐKÐKÐKr*   c                 ó<   — |                       | j        g¦  «         dS )z„
        If the name of the NS response has A records, they are included in the
        additional section of the response.
        N)r­  r¢  r¢   s    r(   Útest_nameserverAdditionalAz4AdditionalProcessingTests.test_nameserverAdditionalAs  r¤  r*   c                 ó<   — |                       | j        g¦  «         dS )z‡
        If the name of the NS response has AAAA records, they are included in
        the additional section of the response.
        N)r­  r¦  r¢   s    r(   Útest_nameserverAdditionalAAAAz7AdditionalProcessingTests.test_nameserverAdditionalAAAAz  r¨  r*   c                 óH   — |                       | j        | j        g¦  «         dS )z–
        If the name of the NS response has both A and AAAA records, they are
        all included in the additional section of the response.
        N)r­  r¢  r¦  r¢   s    r(   Útest_nameserverAdditionalBothz7AdditionalProcessingTests.test_nameserverAdditionalBoth�  r«  r*   c                 óš  ‡— dt           j        j        z   Š|                      dt           t          j        ‰|¦  «        }|                      |¦  «        \  }}}t	          j        t           j        j        t          j        t           j	        t	          j        ‰¦  «        d¬¦  «        }|  
                    ˆfd„|D ¦   «         |gz   |¦  «         dS )z¡
        Verify that a response to a CNAME query has certain records in the
        I{answer} section.

        @param addresses: See C{_additionalTest}
        s   www.r¾   Tro  c           	      ó`   •— g | ]*}t          j        ‰|j        t          j        |d ¬¦  «        ‘Œ+S r™  rš  r›  s     €r(   r)   z>AdditionalProcessingTests._answerCNAMETest.<locals>.<listcomp>�  rœ  r*   N)r«   rA   r'  rŽ  r   r¿   rp  r   ÚCNAMErF   r–  )r6   r�  r2  r>  r   rr  ÚaliasrŒ  s          @r(   Ú_answerCNAMETestz*AdditionalProcessingTests._answerCNAMETestˆ  sì   ø€ ð �:Ô+Ô0Ñ0ˆØ×#Ò#Ø!¥:­sÔ/?ÀÈñ
ô 
ˆð )-×(<Ò(<¸QÑ(?Ô(?Ñ%ˆ�	˜:å”ÝÔÔ!ÝŒIÝÔ!ÝÔ$ VÑ,Ô,Øð
ñ 
ô 
ˆð 	×Òð	ð 	ð 	ð 	ð  )ð	ñ 	ô 	ð ˆgñ
ð ñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 ó<   — |                       | j        g¦  «         dS )zƒ
        If the name of the CNAME response has A records, they are included in
        the answer section of the response.
        N)r¸  r¢  r¢   s    r(   Útest_canonicalNameAnswerAz3AdditionalProcessingTests.test_canonicalNameAnswerA«  s"   € ð
 	×Ò˜tœw˜iÑ(Ô(Ð(Ð(Ð(r*   c                 ó<   — |                       | j        g¦  «         dS )z†
        If the name of the CNAME response has AAAA records, they are included
        in the answer section of the response.
        N)r¸  r¦  r¢   s    r(   Útest_canonicalNameAnswerAAAAz6AdditionalProcessingTests.test_canonicalNameAnswerAAAA²  s"   € ð
 	×Ò˜tœz˜lÑ+Ô+Ð+Ð+Ð+r*   c                 óH   — |                       | j        | j        g¦  «         dS )z•
        If the name of the CNAME response has both A and AAAA records, they are
        all included in the answer section of the response.
        N)r¸  r¢  r¦  r¢   s    r(   Útest_canonicalNameAnswerBothz6AdditionalProcessingTests.test_canonicalNameAnswerBoth¹  s'   € ð
 	×Ò˜tœw¨¬
Ð3Ñ4Ô4Ð4Ð4Ð4r*   N)r7   r8   r9   r  r   r   r¢  rö   r¦  rŽ  r–  r�  r   r£  r§  rª  r­  r¯  r±  r³  r¸  rº  r¼  r¾  r"   r*   r(   r‰  r‰  ã  s/  € € € € € ðð ð
 
ˆŒ�kÑ	"Ô	"€BØˆCŒO˜JÑ'Ô'€Eð$Að $Að $AðLOð Oð Oð*!
ð !
ð !
ðF	
ð 	
ð 	
ð*ð *ð *ð-ð -ð -ð6ð 6ð 6ðLð Lð Lð*ð *ð *ð-ð -ð -ð6ð 6ð 6ð!
ð !
ð !
ðF)ð )ð )ð,ð ,ð ,ð5ð 5ð 5ð 5ð 5r*   r‰  c                   ó   — e Zd Zd„ ZdS )ÚNoInitialResponseTestsc                 óè  ‡— ˆfd„}d„ }t          dg¬¦  «        }||_        g Š|                      t          j        d|¦  «         t          j        dt          j        t          j        ddt          j        d	d¬
¦  «        ¬¦  «        g}t          j	        ddddddddd¬¦	  «	        }||_
        ‰                     |¦  «         |                      |                     d¦  «        t          j        ¦  «        S )z§
        If a request returns a L{dns.NS} response, but we can't connect to the
        given server, the request fails with the error returned at connection.
        c                 óH   •— t          ‰                     d¦  «        ¦  «        S rP  )r
   rQ  )r6   ÚargsÚmessagess     €r(   rx  z3NoInitialResponseTests.test_noAnswer.<locals>.queryÈ  s   ø€ õ ˜8Ÿ<š<¨™?œ?Ñ+Ô+Ð+r*   c                 óN   — t          j        t          j        d¦  «        ¦  «        S )NzCouldn't connect)r   Úfailré   Úgaierror)r6   rÃ  Úkwargss      r(   ÚqueryProtocolz;NoInitialResponseTests.test_noAnswer.<locals>.queryProtocolÍ  s   € Ý”:�fœoÐ.@ÑAÔAÑBÔBÐBr*   )r§   r   ry   rx  z	fooba.comr+  Fr,  r-  r&  r;  r?   r   r<  r$  )r   Ú_queryÚpatchr   r€   r   r7  r6  r³   r   rI  Úappendr
  ÚgetHostByNameré   rÇ  )r6   rx  rÉ  rŠ   r5   rK  rÄ  s         @r(   Útest_noAnswerz$NoInitialResponseTests.test_noAnswerÂ  s!  ø€ ð	,ð 	,ð 	,ð 	,ð 	,ð
	Cð 	Cð 	Cõ  ^Ð$4Ð5Ñ5Ô5ˆØˆŒØˆð 	�
Š
•3Ô*¨G°]ÑCÔCÐCõ ŒLØ Ý”VÝ”FØØÝœÐ+AÀsÐKÑKÔKðñ ô ð	
ˆõ ŒKØØØØØØØØØð

ñ 

ô 

ˆð ˆŒ	Ø�Š˜ÑÔÐØ×!Ò! (×"8Ò"8¸Ñ"EÔ"EÅvÄÑWÔWÐWr*   N)r7   r8   r9   rÎ  r"   r*   r(   rÀ  rÀ  Á  s(   € € € € € ð,Xð ,Xð ,Xð ,Xð ,Xr*   rÀ  c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚSecondaryAuthorityServiceTestsz•
    Tests for L{SecondaryAuthorityService}, a service which keeps one or more
    authorities up to date by doing zone transfers from a master.
    c                 ób  — d}t          |ddg¦  «        }|                      |j        |¦  «         |                      |j        d¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        d¦  «         |                      |j        d         j        d¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        d¦  «         |                      |j        d         j        d¦  «         dS )	a  
        L{SecondaryAuthorityService} can be constructed with a C{str} giving a
        master server address and several domains, causing the creation of a
        secondary authority for each domain and that master server address and
        the default DNS port.
        ú192.168.1.2ó   example.comzexample.orgr	  r   r?   s   example.orgN)r   r•   ÚprimaryÚ_portÚdomainsÚdomain©r6   rÔ  Úservices      r(   Útest_constructAuthorityFromHostz>SecondaryAuthorityServiceTests.test_constructAuthorityFromHost÷  s  € ð  ˆÝ+¨G°nÀmÐ5TÑUÔUˆØ×Ò˜œ¨'Ñ2Ô2Ð2Ø×Ò˜œ¨Ñ+Ô+Ð+à×Ò˜œ¨Ô+Ô3°WÑ=Ô=Ð=Ø×Ò˜œ¨Ô+Ô1°2Ñ6Ô6Ð6Ø×Ò˜œ¨Ô+Ô2°NÑCÔCÐCà×Ò˜œ¨Ô+Ô3°WÑ=Ô=Ð=Ø×Ò˜œ¨Ô+Ô1°2Ñ6Ô6Ð6Ø×Ò˜œ¨Ô+Ô2°NÑCÔCÐCÐCÐCr*   c                 ót  — d}d}t          j        ||fddg¦  «        }|                      |j        |¦  «         |                      |j        d¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        d¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        d¦  «         dS )	a\  
        L{SecondaryAuthorityService.fromServerAddressAndDomains} constructs a
        new L{SecondaryAuthorityService} from a C{str} giving a master server
        address and DNS port and several domains, causing the creation of a secondary
        authority for each domain and that master server address and the given
        DNS port.
        ú192.168.1.3i×  zexample.netó   example.edur   ó   example.netr?   N)r   ÚfromServerAddressAndDomainsr•   rÔ  rÕ  rÖ  r×  )r6   rÔ  r…   rÙ  s       r(   Ú&test_constructAuthorityFromHostAndPortzESecondaryAuthorityServiceTests.test_constructAuthorityFromHostAndPort  s&  € ð  ˆØˆÝ+ÔGØ�dˆO˜m¨^Ð<ñ
ô 
ˆð 	×Ò˜œ¨'Ñ2Ô2Ð2Ø×Ò˜œ¨Ñ-Ô-Ð-à×Ò˜œ¨Ô+Ô3°WÑ=Ô=Ð=Ø×Ò˜œ¨Ô+Ô1°4Ñ8Ô8Ð8Ø×Ò˜œ¨Ô+Ô2°NÑCÔCÐCà×Ò˜œ¨Ô+Ô3°WÑ=Ô=Ð=Ø×Ò˜œ¨Ô+Ô1°4Ñ8Ô8Ð8Ø×Ò˜œ¨Ô+Ô2°NÑCÔCÐCÐCÐCr*   c                 ó¸  — d}t          |                     ¦   «         ddg¦  «        }|                      |j        |¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        d¦  «         |                      |j        d         j        |¦  «         |                      |j        d         j        d¦  «         dS )aQ  
        L{SecondaryAuthorityService.fromServerAddressAndDomains} constructs a
        new L{SecondaryAuthorityService} from a C{bytes} giving a master server
        address and several domains, causing the creation of a secondary
        authority for each domain and that master server address and the given
        DNS port.
        rÜ  rÞ  zexample.edur   r?   rÝ  N)r   Úencoder•   rÔ  rÖ  r×  rØ  s      r(   Ú test_constructAuthorityFromBytesz?SecondaryAuthorityServiceTests.test_constructAuthorityFromBytes#  sÍ   € ð  ˆÝ+Ø�NŠNÑÔØ˜]Ð+ñ
ô 
ˆð 	×Ò˜œ¨'Ñ2Ô2Ð2à×Ò˜œ¨Ô+Ô3°WÑ=Ô=Ð=Ø×Ò˜œ¨Ô+Ô2°NÑCÔCÐCà×Ò˜œ¨Ô+Ô3°WÑ=Ô=Ð=Ø×Ò˜œ¨Ô+Ô2°NÑCÔCÐCÐCÐCr*   N)r7   r8   r9   r  rÚ  rà  rã  r"   r*   r(   rÐ  rÐ  ñ  sV   € € € € € ðð ð
Dð Dð Dð(Dð Dð Dð0Dð Dð Dð Dð Dr*   rÐ  c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚSecondaryAuthorityTestsz—
    L{twisted.names.secondary.SecondaryAuthority} correctly constructs objects
    with a specified IP address and optionally specified DNS port.
    c                 óÈ   — t          dd¦  «        }|                      |j        d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         dS )zp
        When constructed using L{SecondaryAuthority.__init__}, the default port
        of 53 is used.
        ú192.168.1.1ú
inside.comr	  ó
   inside.comN)r   r•   rÔ  rÕ  r×  ©r6   Ú	secondarys     r(   Útest_defaultPortz(SecondaryAuthorityTests.test_defaultPort?  sc   € õ
 ' }°lÑCÔCˆ	Ø×Ò˜Ô*¨MÑ:Ô:Ð:Ø×Ò˜œ¨"Ñ-Ô-Ð-Ø×Ò˜Ô)¨=Ñ9Ô9Ð9Ð9Ð9r*   c                 óÒ   — t          j        dd¦  «        }|                      |j        d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         dS )z~
        When constructed using L{SecondaryAuthority.fromServerAddressAndDomain},
        the specified port is used.
        )rç  éé  rè  rç  rî  ré  N)r   ÚfromServerAddressAndDomainr•   rÔ  rÕ  r×  rê  s     r(   Útest_explicitPortz)SecondaryAuthorityTests.test_explicitPortI  sm   € õ
 'ÔAØ! <ñ
ô 
ˆ	ð 	×Ò˜Ô*¨MÑ:Ô:Ð:Ø×Ò˜œ¨$Ñ/Ô/Ð/Ø×Ò˜Ô)¨=Ñ9Ô9Ð9Ð9Ð9r*   c                 óª  — t          j        dd¦  «        }t          ¦   «         x|_        }|                     ¦   «          |j                             d¦  «        \  }}}}}|                      |d¦  «         |                      |d¦  «         |                     ||f¦  «        }t          ¦   «         }	| 
                    |	¦  «         t          ¦   «         }
|
                     t          |	                     ¦   «         dd…         ¦  «        ¦  «         |                      t          j        dt          j        t          j        ¦  «        g|
j        ¦  «         dS )zæ
        An attempt is made to transfer the zone for the domain the
        L{SecondaryAuthority} was constructed with from the server address it
        was constructed with when L{SecondaryAuthority.transfer} is called.
        ©rÒ  r<   úexample.comr   rÒ  r<   ru   N)r   rï  r   Ú_reactorÚtransferÚ
tcpClientsrQ  r•   ÚbuildProtocolr   ÚmakeConnectionr   Údecoder   rj  r   r   rG  r6  rH  )r6   rë  r	   Úhostr…   r   ÚtimeoutÚbindAddressÚprotor�   Úmsgs              r(   Útest_transferz%SecondaryAuthorityTests.test_transferU  s4  € õ 'ÔAØ! =ñ
ô 
ˆ	õ (:Ñ';Ô';Ð;ˆ	Ô˜Wà×ÒÑÔÐð 5<Ô4F×4JÒ4JÈ1Ñ4MÔ4MÑ1ˆˆd�G˜W kØ×Ò˜˜}Ñ-Ô-Ð-Ø×Ò˜˜tÑ$Ô$Ð$ð ×%Ò% t¨T lÑ3Ô3ˆÝ#Ñ%Ô%ˆ	Ø×Ò˜YÑ'Ô'Ð'å‰iŒiˆð 	�
Š
•7˜9Ÿ?š?Ñ,Ô,¨Q¨R¨RÔ0Ñ1Ô1Ñ2Ô2Ð2à×Ò�#œ) Mµ3´8½S¼VÑDÔDÐEÀsÄ{ÑSÔSÐSÐSÐSr*   c           
      ó,  — t          j        dd¦  «        }t          ¦   «         x|_        }|                     ¦   «          |j                             d¦  «        \  }}}}}|                     ||f¦  «        }t          ¦   «         }	| 	                    |	¦  «         t          dd¬¦  «        }
|
                     t          |	                     ¦   «         dd…         ¦  «        ¦  «         t          dd	d
ddddd¬¦  «        }t          dd¬¦  «        }t          |
j        dd¬¦  «        }|j                             t'          dt(          |¬¦  «        t'          d|¬¦  «        t'          dt(          |¬¦  «        g¦  «         |                     ¦   «         }|                     t/          dt1          |¦  «        ¦  «        |z   ¦  «         |                      |                     d¦  «        ¦  «        }|                      t'          d|d¬¦  «        gg g f|¦  «         dS )zŸ
        L{SecondaryAuthority.lookupAddress} returns a L{Deferred} that fires
        with the I{A} records the authority has cached from the primary.
        rò  rÓ  r   r?   )r>  r*  ru   Ns   ns1.example.comzadmin.example.comi@â i  iÀ  i   i€%  ià.  r@   s   192.168.1.2ro   )r=  r>  r*  )r(  r$   r#   z!Hró  T)r$   r*  )r   rï  r   rô  rõ  rö  rQ  r÷  r   rø  r   rù  r   rj  r   r   r=  rI  Úextendr   r   ÚtoStrÚdataReceivedr   Úlenrp  r¡   r•   )r6   rë  r	   rú  r…   r   rû  rü  rý  r�   rx  r4   r  r>  ÚdatarN  s                   r(   Útest_lookupAddressz*SecondaryAuthorityTests.test_lookupAddresss  s  € õ
 'ÔAØ! >ñ
ô 
ˆ	õ (:Ñ';Ô';Ð;ˆ	Ô˜Wà×ÒÑÔÐà4;Ô4F×4JÒ4JÈ1Ñ4MÔ4MÑ1ˆˆd�G˜W kà×%Ò% t¨T lÑ3Ô3ˆÝ#Ñ%Ô%ˆ	Ø×Ò˜YÑ'Ô'Ð'å˜q qÐ)Ñ)Ô)ˆØ�Š•W˜YŸ_š_Ñ.Ô.¨q¨r¨rÔ2Ñ3Ô3Ñ4Ô4Ð4õ Ø$Ø%ØØØØØØð	
ñ 	
ô 	
ˆõ �^¨Ð+Ñ+Ô+ˆÝ˜EœH¨Q°QÐ7Ñ7Ô7ˆØŒ×Òå˜­c¸3Ð?Ñ?Ô?Ý˜°Ð3Ñ3Ô3Ý˜­c¸3Ð?Ñ?Ô?ðñ	
ô 	
ð 	
ð �|Š|‰~Œ~ˆØ×Ò�4 ¥c¨$¡i¤iÑ0Ô0°4Ñ7Ñ8Ô8Ð8à×%Ò% i×&=Ò&=¸mÑ&LÔ&LÑMÔMˆØ×ÒÝ�~¨q°tÐ<Ñ<Ô<Ð=¸rÀ2ÐFÈñ	
ô 	
ð 	
ð 	
ð 	
r*   N)r7   r8   r9   r  rì  rð  rÿ  r  r"   r*   r(   rå  rå  9  s]   € € € € € ðð ð
:ð :ð :ð
:ð 
:ð 
:ðTð Tð Tð<0
ð 0
ð 0
ð 0
ð 0
r*   rå  sY  $ORIGIN example.com.
$TTL    1w
example.com. IN SOA dns.example.com (
            2013120201 ; serial number of this zone file
            1d         ; slave refresh
            2h         ; slave retry time in case of a problem
            4w         ; slave expiration time
            1h         ; maximum caching time in case of failed lookups
            )

; A comment.
@                  IN AAAA 2001:db8:10::1
example.com.       IN A 10.0.0.1
no-in.example.com. A 10.0.0.2  ; technically wrong but used to work
not-fqdn           IN MX 10 mx.example.com
www                IN CNAME example.comc                   óN   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ ZdS )ÚBindAuthorityTestsz=
    Tests for L{twisted.names.authority.BindAuthority}.
    c                 óÆ   — t          |                      ¦   «                              d¦  «        ¦  «        }|                     |¦  «         t	          j        |j        ¦  «        S )zú
        Create a new L{twisted.names.authority.BindAuthority} from C{s}.

        @param s: A string with BIND zone data.
        @type s: bytes

        @return: a new bind authority
        @rtype: L{twisted.names.authority.BindAuthority}
        Úascii)r   r  râ  Ú
setContentr   ÚBindAuthorityÚpath)r6   ÚsÚfps      r(   ÚloadBindStringz!BindAuthorityTests.loadBindString¾  sL   € õ �d—k’k‘m”m×*Ò*¨7Ñ3Ô3Ñ4Ô4ˆØ
�Š�aÑÔÐåÔ& r¤wÑ/Ô/Ð/r*   c                 óD   — |                       t          ¦  «        | _        d S r1   )r  ÚsampleBindZoner*  r¢   s    r(   rŒ   zBindAuthorityTests.setUpÍ  s   € Ø×'Ò'­Ñ7Ô7ˆŒ	ˆ	ˆ	r*   c                 ó®   — | j         j                             ¦   «         D ]5}| j         j        |         D ] }|                      d|j        k    ¦  «         Œ!Œ6dS )zG
        Loads the default $TTL and applies it to all records.
        é€:	 N)r*  r5   Úkeysr  rH   )r6   ÚdomÚrecs      r(   Útest_ttlzBindAuthorityTests.test_ttlÐ  sh   € ð ”9Ô$×)Ò)Ñ+Ô+ð 	3ð 	3ˆCØ”yÔ(¨Ô-ð 3ð 3�Ø—’ ¨#¬'Ò 1Ñ2Ô2Ð2Ð2ð3ð	3ð 	3r*   c                 ó†   — |                       d| j        j        ¦  «         |                      d| j        j        ¦  «         dS )z,
        Loads the default $ORIGIN.
        s   example.com.ó   not-fqdn.example.comN)r•   r*  ÚoriginÚassertInr5   r¢   s    r(   Útest_originFromFilez&BindAuthorityTests.test_originFromFileØ  sT   € ð 	×ÒØØŒIÔñ	
ô 	
ð 	
ð 	�ŠØ#ØŒIÔñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 óÜ   — dD ]h\  }}|                       | j                             |¦  «        ¦  «        \  \  }\   \   |                      t	          j        |d¦  «        |j        ¦  «         ŒidS )ú'
        A records are loaded.
        ©)rÓ  z10.0.0.1)ó   no-in.example.comz10.0.0.2r  N©rp  r*  r¡   r•   r   r   r$   ©r6   r  Úipr‘  s       r(   Útest_aRecordsz BindAuthorityTests.test_aRecordså  s‡   € ð
ð 	ð 	‰GˆC�ð "×1Ò1°$´)×2IÒ2IÈ#Ñ2NÔ2NÑOÔO‰N‰Tˆb‘2‘rØ×ÒÝ”ØØñô ð ”
ñô ð ð ð	ð 	r*   c                 óÌ   — |                       | j                             d¦  «        ¦  «        \  \  }\   \   |                      t	          j        dd¦  «        |j        ¦  «         dS )ú*
        AAAA records are loaded.
        rÓ  ú2001:db8:10::1r  N©rp  r*  rõ   r•   r   rö   r$   ©r6   r‘  s     r(   Útest_aaaaRecordsz#BindAuthorityTests.test_aaaaRecordsö  st   € ð ×-Ò-ØŒI×'Ò'¨Ñ7Ô7ñ
ô 
‰‰ˆ"‰r‘2ð 	×ÒÝŒOØ Øñô ð ŒJñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 óÐ   — |                       | j                             d¦  «        ¦  «        \  \  }\   \   |                      t	          j        ddd¬¦  «        |j        ¦  «         dS )ú(
        MX records are loaded.
        r  rR   zmx.example.comr  )r.  r'  rH   N©rp  r*  r®   r•   r   r¯   r$   r*  s     r(   Útest_mxRecordsz!BindAuthorityTests.test_mxRecords  s}   € ð ×-Ò-ØŒI×(Ò(Ð)@ÑAÔAñ
ô 
‰‰ˆ"‰r‘2ð 	×ÒÝŒMØØ%Øðñ ô ð
 ŒJñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 óÚ   — |                       | j                             d¦  «        ¦  «        \  }\   \   |d         }|                      t	          j        dd¬¦  «        |j        ¦  «         dS )ú+
        CNAME records are loaded.
        ó   www.example.comr   ró  r  r-  N©rp  r*  rõ   r•   r   r¿   r$   ©r6   rI  r‘  s      r(   Útest_cnameRecordsz$BindAuthorityTests.test_cnameRecords  sƒ   € ð !×0Ò0ØŒI×'Ò'Ð(:Ñ;Ô;ñ
ô 
Ñˆ‘"‘bð �QŒZˆØ×ÒÝÔØ"Øðñ ô ð ŒJñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 óà   — |                       t          ¦  «        5 }|                      d¦  «         ddd¦  «         n# 1 swxY w Y   |                      d|j        j        d         ¦  «         dS )zO
        loadBindString raises NotImplementedError on invalid records.
        s   example.com. IN LOL 192.168.0.1NzRecord type 'LOL' not supportedr   )ÚassertRaisesÚNotImplementedErrorr  r•   Ú	exceptionrÃ  )r6   Úes     r(   Útest_invalidRecordClassz*BindAuthorityTests.test_invalidRecordClass%  s·   € ð ×ÒÕ2Ñ3Ô3ð 	D°qØ×ÒÐ BÑCÔCÐCð	Dð 	Dð 	Dñ 	Dô 	Dð 	Dð 	Dð 	Dð 	Dð 	Dð 	Døøøð 	Dð 	Dð 	Dð 	Dà×ÒÐ:¸A¼KÔ<LÈQÔ<OÑPÔPÐPÐPÐPs   ›=½AÁAc                 ó  — dD ]‚}|                       t          ¦  «        5 }|                      |dz   ¦  «         ddd¦  «         n# 1 swxY w Y   |                      t	          |dz   ¦  «        |j        j        d         ¦  «         ŒƒdS )zC
        $INCLUDE and $GENERATE raise NotImplementedError.
        )s   $INCLUDEs	   $GENERATEs    doesNotMatterNs    directive not implementedr   )r7  r8  r  r•   r   r9  rÃ  )r6   Ú	directiver:  s      r(   Útest_invalidDirectivesz)BindAuthorityTests.test_invalidDirectives-  sé   € ð 5ð 	ð 	ˆIØ×"Ò"Õ#6Ñ7Ô7ð C¸1Ø×#Ò# IÐ0AÑ$AÑBÔBÐBðCð Cð Cñ Cô Cð Cð Cð Cð Cð Cð Cøøøð Cð Cð Cð Cà×ÒÝ˜YÐ)FÑFÑGÔGØ”Ô  Ô#ñô ð ð ð	ð 	s   ŸAÁA	ÁA	N)r7   r8   r9   r  r  rŒ   r  r  r%  r+  r/  r5  r;  r>  r"   r*   r(   r  r  ¹  s·   € € € € € ðð ð0ð 0ð 0ð8ð 8ð 8ð3ð 3ð 3ð
ð 
ð 
ðð ð ð"
ð 
ð 
ð
ð 
ð 
ð 
ð 
ð 
ð Qð Qð Qð
ð 
ð 
ð 
ð 
r*   r  aÊ  zone = [
    SOA(
        # For whom we are the authority
        'example.com',

        # This nameserver's name
        mname = "dns.example.com",

        # Mailbox of individual who handles this
        rname = "root.example.com",

        # Unique serial identifying this SOA data
        serial = 86400,

        # Time interval before zone should be refreshed
        refresh = "2H",

        # Interval before failed refresh should be retried
        retry = "1H",

        # Upper limit on time interval before expiry
        expire = "1H",

        # Minimum TTL
        minimum = "3H"

    ),

    AAAA('example.com', '2001:db8:10::1'),
    A('example.com', '10.0.0.1'),
    NS('example.com', 'dns.example.com'),
    A('no-in.example.com', '10.0.0.2'),
    PTR('2.0.0.10.in-addr.arpa', 'no-in.example.com'),

    CNAME('www.example.com', 'example.com'),
    CNAME('ftp.example.com', 'example.com'),

    MX('not-fqdn.example.com', 10, 'mail.example.com'),
]
c                   óB   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
S )ÚPySourceAuthorityTestszA
    Tests for L{twisted.names.authority.PySourceAuthority}.
    c                 óú   — t          |                      ¦   «         ¦  «        }t          |j        d¦  «        5 }|                     |¦  «         ddd¦  «         n# 1 swxY w Y   t          j        |j        ¦  «        S )a  
        Create a new L{twisted.names.authority.PySourceAuthority} from C{s}.

        @param s: A string with BIND zone data in a Python source file.
        @type s: L{str}

        @return: a new bind authority
        @rtype: L{twisted.names.authority.PySourceAuthority}
        r`  N)r   r  ra  r  Úwriter   ÚPySourceAuthority)r6   r  r  r  s       r(   ÚloadPySourceStringz)PySourceAuthorityTests.loadPySourceStringj  s¡   € õ �d—k’k‘m”mÑ$Ô$ˆÝ�"”'˜3ÑÔð 	 1Ø�GŠG�A‰JŒJˆJð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	õ Ô*¨2¬7Ñ3Ô3Ð3s   ·AÁAÁ Ac                 óD   — |                       t          ¦  «        | _        d S r1   )rD  ÚsamplePySourcer*  r¢   s    r(   rŒ   zPySourceAuthorityTests.setUpz  s   € Ø×+Ò+­NÑ;Ô;ˆŒ	ˆ	ˆ	r*   c                 óÚ   — dD ]g\  }}|                       | j                             |¦  «        ¦  «        \  \  }\   \   |                      t	          j        |¦  «        |j        ¦  «         ŒhdS )r  r   Nr"  r#  s       r(   r%  z$PySourceAuthorityTests.test_aRecords}  s}   € ð
ð 	ð 	‰GˆC�ð "×1Ò1°$´)×2IÒ2IÈ#Ñ2NÔ2NÑOÔO‰N‰Tˆb‘2‘rØ×ÒÝ”˜RÑ Ô Ø”
ñô ð ð ð	ð 	r*   c                 óÊ   — |                       | j                             d¦  «        ¦  «        \  \  }\   \   |                      t	          j        d¦  «        |j        ¦  «         dS )r'  rÓ  r(  Nr)  r*  s     r(   r+  z'PySourceAuthorityTests.test_aaaaRecords‹  sk   € ð ×-Ò-ØŒI×'Ò'¨Ñ7Ô7ñ
ô 
‰‰ˆ"‰r‘2ð 	×ÒÝŒOÐ,Ñ-Ô-ØŒJñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 óÎ   — |                       | j                             d¦  «        ¦  «        \  \  }\   \   |                      t	          j        dd¬¦  «        |j        ¦  «         dS )r-  r  rR   zmail.example.com)r.  r'  Nr.  r*  s     r(   r/  z%PySourceAuthorityTests.test_mxRecords—  sz   € ð ×-Ò-ØŒI×(Ò(Ð)@ÑAÔAñ
ô 
‰‰ˆ"‰r‘2ð 	×ÒÝŒMØØ'ðñ ô ð ŒJñ	
ô 	
ð 	
ð 	
ð 	
r*   c                 óØ   — |                       | j                             d¦  «        ¦  «        \  }\   \   |d         }|                      t	          j        d¬¦  «        |j        ¦  «         dS )r1  r2  r   ró  ©r'  Nr3  r4  s      r(   r5  z(PySourceAuthorityTests.test_cnameRecords¦  s€   € ð !×0Ò0ØŒI×'Ò'Ð(:Ñ;Ô;ñ
ô 
Ñˆ‘"‘bð �QŒZˆØ×ÒÝÔØ"ðñ ô ð ŒJñ		
ô 	
ð 	
ð 	
ð 	
r*   c                 óØ   — |                       | j                             d¦  «        ¦  «        \  }\   \   |d         }|                      t	          j        d¬¦  «        |j        ¦  «         dS )z)
        PTR records are loaded.
        s   2.0.0.10.in-addr.arpar   r!  rK  N)rp  r*  rº   r•   r   r»   r$   r4  s      r(   r¼   zPySourceAuthorityTests.test_PTRµ  s   € ð !×0Ò0ØŒI×#Ò#Ð$<Ñ=Ô=ñ
ô 
Ñˆ‘"‘bð �QŒZˆØ×ÒÝŒNØ)ðñ ô ð ŒJñ		
ô 	
ð 	
ð 	
ð 	
r*   c                 óL   — d}|                       t          | j        |¦  «         dS )z1
        Input file has no zone variable
        znothing = []N)r7  Ú
ValueErrorrD  )r6   ÚbadPySources     r(   Útest_badInputNoZonez*PySourceAuthorityTests.test_badInputNoZoneÄ  s*   € ð %ˆØ×Ò�* dÔ&=¸{ÑKÔKÐKÐKÐKr*   N)r7   r8   r9   r  rD  rŒ   r%  r+  r/  r5  r¼   rP  r"   r*   r(   r@  r@  e  s›   € € € € € ðð ð4ð 4ð 4ð <ð <ð <ðð ð ð

ð 

ð 

ð
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ðLð Lð Lð Lð Lr*   r@  )Yr  rï   r  ré   Ú	functoolsr   r   Úior   Ústructr   Útwisted.internetr   r   r	   Útwisted.internet.deferr
   Útwisted.internet.testingr   r   r   Útwisted.namesr   r   r   r   r   Útwisted.names.clientr   Útwisted.names.dnsr   r   r   r   r   r   Útwisted.names.errorr   Útwisted.names.secondaryr   r   Útwisted.python.compatr   Útwisted.python.filepathr   Útwisted.trialr   r-   ÚFileAuthorityr/   r«   Úreverse_soarð   r³   rä   r¯   r·   r¿   rÃ   rÇ   rà   rû   rË   rÏ   rØ   rÜ   rè   rê   r  rö   rÔ   r|   r»   r}   r~   ÚTestCasers   r  r"  rT  re  r‰  rÀ  rÐ  rå  r  r  rF  r@  r"   r*   r(   ú<module>rb     sù  ððð ð
 €€€Ø €€€Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø *Ð *Ð *Ð *Ð *Ð *ðð ð ð ð ð ð ð ð ð ð
 AÐ @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø )Ð )Ð )Ð )Ð )Ð )Ø QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ +Ð +Ð +Ð +Ð +Ð +Ø QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ .Ð .Ð .Ð .Ð .Ð .Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø "Ð "Ð "Ð "Ð "Ð "ð+ð +ð +ð.ð .ð .ð .ð .�iÔ-ñ .ô .ð .ð ˆSŒ^Ø
Ø
 ØØØØØ
Ø	ð	ñ 	ô 	€
ð ˆcŒnØ
"Ø
"ØØØØØ
Ø	ð	ñ 	ô 	€ð 
ˆŒØ
Ø
'ØØØØØ
ð
ñ 
ô 
€ð "�/Ø	˜ZÐ(ð ØˆCŒL˜Ñ&Ô&ØˆCŒM˜/Ñ*Ô*ØˆCŒNÐAÑBÔBØˆCŒNÐ1Ð3TÑUÔUØˆCŒM˜"Ð4Ñ5Ô5ØˆCÔ Ð.IÐJÑJÔJØˆCÔÐ2Ñ3Ô3ØˆCŒMÐ4Ñ5Ô5ØˆCŒMÐ1Ñ2Ô2ØˆCŒNÐ3Ð5FÑGÔGØˆCŒM˜!˜]¨CÑ0Ô0ØˆCŒM˜"˜lÐ,?Ñ@Ô@ØˆCŒM˜!ÐDÐFVÑWÔWØˆCŒNÐJÑKÔKØˆCŒMÐ6Ñ7Ô7ØˆCÔ ]¸MÐJÑJÔJØˆCÔ QÐ1IÐJÑJÔJØˆCŒMÐ2Ð8IÐJÑJÔJØˆCŒNØ Ô 2Ð4Sñô ð ˆCÔØ�R˜˜zÐ+Oñô ð ˆCŒOÐFÑGÔGð5
ð: ˆCŒN˜3  uÐ.FÑGÔGð&
ð ˆCŒL˜Ñ(Ô(ØˆCŒL˜Ñ(Ô(ð"
ð ˆCŒLÐ+Ñ,Ô,ØˆCŒL˜Ñ$Ô$ð&
ð $4 3Ô#3Ð4FÑ#GÔ#GÐ"HØ$0 C¤L°Ñ$<Ô$<Ð#=ð[.ð .ð1ñ 1ô 1€ðf !�Ø	! ;Ð/à$ØˆCŒNÐ:Ñ;Ô;Øð'
ððñ ô €ð  �Ø	˜6Ð"àØØˆCŒL˜¨Ð.Ñ.Ô.ØˆCŒM˜-¨UÐ3Ñ3Ô3ØˆCŒM˜-¨TÐ2Ñ2Ô2ØˆCŒN˜3  uÐ.FÈDÐQÑQÔQð
ððñ ô €ðW
ð W
ð W
ð W
ð W
�XÔ&ñ W
ô W
ð W
ðt
ð ð ð ð �(Ô#ñ ô ð ðW5ð W5ð W5ð W5ð W5�Ô!ñ W5ô W5ð W5ðtð ð ð ð ˜hÔ/ñ ô ð ð{/ð {/ð {/ð {/ð {/�XÔ&ñ {/ô {/ð {/ð|[5ð [5ð [5ð [5ð [5 Ô 1ñ [5ô [5ð [5ð|-Xð -Xð -Xð -Xð -X˜XÔ.ñ -Xô -Xð -Xð`EDð EDð EDð EDð ED XÔ%6ñ EDô EDð EDðPj
ð j
ð j
ð j
ð j
˜hÔ/ñ j
ô j
ð j
ðZ+€ð&~ð ~ð ~ð ~ð ~˜Ô*ñ ~ô ~ð ~ðB(€ðVdLð dLð dLð dLð dL˜XÔ.ñ dLô dLð dLð dLð dLr*   