§
    Ètºf2d  ã                   ó  — d Z ddlmZ ddl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mZmZmZmZmZmZmZmZmZmZmZmZ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dl'm(Z( ddl)m*Z*m+Z+ d„ Z,d„ Z- G d„ de+¦  «        Z. G d„ de/¦  «        Z0d„ Z1 G d„ de+¦  «        Z2g d¢Z3 ee¦  «         G d„ d¦  «        ¦   «         Z4 eee4¦  «          G d„ de*¦  «        Z5 G d„ d¦  «        Z6 e(j7        e8d¬¦  «        Z9d S )!z.
Test cases for Twisted.names' root resolver.
é    )Úimplementer)ÚverifyClass)ÚDeferredÚTimeoutErrorÚgatherResultsÚsucceed)ÚIResolverSimple)ÚclientÚroot)ÚCNAMEÚENAMEÚHSÚINÚNSÚOKÚAÚMessageÚNameÚQueryÚRecord_AÚRecord_CNAMEÚ	Record_NSÚRRHeader)ÚDNSNameErrorÚResolverError)ÚResolver)ÚMemoryReactor)Úmsg)Úutil)ÚSynchronousTestCaseÚTestCasec                 ó(   — | \  }}}|d         j         S )z”
    From the result of a L{Deferred} returned by L{IResolver.lookupAddress},
    return the payload of the first record in the answer section.
    r   ©Úpayload©ÚresultsÚansÚauthÚadds       úb/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/names/test/test_rootresolve.pyÚgetOnePayloadr+   &   s   € ð
 �N€CˆˆsØˆqŒ6Œ>Ðó    c                 óD   — t          | ¦  «                             ¦   «         S )z�
    From the result of a L{Deferred} returned by L{IResolver.lookupAddress},
    return the first IPv4 address from the answer section.
    )r+   Ú
dottedQuad©r&   s    r*   ÚgetOneAddressr0   /   s   € õ
 ˜Ñ!Ô!×,Ò,Ñ.Ô.Ð.r,   c                   ó„   — e Zd ZdZd„ Zd„ Zd„ Zg g g efd„Zd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 )ÚRootResolverTestsz3
    Tests for L{twisted.names.root.Resolver}.
    c                 ó¢  — t          ¦   «         }t          g |¬¦  «        }|                     t          dt          t
          ¦  «        dgd|¦  «        }|j                             ¦   «         \  }}|j        \  \  }}t          ¦   «         }	|	 
                    |¦  «         |                      |	j        t          dt          t
          ¦  «        g¦  «         |                      |	j        g ¦  «         |                      |	j        g ¦  «         |                      |	j        g ¦  «         g }
|                     |
j        ¦  «         |                      |
g ¦  «         |	j        dd…= d|	_        |	j                             t'          dt)          d¦  «        ¬¦  «        ¦  «         |j                             |	                     ¦   «         d¦  «         |
d	         S )
aK  
        Invoke L{Resolver._query} and verify that it sends the correct DNS
        query.  Deliver a canned response to the query and return whatever the
        L{Deferred} returned by L{Resolver._query} fires with.

        @param filter: The value to pass for the C{filter} parameter to
            L{Resolver._query}.
        )Úreactoró   foo.example.com)ú1.1.2.3i  )é   Né   ú	5.8.13.21r#   r   )r   r   Ú_queryr   r   r   ÚudpPortsÚpopitemÚ_sentPacketsr   ÚfromStrÚassertEqualÚqueriesÚanswersÚ	authorityÚ
additionalÚaddCallbackÚappendÚanswerr   r   Ú	_protocolÚdatagramReceivedÚtoStr)ÚselfÚfilterr4   ÚresolverÚdÚ
portNumberÚ	transportÚpacketÚaddressÚmessageÚresponses              r*   Ú
_queryTestzRootResolverTests._queryTest<   s¯  € õ  ‘/”/ˆÝ˜B¨Ð0Ñ0Ô0ˆØ�OŠOÝÐ$¥a­Ñ,Ô,Ð/@Ð.AÀ5È&ñ
ô 
ˆð
 !(Ô 0× 8Ò 8Ñ :Ô :Ñˆ
�Ið (Ô4ÑÑ	ˆ&�'å‘)”)ˆØ�Š˜ÑÔÐð 	×Ò˜œ­5Ð1CÅQÍÑ+KÔ+KÐ*LÑMÔMÐMØ×Ò˜œ¨"Ñ-Ô-Ð-Ø×Ò˜Ô*¨BÑ/Ô/Ð/Ø×Ò˜Ô+¨RÑ0Ô0Ð0àˆØ	�Š�h”oÑ&Ô&Ð&Ø×Ò˜ 2Ñ&Ô&Ð&ð ŒO˜A˜A˜AÐØˆŒØŒ×ÒÝÐ'µ¸+Ñ1FÔ1FÐGÑGÔGñ	
ô 	
ð 	
ð 	Ô×,Ò,¨W¯]ª]©_¬_Ð>OÑPÔPÐPØ˜Œ{Ðr,   c           
      óú   — |                       d¦  «        \  }}}|                      |t          dt          dd¬¦  «        ¬¦  «        g¦  «         |                      |g ¦  «         |                      |g ¦  «         dS )a)  
        L{Resolver._query} accepts a L{Query} instance and an address, issues
        the query, and returns a L{Deferred} which fires with the response to
        the query.  If a true value is passed for the C{filter} parameter, the
        result is a three-tuple of lists of records.
        Tr5   r9   r   ©Úttlr#   N)rT   r?   r   r   )rJ   rF   rB   rC   s       r*   Útest_filteredQueryz$RootResolverTests.test_filteredQueryg   sŒ   € ð )-¯ª¸Ñ(=Ô(=Ñ%ˆ�	˜:Ø×ÒØ•XÐ0½(À;ÐTUÐ:VÑ:VÔ:VÐWÑWÔWÐXñ	
