/usr/lib/python3/dist-packages/twisted/names/__pycache__
Edit: /usr/lib/python3/dist-packages/twisted/names/__pycache__/resolve.cpython-310.pyc (3383B)
o
¯b± ã @ sb d Z ddlmZ ddlmZmZ ddlmZmZm Z G dd„ dƒZ
eejƒG dd„ dejƒƒZ
d S )
z´
Lookup a name using multiple resolvers.
Future Plans: This needs someway to specify which resolver answered
the query, or someway to specify (authority|ttl|cache behavior|more?)
é )Úimplementer)ÚdeferÚ
interfaces)ÚcommonÚdnsÚerrorc @ s e Zd Zdd„ Zdd„ ZdS )ÚFailureHandlerc C s || _ || _|| _d S ©N)ÚresolverÚqueryÚtimeout)Úselfr
r r © r ú7/usr/lib/python3/dist-packages/twisted/names/resolve.pyÚ__init__ s
zFailureHandler.__init__c C s" | tjtjt¡ | | j| j¡S r ) Útrapr ÚDomainErrorr ÚTimeoutErrorÚNotImplementedErrorr
r r )r
Úfailurer r r Ú__call__ s zFailureHandler.__call__N)Ú__name__Ú
__module__Ú__qualname__r r r r r r r s r c @ s* e Zd ZdZdd„ Zdd„ Zd dd„ZdS )
Ú
ResolverChainz8
Lookup an address using multiple L{IResolver}s
c C s t j | ¡ || _dS )zi
@type resolvers: L{list}
@param resolvers: A L{list} of L{IResolver} providers.
N)r ÚResolverBaser Ú resolvers)r
r r r r r % s
zResolverChain.__init__c C s` | j s
t t ¡ ¡S t |||¡}| j d ||¡}| j dd… D ]}| t |j||ƒ¡}q!|S )aN
Build a L{dns.Query} for the given parameters and dispatch it
to each L{IResolver} in C{self.resolvers} until an answer or
L{error.AuthoritativeDomainError} is returned.
@type name: C{str}
@param name: DNS name to resolve.
@type type: C{int}
@param type: DNS record type.
@type cls: C{int}
@param cls: DNS record class.
@type timeout: Sequence of C{int}
@param timeout: Number of seconds after which to reissue the query.
When the last timeout expires, the query is considered failed.
@rtype: L{Deferred}
@return: A L{Deferred} which fires with a three-tuple of lists of
L{twisted.names.dns.RRHeader} instances. The first element of the
tuple gives answers. The second element of the tuple gives
authorities. The third element of the tuple gives additional
information. The L{Deferred} may instead fail with one of the
exceptions defined in L{twisted.names.error} or with
C{NotImplementedError}.
r é N)
r r Úfailr r r ÚQueryr Ú
addErrbackr )r
ÚnameÚclsÚtyper ÚqÚdÚrr r r Ú_lookup- s zResolverChain._lookupNc C sR | j s
t t ¡ ¡S | j d ||¡}| j dd … D ]}| t|j||ƒ¡}q|S )Nr r )r r r r r ÚlookupAllRecordsr r )r
r! r r% r&