Ϫf dZddlmZddlmZmZddlmZmZm Z GddZ eejGddejZ y ) 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)commondnserrorceZdZdZdZy)FailureHandlerc.||_||_||_yN)resolverquerytimeout)selfr rrs 7/usr/lib/python3/dist-packages/twisted/names/resolve.py__init__zFailureHandler.__init__s    c|jtjtjt |j |j|jSr ) trapr DomainErrorr TimeoutErrorNotImplementedErrorr rr)rfailures r__call__zFailureHandler.__call__s6 S__e&8&8:MN}}TZZ66rN)__name__ __module__ __qualname__rrrrr r s  7rr c$eZdZdZdZdZddZy) ResolverChainz8 Lookup an address using multiple L{IResolver}s cPtjj|||_y)zi @type resolvers: L{list} @param resolvers: A L{list} of L{IResolver} providers. N)r ResolverBaser resolvers)rr#s rrzResolverChain.__init__%s $$T*"rcL|js'tjtjSt j |||}|jdj||}|jddD](}|jt|j||}*|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}. rN) r#rfailrrrQueryr addErrbackr )rnameclstyperqdrs r_lookupzResolverChain._lookup-s8~~::e//12 2 IIdD# & NN1  # #Aw /# BA ^AGGQ@AA BrNc|js'tjtjS|jdj ||}|jddD](}|j t|j ||}*|S)Nrr%)r#rr&rrlookupAllRecordsr(r )rr)rr-r.s rr1zResolverChain.lookupAllRecordsQs| ~~::e//12 2 NN1  . .tW =# PA ^A,>,>gNOA Prr )rrr__doc__rr/r1rrrr r s#"H rr N)r2zope.interfacertwisted.internetrr twisted.namesrrrr IResolverr"r rrrr7sN '.,, 7 7 Z ! !";F'';#;r