ô 	
ð 	
ð 	×Ò˜ BÑ'Ô'Ð'Ø×Ò˜ RÑ(Ô(Ð(Ð(Ð(r,   c           
      ó|  — |                       d¦  «        }|                      |t          ¦  «         |                      |j        g ¦  «         |                      |j        t          dt          dd¬¦  «        ¬¦  «        g¦  «         |                      |j        g ¦  «         |                      |j	        g ¦  «         dS )zÃ
        Similar to L{test_filteredQuery}, but for the case where a false value
        is passed for the C{filter} parameter.  In this case, the result is a
        L{Message} instance.
        Fr5   r9   r   rV   r#   N)
rT   ÚassertIsInstancer   r?   r@   rA   r   r   rB   rC   )rJ   rR   s     r*   Útest_unfilteredQueryz&RootResolverTests.test_unfilteredQueryu   s»   € ð —/’/ %Ñ(Ô(ˆØ×Ò˜g¥wÑ/Ô/Ð/Ø×Ò˜œ¨"Ñ-Ô-Ð-Ø×ÒØŒOÝÐ(µ(¸;ÈAÐ2NÑ2NÔ2NÐOÑOÔOÐPñ	
ô 	
ð 	
ð 	×Ò˜Ô*¨BÑ/Ô/Ð/Ø×Ò˜Ô+¨RÑ0Ô0Ð0Ð0Ð0r,   c                 ó¤   — t          |¬¦  «        }|j        |f|j        |f|j        |ffD ]$\  }}|                     d„ |D ¦   «         ¦  «         Œ%|S )a£  
        Create a L{Message} suitable for use as a response to a query.

        @param answers: A C{list} of two-tuples giving data for the answers
            section of the message.  The first element of each tuple is a name
            for the L{RRHeader}.  The second element is the payload.
        @param authority: A C{list} like C{answers}, but for the authority
            section of the response.
        @param additional: A C{list} like C{answers}, but for the
            additional section of the response.
        @param rCode: The response code the message will be created with.

        @return: A new L{Message} initialized with the given values.
        )ÚrCodec                 ól   — g | ]1\  }}t          ||j        t          |d t          ¦  «        |¬¦  «        ‘Œ2S )ÚCLASSr#   )r   ÚTYPEÚgetattrr   )Ú.0ÚnameÚrecords      r*   ú
<listcomp>z.RootResolverTests._respond.<locals>.<listcomp>›   sU   € ð ð ð ñ '˜˜võ Ø˜fœk­7°6¸7ÅBÑ+GÔ+GÐQWðñ ô ðð ð r,   )r   rA   rB   rC   Úextend)rJ   rA   rB   rC   r]   rS   ÚsectionÚdatas           r*   Ú_respondzRootResolverTests._respond…   sŒ   € õ  Ð'Ñ'Ô'ˆàÔ˜wÐ'ØÔ Ð+ØÔ  *Ð-ð
ð 	ð 	‰MˆG�Tð
 �NŠNðð ð +/ð	ñ ô ñô ð ð ð ˆr,   é
   c                 óJ   ‡ ‡— dg}t          ||¦  «        }ˆ ˆfd„}||_        |S )a   
        Create and return a new L{root.Resolver} modified to resolve queries
        against the record data represented by C{servers}.

        @param serverResponses: A mapping from dns server addresses to
            mappings.  The inner mappings are from query two-tuples (name,
            type) to dictionaries suitable for use as **arguments to
            L{_respond}.  See that method for details.
        r6   c                 óâ   •— t          d| j        › d|›�¦  «         |D ]P}	 ‰|         }n# t          $ r Y Œw xY w|| j        j        | j        f         }t	           ‰j        di |¤Ž¦  «        c S d S )NzQuery for QNAME z at © )r   rc   ÚKeyErrorÚtyper   ri   )	ÚqueryÚserverAddressesÚtimeoutrK   ÚaddrÚserverÚrecordsrJ   ÚserverResponsess	          €€r*   rp   z-RootResolverTests._getResolver.<locals>.query±   s©   ø€ ÝÐF 5¤:ÐFÐF°?ÐFÐFÑGÔGÐGØ'ð 9ð 9�ðØ,¨TÔ2�F�FøÝð ð ð Ø�Hðøøøà  ¤¤°%´*Ð!<Ô=�Ý˜}˜tœ}Ð7Ð7¨wÐ7Ð7Ñ8Ô8Ð8Ð8Ð8ð9ð 9s   ¡*ª
7¶7)r   r:   )rJ   rv   ÚmaximumQueriesÚrootsrL   rp   s   ``    r*   Ú_getResolverzRootResolverTests._getResolver¤   sH   øø€ ð �ˆÝ˜E >Ñ2Ô2ˆð	9ð 	9ð 	9ð 	9ð 	9ð 	9ð  ˆŒØˆr,   c                 ó\  — dt           fdt          d¦  «        fgdt          d¦  «        fgdœidt           fddt          d¦  «        fgiidœ}|                      |¦  «        }|                     d¦  «        }|                     t          ¦  «         |                     | j        d¦  «         |S )a  
        L{root.Resolver.lookupAddress} looks up the I{A} records for the
        specified hostname by first querying one of the root servers the
        resolver was created with and then following the authority delegations
        until a result is received.
        r5   ó   ns1.example.comú34.55.89.144©rB   rC   rA   ú10.0.0.1)©r6   é5   )r|   r€   ©r   r   r   ry   ÚlookupAddressrD   r0   r?   ©rJ   ÚserversrL   rM   s       r*   Útest_lookupAddressz$RootResolverTests.test_lookupAddress¾   sÏ   € ð $¥QÐ'Ø#5µyÐASÑ7TÔ7TÐ"UÐ!VØ$6½ÀÑ8PÔ8PÐ#QÐ"Rð*ð *ðð $¥QÐ'ØÐ!3µX¸jÑ5IÔ5IÐ JÐKð*ð#ð
ð 
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò"Ð#5Ñ6Ô6ˆØ	�Š•mÑ$Ô$Ð$Ø	�Š�dÔ&¨
Ñ3Ô3Ð3Øˆr,   c                 ó´  — t          d¦  «        }t          |_        dt          fd|fgdt	          d¦  «        fgdt          d¦  «        fgdœidt          fddt          d¦  «        fgiidœ}|                      |¦  «        }|                     d¦  «        }|                     t          ¦  «         |                     | j	        t          d¦  «        ¦  «         |S )	zÄ
        If a response includes a record with a class different from the one
        in the query, it is ignored and lookup continues until a record with
        the right class is found.
        r~   r5   r{   ú10.0.0.2)rA   rB   rC   rA   ú10.0.0.3)r   ©r‡   r€   )
r   r   r_   r   r   ry   r‚   rD   r+   r?   )rJ   ÚbadClassr„   rL   rM   s        r*   Útest_lookupChecksClassz(RootResolverTests.test_lookupChecksClassØ   sø   € õ ˜JÑ'Ô'ˆÝˆŒð $¥QÐ'Ø!3°XÐ >Ð?Ø#5µyÐASÑ7TÔ7TÐ"UÐ!VØ$6½ÀÑ8LÔ8LÐ#MÐ"Nð*ð *ðð $¥QÐ'ØÐ!3µX¸jÑ5IÔ5IÐ JÐKð*ðð
ð 
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò"Ð#5Ñ6Ô6ˆØ	�Š•mÑ$Ô$Ð$Ø	�Š�dÔ&­°Ñ(<Ô(<Ñ=Ô=Ð=Øˆr,   c                 óp  — dt           fddt          d¦  «        fgidt           fddt          d¦  «        fgiidt           fddt          d¦  «        fgiidœ}|                      |¦  «        }|                     d¦  «        }|                     t          ¦  «         |                     | j        d¦  «         |S )z–
        If an intermediate response includes no glue records for the
        authorities, separate queries are made to find those addresses.
        r5   rB   s   ns1.example.orgrA   r~   r‡   )r   )r~   r€   r�   rƒ   s       r*   Útest_missingGluez"RootResolverTests.test_missingGlueô   sß   € ð $¥QÐ'ØÐ#5µyÐASÑ7TÔ7TÐ"UÐ!Vð*ð $¥QÐ'ØÐ!3µX¸jÑ5IÔ5IÐ JÐKð*ðð $¥QÐ'ØÐ!3µX¸jÑ5IÔ5IÐ JÐKð*ðð
ð 
ˆð  ×$Ò$ WÑ-Ô-ˆØ×"Ò"Ð#5Ñ6Ô6ˆØ	�Š•mÑ$Ô$Ð$Ø	�Š�dÔ&¨
Ñ3Ô3Ð3Øˆr,   c                 ó´   — ddt           fdt          iii}|                      |¦  «        }|                     d¦  «        }|                      |t
          ¦  «        S )z�
        If a name is missing, L{Resolver.lookupAddress} returns a L{Deferred}
        which fails with L{DNSNameError}.
        r   r5   r]   )r   r   ry   r‚   ÚassertFailurer   rƒ   s       r*   Útest_missingNamez"RootResolverTests.test_missingName  sd   € ð Ø#¥QÐ'Ø�Uð*ðð
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò"Ð#5Ñ6Ô6ˆØ×!Ò! !¥\Ñ2Ô2Ð2r,   c                 ó¦   — ddt           fi ii}|                      |¦  «        }|                     d¦  «        }|                      |t          ¦  «        S )z¶
        If a query is responded to with no answers or nameserver records, the
        L{Deferred} returned by L{Resolver.lookupAddress} fires with
        L{ResolverError}.
        r   ó   example.com)r   ry   r‚   r�   r   rƒ   s       r*   Útest_answerlessz!RootResolverTests.test_answerless  s[   € ð Ø¥Ð# Rðð
ˆð
 ×$Ò$ WÑ-Ô-ˆØ×"Ò" >Ñ2Ô2ˆØ×!Ò! !¥]Ñ3Ô3Ð3r,   c                 óê   — ddt           fddt          d¦  «        fgidt           fdt          iii}|                      |¦  «        }|                     d¦  «        }|                      |t          ¦  «        S )z¶
        If there is an error resolving the nameserver in a delegation response,
        the L{Deferred} returned by L{Resolver.lookupAddress} fires with that
        error.
        r   r’   rB   r{   r]   )r   r   r   ry   r‚   r�   r   rƒ   s       r*   Útest_delegationLookupErrorz,RootResolverTests.test_delegationLookupError.  sˆ   € ð Ø¥Ð#Ø >µ9Ð=OÑ3PÔ3PÐ"QÐ!Rð&ð $¥QÐ'Ø�Uð*ð	ð	
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò" >Ñ2Ô2ˆØ×!Ò! !¥\Ñ2Ô2Ð2r,   c                 óÜ   — ddt           fddt          d¦  «        fgidt           fi ii}|                      |¦  «        }|                     d¦  «        }|                      |t
          ¦  «        S )zÄ
        If there are no records in the response to a lookup of a delegation
        nameserver, the L{Deferred} returned by L{Resolver.lookupAddress} fires
        with L{ResolverError}.
        r   r’   rB   r{   )r   r   ry   r‚   r�   r   rƒ   s       r*   Útest_delegationLookupEmptyz,RootResolverTests.test_delegationLookupEmptyB  s€   € ð Ø¥Ð#Ø >µ9Ð=OÑ3PÔ3PÐ"QÐ!Rð&ð $¥QÐ'¨ð	ð
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò" >Ñ2Ô2ˆØ×!Ò! !¥]Ñ3Ô3Ð3r,   c           	      ó8  — ddt           fdt          idt          fddt          d¦  «        fgiii}|                      |¦  «        }|                     d¦  «        }d„ }|                     |¦  «         |                     | j        t          d¦  «        ¦  «         |S )z—
        L{Resolver.lookupNameservers} is like L{Resolver.lookupAddress}, except
        it queries for I{NS} records instead of I{A} records.
        r   r’   r]   rA   r{   c                 ó2   — | \  }}}|d         j         j        S ©Nr   )r$   rc   r%   s       r*   Ú
getOneNamez<RootResolverTests.test_lookupNameservers.<locals>.getOneNamef  s   € Ø$‰NˆC��sØ�q”6”>Ô&Ð&r,   )	r   r   r   r   ry   ÚlookupNameserversrD   r?   r   )rJ   r„   rL   rM   r›   s        r*   Útest_lookupNameserversz(RootResolverTests.test_lookupNameserversT  sº   € ð Ø¥Ð#Ø�Uð&ð  ¥Ð$Ø µÐ;MÑ1NÔ1NÐ OÐPð'ð	ð	
ˆð ×$Ò$ WÑ-Ô-ˆØ×&Ò& ~Ñ6Ô6ˆð	'ð 	'ð 	'ð 	
�Š�jÑ!Ô!Ð!Ø	�Š�dÔ&­Ð-?Ñ(@Ô(@ÑAÔAÐAØˆr,   c                 ó¦  — ddt           fddt          d¦  «        fdt          d¦  «        fgiii}|                      |¦  «        }|                     d¦  «        }|                     d„ ¦  «         |                     | j        t          dt          t          d¦  «        ¬¦  «        t          dt           t          d¦  «        ¬¦  «        g¦  «         |S )z–
        If a I{CNAME} record is encountered as the answer to a query for
        another record type, that record is returned as the answer.
        r   r’   rA   ó   example.netz10.0.0.7c                 ó   — | d         S rš   rm   r/   s    r*   ú<lambda>z<RootResolverTests.test_returnCanonicalName.<locals>.<lambda>  ó
   €  g¨a¤j€ r,   r#   ©	r   r   r   ry   r‚   rD   r?   r   r   rƒ   s       r*   Útest_returnCanonicalNamez*RootResolverTests.test_returnCanonicalNamen  sâ   € ð Ø¥Ð#ØØ'­°nÑ)EÔ)EÐFØ'­°*Ñ)=Ô)=Ð>ð ð&ðð	
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò" >Ñ2Ô2ˆØ	�ŠÐ0Ð0Ñ1Ô1Ð1Ø	�ŠØÔå˜­½À^Ñ8TÔ8TÐUÑUÔUÝ˜­µH¸ZÑ4HÔ4HÐIÑIÔIðñ	
ô 	
ð 	
ð ˆr,   c                 ó¼  — ddt           fddt          d¦  «        fgidt           fddt          d¦  «        fgiii}|                      |¦  «        }|                     d¦  «        }|                     d„ ¦  «         |                     | j        t          dt          t          d¦  «        ¬¦  «        t          dt           t          d¦  «        ¬¦  «        g¦  «         |S )zÌ
        If no record of the requested type is included in a response, but a
        I{CNAME} record for the query name is included, queries are made to
        resolve the value of the I{CNAME}.
        r   r’   rA   rŸ   z10.0.0.5c                 ó   — | d         S rš   rm   r/   s    r*   r¡   z<RootResolverTests.test_followCanonicalName.<locals>.<lambda>›  r¢   r,   r#   r£   rƒ   s       r*   Útest_followCanonicalNamez*RootResolverTests.test_followCanonicalName‰  só   € ð Ø¥Ð#Ø µ¸nÑ1MÔ1MÐ NÐOð&ð  ¥Ð#Ø µ¸*Ñ1EÔ1EÐ FÐGð&ð	ð	
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò" >Ñ2Ô2ˆØ	�ŠÐ0Ð0Ñ1Ô1Ð1Ø	�ŠØÔå˜­½À^Ñ8TÔ8TÐUÑUÔUÝ˜­µH¸ZÑ4HÔ4HÐIÑIÔIðñ	
ô 	
ð 	
ð ˆr,   c                 óê   — ddt           fddt          d¦  «        fdt          d¦  «        fgiii}|                      |¦  «        }|                     d¦  «        }|                      |t
          ¦  «        S )z½
        If there is a cycle between I{CNAME} records in a response, this is
        detected and the L{Deferred} returned by the lookup method fails
        with L{ResolverError}.
        r   r’   rA   rŸ   )r   r   ry   r‚   r�   r   rƒ   s       r*   Útest_detectCanonicalNameLoopz.RootResolverTests.test_detectCanonicalNameLoop¥  s†   € ð Ø¥Ð#ØØ'­°nÑ)EÔ)EÐFØ'­°nÑ)EÔ)EÐFð ð&ðð	
ˆð ×$Ò$ WÑ-Ô-ˆØ×"Ò" >Ñ2Ô2ˆØ×!Ò! !¥]Ñ3Ô3Ð3r,   c                 óŒ  — dt           fddt          d¦  «        fgidt           fddt          d¦  «        fgiidt           fdt          d¦  «        fgdt          d¦  «        fgdœidt           fddt          d	¦  «        fgiid
œ}|                      |d¦  «        }|                      |                     d¦  «        t          ¦  «        }|                      |d¦  «        }|                     d¦  «        }|                     t          ¦  «         |                     | j	        t          d	¦  «        ¦  «         t          ||g¦  «        S )zŒ
        L{Resolver.lookupAddress} won't issue more queries following
        delegations than the limit passed to its initializer.
        r’   rB   r{   rA   r‡   s   ns2.example.comrˆ   r}   z10.0.0.4)r   r‰   )rˆ   r€   é   é   )r   r   r   ry   r�   r‚   r   rD   r+   r?   r   )rJ   r„   ÚfailerÚfailDÚ	succeederÚsucceedDs         r*   Útest_boundedQueriesz%RootResolverTests.test_boundedQueries¹  sq  € ð  ¥Ð#Ø >µ9Ð=OÑ3PÔ3PÐ"QÐ!Rð&ð
 $¥QÐ'ØÐ!3µX¸jÑ5IÔ5IÐ JÐKð*ðð   ¥Ð#Ø#1µ9Ð=OÑ3PÔ3PÐ"QÐ!RØ$6½ÀÑ8LÔ8LÐ#MÐ"Nð&ð &ð	ð  ¥Ð#Ø µ¸*Ñ1EÔ1EÐ FÐGð&ðð-
ð 
ˆðB ×"Ò" 7¨AÑ.Ô.ˆØ×"Ò" 6×#7Ò#7¸Ñ#GÔ#GÍÑWÔWˆà×%Ò% g¨qÑ1Ô1ˆ	Ø×*Ò*¨>Ñ:Ô:ˆØ×Ò�]Ñ+Ô+Ð+Ø×Ò˜TÔ-­x¸
Ñ/CÔ/CÑDÔDÐDå˜e XÐ.Ñ/Ô/Ð/r,   N)rj   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rT   rX   r[   r   ri   ry   r…   r‹   r�   r�   r“   r•   r—   r�   r¤   r§   r©   r±   rm   r,   r*   r2   r2   7   s3  € € € € € ðð ð)ð )ð )ðV)ð )ð )ð1ð 1ð 1ð   "¨R¸BÀbð ð ð ð ð>ð ð ð ð4ð ð ð4ð ð ð8ð ð ð63ð 3ð 3ð 4ð 4ð 4ð3ð 3ð 3ð(4ð 4ð 4ð$ð ð ð4ð ð ð6ð ð ð84ð 4ð 4ð(.0ð .0ð .0ð .0ð .0r,   r2   c                   ó   — e Zd ZdZd„ ZdS )ÚResolverFactoryArgumentszf
    Raised by L{raisingResolverFactory} with the *args and **kwargs passed to
    that function.
    c                 ó"   — || _         || _        dS )z™
        Store the supplied args and kwargs as attributes.

        @param args: Positional arguments.
        @param kwargs: Keyword arguments.
        N©ÚargsÚkwargs)rJ   rº   r»   s      r*   Ú__init__z!ResolverFactoryArguments.__init__ð  s   € ð ˆŒ	ØˆŒˆˆr,   N)r²   r³   r´   rµ   r¼   rm   r,   r*   r·   r·   ê  s-   € € € € € ðð ð
ð ð ð ð r,   r·   c                  ó"   — t          | |¦  «        ‚)a=  
    Raise a L{ResolverFactoryArguments} exception containing the
    positional and keyword arguments passed to resolverFactory.

    @param args: A L{list} of all the positional arguments supplied by
        the caller.

    @param kwargs: A L{list} of all the keyword arguments supplied by
        the caller.
    )r·   r¹   s     r*   ÚraisingResolverFactoryr¾   û  s   € õ # 4¨Ñ
0Ô
0Ð0r,   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )Ú RootResolverResolverFactoryTestsz6
    Tests for L{root.Resolver._resolverFactory}.
    c                 ót   — t          dgt          ¬¦  «        }|                      |j        t          ¦  «         dS )z…
        L{root.Resolver.__init__} accepts a C{resolverFactory}
        argument and assigns it to C{self._resolverFactory}.
        N)ÚhintsÚresolverFactory)r   r¾   ÚassertIsÚ_resolverFactory©rJ   Úrs     r*   Ú#test_resolverFactoryArgumentPresentzDRootResolverResolverFactoryTests.test_resolverFactoryArgumentPresent  s7   € õ
 ˜D˜6Õ3IÐJÑJÔJˆØ�Š�aÔ(Õ*@ÑAÔAÐAÐAÐAr,   c                 ór   — t          dg¬¦  «        }|                      |j        t          j         ¦  «         dS )z 
        L{root.Resolver.__init__} sets L{client.Resolver} as the
        C{_resolverFactory} if a C{resolverFactory} argument is not
        supplied.
        N)rÂ   )r   rÄ   rÅ   r
   rÆ   s     r*   Ú"test_resolverFactoryArgumentAbsentzCRootResolverResolverFactoryTests.test_resolverFactoryArgumentAbsent  s5   € õ ˜D˜6Ð"Ñ"Ô"ˆØ�Š�aÔ(­&¬/Ñ:Ô:Ð:Ð:Ð:r,   c                 óä   — t          ¦   «         }t          dgt          |¬¦  «        }|                      t          |j        d¦  «        }|                      d|dgdœf|j        |j        f¦  «         dS )zy
        L{root.Resolver._resolverFactory} is supplied with C{reactor} and
        C{servers} keyword arguments.
        ú192.0.2.101)rÂ   rÃ   r4   zexample.comrm   )rÌ   r€   )r4   r„   N)	Úobjectr   r¾   ÚassertRaisesr·   r‚   r?   rº   r»   )rJ   ÚdummyReactorrÇ   Úes       r*   Ú)test_resolverFactoryOnlyExpectedArgumentszJRootResolverResolverFactoryTests.test_resolverFactoryOnlyExpectedArguments  sŠ   € õ
 ‘x”xˆÝØ �/Ý2Ø ð
ñ 
ô 
ˆð ×ÒÕ6¸¼ÈÑWÔWˆà×ÒØ˜\Ð7JÐ6KÐLÐLÐMØŒV�Q”XÐñ	
ô 	
ð 	
ð 	
ð 	
r,   N)r²   r³   r´   rµ   rÈ   rÊ   rÑ   rm   r,   r*   rÀ   rÀ   	  sN   € € € € € ðð ðBð Bð Bð;ð ;ð ;ð
ð 
ð 
ð 
ð 
r,   rÀ   )za.root-servers.netzb.root-servers.netzc.root-servers.netzd.root-servers.netze.root-servers.netzf.root-servers.netzg.root-servers.netzh.root-servers.netzi.root-servers.netzj.root-servers.netzk.root-servers.netzl.root-servers.netzm.root-servers.netc                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚStubResolverz²
    An L{IResolverSimple} implementer which traces all getHostByName
    calls and their deferred results. The deferred results can be
    accessed and fired synchronously.
    c                 ó"   — g | _         g | _        dS )zâ
        @type calls: L{list} of L{tuple} containing C{args} and
            C{kwargs} supplied to C{getHostByName} calls.
        @type pendingResults: L{list} of L{Deferred} returned by
            C{getHostByName}.
        N)ÚcallsÚpendingResults)rJ   s    r*   r¼   zStubResolver.__init__L  s   € ð ˆŒ
Ø ˆÔÐÐr,   c                 óŽ   — | j                              ||f¦  «         t          ¦   «         }| j                             |¦  «         |S )al  
        A fake implementation of L{IResolverSimple.getHostByName}

        @param args: A L{list} of all the positional arguments supplied by
           the caller.

        @param kwargs: A L{list} of all the keyword arguments supplied by
           the caller.

        @return: A L{Deferred} which may be fired later from the test
            fixture.
        )rÕ   rE   r   rÖ   )rJ   rº   r»   rM   s       r*   ÚgetHostByNamezStubResolver.getHostByNameV  sC   € ð 	Œ
×Ò˜4 ˜.Ñ)Ô)Ð)Ý‰JŒJˆØÔ×"Ò" 1Ñ%Ô%Ð%Øˆr,   N)r²   r³   r´   rµ   r¼   rØ   rm   r,   r*   rÓ   rÓ   D  s<   € € € € € ðð ð!ð !ð !ðð ð ð ð r,   rÓ   c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚBootstrapTestsz%
    Tests for L{root.bootstrap}
    c                 ó†   — t          j        t          ¦   «         ¦  «        }|                      |t           j        ¦  «         dS )zl
        L{root.bootstrap} returns an object which is initially a
        L{root.DeferredResolver}.
        N)r   Ú	bootstraprÓ   rZ   ÚDeferredResolver)rJ   ÚdeferredResolvers     r*   Útest_returnsDeferredResolverz+BootstrapTests.test_returnsDeferredResolverq  s8   € õ
  œ>­,©.¬.Ñ9Ô9ÐØ×ÒÐ.µÔ0EÑFÔFÐFÐFÐFr,   c                 óž   — t          ¦   «         }t          j        |¦  «         |                      |j        d„ t
          D ¦   «         ¦  «         dS )zŽ
        The L{IResolverSimple} supplied to L{root.bootstrap} is used to lookup
        the IP addresses of the 13 root name servers.
        c                 ó   — g | ]}|fi f‘ŒS rm   rm   )rb   Úss     r*   re   z=BootstrapTests.test_resolves13RootServers.<locals>.<listcomp>€  s   € Ð-OÐ-OÐ-O¸Q°¨t°R¨jÐ-OÐ-OÐ-Or,   N)rÓ   r   rÜ   r?   rÕ   ÚROOT_SERVERS)rJ   ÚstubResolvers     r*   Útest_resolves13RootServersz)BootstrapTests.test_resolves13RootServersy  sK   € õ
 $‘~”~ˆÝŒ�|Ñ$Ô$Ð$Ø×Ò˜Ô+Ð-OÐ-OÅ,Ð-OÑ-OÔ-OÑPÔPÐPÐPÐPr,   c                 ó¾   — t          ¦   «         }t          j        |¦  «        }|j        D ]}|                     d¦  «         Œ|                      |t          ¦  «         dS )zÇ
        The L{root.DeferredResolver} initially returned by L{root.bootstrap}
        becomes a L{root.Resolver} when the supplied resolver has successfully
        looked up all root hints.
        rÌ   N)rÓ   r   rÜ   rÖ   ÚcallbackrZ   r   ©rJ   rä   rÞ   rM   s       r*   Útest_becomesResolverz#BootstrapTests.test_becomesResolver‚  sa   € õ $‘~”~ˆÝœ>¨,Ñ7Ô7ÐØÔ,ð 	&ð 	&ˆAØ�JŠJ�}Ñ%Ô%Ð%Ð%Ø×ÒÐ.µÑ9Ô9Ð9Ð9Ð9r,   c                 óÆ   — t          ¦   «         }t          j        |¦  «        }|j        D ]}|                     d¦  «         Œ|                      |j        dgdz  ¦  «         dS )z›
        The L{root.Resolver} which eventually replaces L{root.DeferredResolver}
        is supplied with the IP addresses of the 13 root servers.
        rÌ   é   N)rÓ   r   rÜ   rÖ   rç   r?   rÂ   rè   s       r*   Útest_resolverReceivesRootHintsz-BootstrapTests.test_resolverReceivesRootHintsŽ  sk   € õ
 $‘~”~ˆÝœ>¨,Ñ7Ô7ÐØÔ,ð 	&ð 	&ˆAØ�JŠJ�}Ñ%Ô%Ð%Ð%Ø×ÒÐ)Ô/°-°À2Ñ1EÑFÔFÐFÐFÐFr,   c                 ó@  ‡ ‡— t          ¦   «         }t          j        |¦  «        Št          |j        ¦  «        }t          |¦  «        }|D ]}|                     d¦  «         Œ|                     t          ¦   «         ¦  «         ˆˆ fd„}| 	                    |¦  «         dS )zÇ
        The L{root.Resolver} is eventually created, even if some of the root
        hint lookups fail. Only the working root hint IP addresses are supplied
        to the L{root.Resolver}.
        rÌ   c                 óF   •— ‰                      ‰j        dgdz  ¦  «         d S )NrÌ   é   ©r?   rÂ   ©ÚresrÞ   rJ   s    €€r*   Ú
checkHintszFBootstrapTests.test_continuesWhenSomeRootHintsFail.<locals>.checkHints§  s*   ø€ Ø×ÒÐ-Ô3°m°_ÀrÑ5IÑJÔJÐJÐJÐJr,   N)
rÓ   r   rÜ   ÚiterrÖ   Únextrç   Úerrbackr   ÚaddBoth©rJ   rä   r&   Úd1rM   ró   rÞ   s   `     @r*   Ú#test_continuesWhenSomeRootHintsFailz2BootstrapTests.test_continuesWhenSomeRootHintsFail™  s²   øø€ õ $‘~”~ˆÝœ>¨,Ñ7Ô7ÐÝ�|Ô2Ñ3Ô3ˆÝ�'‰]Œ]ˆØð 	&ð 	&ˆAØ�JŠJ�}Ñ%Ô%Ð%Ð%Ø
�
Š
•<‘>”>Ñ"Ô"Ð"ð	Kð 	Kð 	Kð 	Kð 	Kð 	Kð 	�
Š
�:ÑÔÐÐÐr,   c                 ó˜  ‡ ‡— t          ¦   «         }t          j        |¦  «        Št          |j        ¦  «        }t          |¦  «        }|D ]#}|                     t          ¦   «         ¦  «         Œ$|                     t          ¦   «         ¦  «         ˆˆ fd„}|                     |¦  «         ‰  	                    ‰ j
        t          ¦  «         dS )z´
        The L{root.Resolver} is eventually created, even if all of the root hint
        lookups fail. Pending and new lookups will then fail with
        AttributeError.
        c                 ó>   •— ‰                      ‰j        g ¦  «         d S ©Nrð   rñ   s    €€r*   ró   zEBootstrapTests.test_continuesWhenAllRootHintsFail.<locals>.checkHintsº  s#   ø€ Ø×ÒÐ-Ô3°RÑ8Ô8Ð8Ð8Ð8r,   N)rÓ   r   rÜ   rô   rÖ   rõ   rö   r   r÷   Ú
addCleanupÚflushLoggedErrorsrø   s   `     @r*   Ú"test_continuesWhenAllRootHintsFailz1BootstrapTests.test_continuesWhenAllRootHintsFail¬  sÇ   øø€ õ $‘~”~ˆÝœ>¨,Ñ7Ô7ÐÝ�|Ô2Ñ3Ô3ˆÝ�'‰]Œ]ˆØð 	&ð 	&ˆAØ�IŠI•l‘n”nÑ%Ô%Ð%Ð%Ø
�
Š
•<‘>”>Ñ"Ô"Ð"ð	9ð 	9ð 	9ð 	9ð 	9ð 	9ð 	�
Š
�:ÑÔÐà�Š˜Ô.µÑ=Ô=Ð=Ð=Ð=r,   c                 óÖ   — t          ¦   «         }t          j        |t          ¬¦  «        }|j        D ]}|                     d¦  «         Œ|                      |j        t          ¦  «         dS )z»
        L{root.bootstrap} accepts a C{resolverFactory} argument which is passed
        as an argument to L{root.Resolver} when it has successfully looked up
        root hints.
        )rÃ   rÌ   N)rÓ   r   rÜ   r¾   rÖ   rç   rÄ   rÅ   rè   s       r*   Útest_passesResolverFactoryz)BootstrapTests.test_passesResolverFactoryÁ  sr   € õ $‘~”~ˆÝœ>ØÕ*@ð
ñ 
ô 
Ðð Ô,ð 	&ð 	&ˆAØ�JŠJ�}Ñ%Ô%Ð%Ð%à�ŠÐ&Ô7Õ9OÑPÔPÐPÐPÐPr,   N)r²   r³   r´   rµ   rß   rå   ré   rì   rú   r   r  rm   r,   r*   rÚ   rÚ   l  s•   € € € € € ðð ðGð Gð GðQð Qð Qð
:ð 
:ð 
:ð	Gð 	Gð 	Gðð ð ð&>ð >ð >ð*Qð Qð Qð Qð Qr,   rÚ   c                   ó   — e Zd ZdZd„ ZdS )ÚStubDNSDatagramProtocolz›
    A do-nothing stand-in for L{DNSDatagramProtocol} which can be used to avoid
    network traffic in tests where that kind of thing doesn't matter.
    c                 ó   — t          ¦   «         S rý   )r   )rJ   ÚaÚkws      r*   rp   zStubDNSDatagramProtocol.queryØ  s   € Ý‰zŒzÐr,   N)r²   r³   r´   rµ   rp   rm   r,   r*   r  r  Ò  s-   € € € € € ðð ð
ð ð ð ð r,   r  zbtwisted.names.root.retry is deprecated since Twisted 10.0.  Use a Resolver object for retry logic.)ÚcategoryrR   N):rµ   Úzope.interfacer   Úzope.interface.verifyr   Útwisted.internet.deferr   r   r   r   Útwisted.internet.interfacesr	   Útwisted.namesr
   r   Útwisted.names.dnsr   r   r   r   r   r   r   r   r   r   r   r   r   r   Útwisted.names.errorr   r   Útwisted.names.rootr   Útwisted.names.test.test_utilr   Útwisted.python.logr   Útwisted.trialr   Útwisted.trial.unittestr    r!   r+   r0   r2   Ú	Exceptionr·   r¾   rÀ   rã   rÓ   rÚ   r  ÚsuppressÚDeprecationWarningÚ_retrySuppressionrm   r,   r*   ú<module>r     sD  ððð ð 'Ð &Ð &Ð &Ð &Ð &Ø -Ð -Ð -Ð -Ð -Ð -à QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø &Ð &Ð &Ð &Ð &Ð &Ð &Ð &ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð  <Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @ðð ð ð/ð /ð /ðp0ð p0ð p0ð p0ð p0˜ñ p0ô p0ð p0ðfð ð ð ð ˜yñ ô ð ð"1ð 1ð 1ð'
ð '
ð '
ð '
ð '
 xñ '
ô '
ð '
ðTð ð €ð" €ˆ_ÑÔð!ð !ð !ð !ð !ñ !ô !ñ Ôð!ðH €ˆO˜\Ñ *Ô *Ð *ðcQð cQð cQð cQð cQÐ(ñ cQô cQð cQðLð ð ð ð ñ ô ð ð "�D”MØð	+ðñ ô Ð Ð Ð r,   