client.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. # -*- test-case-name: twisted.names.test.test_names -*-
  2. # Copyright (c) Twisted Matrix Laboratories.
  3. # See LICENSE for details.
  4. """
  5. Asynchronous client DNS
  6. The functions exposed in this module can be used for asynchronous name
  7. resolution and dns queries.
  8. If you need to create a resolver with specific requirements, such as needing to
  9. do queries against a particular host, the L{createResolver} function will
  10. return an C{IResolver}.
  11. Future plans: Proper nameserver acquisition on Windows/MacOS,
  12. better caching, respect timeouts
  13. """
  14. import os
  15. import errno
  16. import warnings
  17. from zope.interface import moduleProvides
  18. # Twisted imports
  19. from twisted.python.compat import nativeString
  20. from twisted.python.runtime import platform
  21. from twisted.python.filepath import FilePath
  22. from twisted.internet import error, defer, interfaces, protocol
  23. from twisted.python import log, failure
  24. from twisted.names import (
  25. dns, common, resolve, cache, root, hosts as hostsModule)
  26. from twisted.internet.abstract import isIPv6Address
  27. moduleProvides(interfaces.IResolver)
  28. class Resolver(common.ResolverBase):
  29. """
  30. @ivar _waiting: A C{dict} mapping tuple keys of query name/type/class to
  31. Deferreds which will be called back with the result of those queries.
  32. This is used to avoid issuing the same query more than once in
  33. parallel. This is more efficient on the network and helps avoid a
  34. "birthday paradox" attack by keeping the number of outstanding requests
  35. for a particular query fixed at one instead of allowing the attacker to
  36. raise it to an arbitrary number.
  37. @ivar _reactor: A provider of L{IReactorTCP}, L{IReactorUDP}, and
  38. L{IReactorTime} which will be used to set up network resources and
  39. track timeouts.
  40. """
  41. index = 0
  42. timeout = None
  43. factory = None
  44. servers = None
  45. dynServers = ()
  46. pending = None
  47. connections = None
  48. resolv = None
  49. _lastResolvTime = None
  50. _resolvReadInterval = 60
  51. def __init__(self, resolv=None, servers=None, timeout=(1, 3, 11, 45), reactor=None):
  52. """
  53. Construct a resolver which will query domain name servers listed in
  54. the C{resolv.conf(5)}-format file given by C{resolv} as well as
  55. those in the given C{servers} list. Servers are queried in a
  56. round-robin fashion. If given, C{resolv} is periodically checked
  57. for modification and re-parsed if it is noticed to have changed.
  58. @type servers: C{list} of C{(str, int)} or L{None}
  59. @param servers: If not None, interpreted as a list of (host, port)
  60. pairs specifying addresses of domain name servers to attempt to use
  61. for this lookup. Host addresses should be in IPv4 dotted-quad
  62. form. If specified, overrides C{resolv}.
  63. @type resolv: C{str}
  64. @param resolv: Filename to read and parse as a resolver(5)
  65. configuration file.
  66. @type timeout: Sequence of C{int}
  67. @param timeout: Default number of seconds after which to reissue the
  68. query. When the last timeout expires, the query is considered
  69. failed.
  70. @param reactor: A provider of L{IReactorTime}, L{IReactorUDP}, and
  71. L{IReactorTCP} which will be used to establish connections, listen
  72. for DNS datagrams, and enforce timeouts. If not provided, the
  73. global reactor will be used.
  74. @raise ValueError: Raised if no nameserver addresses can be found.
  75. """
  76. common.ResolverBase.__init__(self)
  77. if reactor is None:
  78. from twisted.internet import reactor
  79. self._reactor = reactor
  80. self.timeout = timeout
  81. if servers is None:
  82. self.servers = []
  83. else:
  84. self.servers = servers
  85. self.resolv = resolv
  86. if not len(self.servers) and not resolv:
  87. raise ValueError("No nameservers specified")
  88. self.factory = DNSClientFactory(self, timeout)
  89. self.factory.noisy = 0 # Be quiet by default
  90. self.connections = []
  91. self.pending = []
  92. self._waiting = {}
  93. self.maybeParseConfig()
  94. def __getstate__(self):
  95. d = self.__dict__.copy()
  96. d['connections'] = []
  97. d['_parseCall'] = None
  98. return d
  99. def __setstate__(self, state):
  100. self.__dict__.update(state)
  101. self.maybeParseConfig()
  102. def _openFile(self, path):
  103. """
  104. Wrapper used for opening files in the class, exists primarily for unit
  105. testing purposes.
  106. """
  107. return FilePath(path).open()
  108. def maybeParseConfig(self):
  109. if self.resolv is None:
  110. # Don't try to parse it, don't set up a call loop
  111. return
  112. try:
  113. resolvConf = self._openFile(self.resolv)
  114. except IOError as e:
  115. if e.errno == errno.ENOENT:
  116. # Missing resolv.conf is treated the same as an empty resolv.conf
  117. self.parseConfig(())
  118. else:
  119. raise
  120. else:
  121. with resolvConf:
  122. mtime = os.fstat(resolvConf.fileno()).st_mtime
  123. if mtime != self._lastResolvTime:
  124. log.msg('%s changed, reparsing' % (self.resolv,))
  125. self._lastResolvTime = mtime
  126. self.parseConfig(resolvConf)
  127. # Check again in a little while
  128. self._parseCall = self._reactor.callLater(
  129. self._resolvReadInterval, self.maybeParseConfig)
  130. def parseConfig(self, resolvConf):
  131. servers = []
  132. for L in resolvConf:
  133. L = L.strip()
  134. if L.startswith(b'nameserver'):
  135. resolver = (nativeString(L.split()[1]), dns.PORT)
  136. servers.append(resolver)
  137. log.msg("Resolver added %r to server list" % (resolver,))
  138. elif L.startswith(b'domain'):
  139. try:
  140. self.domain = L.split()[1]
  141. except IndexError:
  142. self.domain = b''
  143. self.search = None
  144. elif L.startswith(b'search'):
  145. self.search = L.split()[1:]
  146. self.domain = None
  147. if not servers:
  148. servers.append(('127.0.0.1', dns.PORT))
  149. self.dynServers = servers
  150. def pickServer(self):
  151. """
  152. Return the address of a nameserver.
  153. TODO: Weight servers for response time so faster ones can be
  154. preferred.
  155. """
  156. if not self.servers and not self.dynServers:
  157. return None
  158. serverL = len(self.servers)
  159. dynL = len(self.dynServers)
  160. self.index += 1
  161. self.index %= (serverL + dynL)
  162. if self.index < serverL:
  163. return self.servers[self.index]
  164. else:
  165. return self.dynServers[self.index - serverL]
  166. def _connectedProtocol(self, interface=''):
  167. """
  168. Return a new L{DNSDatagramProtocol} bound to a randomly selected port
  169. number.
  170. """
  171. failures = 0
  172. proto = dns.DNSDatagramProtocol(self, reactor=self._reactor)
  173. while True:
  174. try:
  175. self._reactor.listenUDP(dns.randomSource(), proto,
  176. interface=interface)
  177. except error.CannotListenError as e:
  178. failures += 1
  179. if (hasattr(e.socketError, "errno") and
  180. e.socketError.errno == errno.EMFILE):
  181. # We've run out of file descriptors. Stop trying.
  182. raise
  183. if failures >= 1000:
  184. # We've tried a thousand times and haven't found a port.
  185. # This is almost impossible, and likely means something
  186. # else weird is going on. Raise, as to not infinite loop.
  187. raise
  188. else:
  189. return proto
  190. def connectionMade(self, protocol):
  191. """
  192. Called by associated L{dns.DNSProtocol} instances when they connect.
  193. """
  194. self.connections.append(protocol)
  195. for (d, q, t) in self.pending:
  196. self.queryTCP(q, t).chainDeferred(d)
  197. del self.pending[:]
  198. def connectionLost(self, protocol):
  199. """
  200. Called by associated L{dns.DNSProtocol} instances when they disconnect.
  201. """
  202. if protocol in self.connections:
  203. self.connections.remove(protocol)
  204. def messageReceived(self, message, protocol, address = None):
  205. log.msg("Unexpected message (%d) received from %r" % (message.id, address))
  206. def _query(self, *args):
  207. """
  208. Get a new L{DNSDatagramProtocol} instance from L{_connectedProtocol},
  209. issue a query to it using C{*args}, and arrange for it to be
  210. disconnected from its transport after the query completes.
  211. @param *args: Positional arguments to be passed to
  212. L{DNSDatagramProtocol.query}.
  213. @return: A L{Deferred} which will be called back with the result of the
  214. query.
  215. """
  216. if isIPv6Address(args[0][0]):
  217. protocol = self._connectedProtocol(interface='::')
  218. else:
  219. protocol = self._connectedProtocol()
  220. d = protocol.query(*args)
  221. def cbQueried(result):
  222. protocol.transport.stopListening()
  223. return result
  224. d.addBoth(cbQueried)
  225. return d
  226. def queryUDP(self, queries, timeout = None):
  227. """
  228. Make a number of DNS queries via UDP.
  229. @type queries: A C{list} of C{dns.Query} instances
  230. @param queries: The queries to make.
  231. @type timeout: Sequence of C{int}
  232. @param timeout: Number of seconds after which to reissue the query.
  233. When the last timeout expires, the query is considered failed.
  234. @rtype: C{Deferred}
  235. @raise C{twisted.internet.defer.TimeoutError}: When the query times
  236. out.
  237. """
  238. if timeout is None:
  239. timeout = self.timeout
  240. addresses = self.servers + list(self.dynServers)
  241. if not addresses:
  242. return defer.fail(IOError("No domain name servers available"))
  243. # Make sure we go through servers in the list in the order they were
  244. # specified.
  245. addresses.reverse()
  246. used = addresses.pop()
  247. d = self._query(used, queries, timeout[0])
  248. d.addErrback(self._reissue, addresses, [used], queries, timeout)
  249. return d
  250. def _reissue(self, reason, addressesLeft, addressesUsed, query, timeout):
  251. reason.trap(dns.DNSQueryTimeoutError)
  252. # If there are no servers left to be tried, adjust the timeout
  253. # to the next longest timeout period and move all the
  254. # "used" addresses back to the list of addresses to try.
  255. if not addressesLeft:
  256. addressesLeft = addressesUsed
  257. addressesLeft.reverse()
  258. addressesUsed = []
  259. timeout = timeout[1:]
  260. # If all timeout values have been used this query has failed. Tell the
  261. # protocol we're giving up on it and return a terminal timeout failure
  262. # to our caller.
  263. if not timeout:
  264. return failure.Failure(defer.TimeoutError(query))
  265. # Get an address to try. Take it out of the list of addresses
  266. # to try and put it ino the list of already tried addresses.
  267. address = addressesLeft.pop()
  268. addressesUsed.append(address)
  269. # Issue a query to a server. Use the current timeout. Add this
  270. # function as a timeout errback in case another retry is required.
  271. d = self._query(address, query, timeout[0], reason.value.id)
  272. d.addErrback(self._reissue, addressesLeft, addressesUsed, query, timeout)
  273. return d
  274. def queryTCP(self, queries, timeout = 10):
  275. """
  276. Make a number of DNS queries via TCP.
  277. @type queries: Any non-zero number of C{dns.Query} instances
  278. @param queries: The queries to make.
  279. @type timeout: C{int}
  280. @param timeout: The number of seconds after which to fail.
  281. @rtype: C{Deferred}
  282. """
  283. if not len(self.connections):
  284. address = self.pickServer()
  285. if address is None:
  286. return defer.fail(IOError("No domain name servers available"))
  287. host, port = address
  288. self._reactor.connectTCP(host, port, self.factory)
  289. self.pending.append((defer.Deferred(), queries, timeout))
  290. return self.pending[-1][0]
  291. else:
  292. return self.connections[0].query(queries, timeout)
  293. def filterAnswers(self, message):
  294. """
  295. Extract results from the given message.
  296. If the message was truncated, re-attempt the query over TCP and return
  297. a Deferred which will fire with the results of that query.
  298. If the message's result code is not C{twisted.names.dns.OK}, return a
  299. Failure indicating the type of error which occurred.
  300. Otherwise, return a three-tuple of lists containing the results from
  301. the answers section, the authority section, and the additional section.
  302. """
  303. if message.trunc:
  304. return self.queryTCP(message.queries).addCallback(self.filterAnswers)
  305. if message.rCode != dns.OK:
  306. return failure.Failure(self.exceptionForCode(message.rCode)(message))
  307. return (message.answers, message.authority, message.additional)
  308. def _lookup(self, name, cls, type, timeout):
  309. """
  310. Build a L{dns.Query} for the given parameters and dispatch it via UDP.
  311. If this query is already outstanding, it will not be re-issued.
  312. Instead, when the outstanding query receives a response, that response
  313. will be re-used for this query as well.
  314. @type name: C{str}
  315. @type type: C{int}
  316. @type cls: C{int}
  317. @return: A L{Deferred} which fires with a three-tuple giving the
  318. answer, authority, and additional sections of the response or with
  319. a L{Failure} if the response code is anything other than C{dns.OK}.
  320. """
  321. key = (name, type, cls)
  322. waiting = self._waiting.get(key)
  323. if waiting is None:
  324. self._waiting[key] = []
  325. d = self.queryUDP([dns.Query(name, type, cls)], timeout)
  326. def cbResult(result):
  327. for d in self._waiting.pop(key):
  328. d.callback(result)
  329. return result
  330. d.addCallback(self.filterAnswers)
  331. d.addBoth(cbResult)
  332. else:
  333. d = defer.Deferred()
  334. waiting.append(d)
  335. return d
  336. # This one doesn't ever belong on UDP
  337. def lookupZone(self, name, timeout=10):
  338. address = self.pickServer()
  339. if address is None:
  340. return defer.fail(IOError('No domain name servers available'))
  341. host, port = address
  342. d = defer.Deferred()
  343. controller = AXFRController(name, d)
  344. factory = DNSClientFactory(controller, timeout)
  345. factory.noisy = False #stfu
  346. connector = self._reactor.connectTCP(host, port, factory)
  347. controller.timeoutCall = self._reactor.callLater(
  348. timeout or 10, self._timeoutZone, d, controller,
  349. connector, timeout or 10)
  350. def eliminateTimeout(failure):
  351. controller.timeoutCall.cancel()
  352. controller.timeoutCall = None
  353. return failure
  354. return d.addCallbacks(self._cbLookupZone, eliminateTimeout,
  355. callbackArgs=(connector,))
  356. def _timeoutZone(self, d, controller, connector, seconds):
  357. connector.disconnect()
  358. controller.timeoutCall = None
  359. controller.deferred = None
  360. d.errback(error.TimeoutError("Zone lookup timed out after %d seconds" % (seconds,)))
  361. def _cbLookupZone(self, result, connector):
  362. connector.disconnect()
  363. return (result, [], [])
  364. class AXFRController:
  365. timeoutCall = None
  366. def __init__(self, name, deferred):
  367. self.name = name
  368. self.deferred = deferred
  369. self.soa = None
  370. self.records = []
  371. self.pending = [(deferred,)]
  372. def connectionMade(self, protocol):
  373. # dig saids recursion-desired to 0, so I will too
  374. message = dns.Message(protocol.pickID(), recDes=0)
  375. message.queries = [dns.Query(self.name, dns.AXFR, dns.IN)]
  376. protocol.writeMessage(message)
  377. def connectionLost(self, protocol):
  378. # XXX Do something here - see #3428
  379. pass
  380. def messageReceived(self, message, protocol):
  381. # Caveat: We have to handle two cases: All records are in 1
  382. # message, or all records are in N messages.
  383. # According to http://cr.yp.to/djbdns/axfr-notes.html,
  384. # 'authority' and 'additional' are always empty, and only
  385. # 'answers' is present.
  386. self.records.extend(message.answers)
  387. if not self.records:
  388. return
  389. if not self.soa:
  390. if self.records[0].type == dns.SOA:
  391. #print "first SOA!"
  392. self.soa = self.records[0]
  393. if len(self.records) > 1 and self.records[-1].type == dns.SOA:
  394. #print "It's the second SOA! We're done."
  395. if self.timeoutCall is not None:
  396. self.timeoutCall.cancel()
  397. self.timeoutCall = None
  398. if self.deferred is not None:
  399. self.deferred.callback(self.records)
  400. self.deferred = None
  401. from twisted.internet.base import ThreadedResolver as _ThreadedResolverImpl
  402. class ThreadedResolver(_ThreadedResolverImpl):
  403. def __init__(self, reactor=None):
  404. if reactor is None:
  405. from twisted.internet import reactor
  406. _ThreadedResolverImpl.__init__(self, reactor)
  407. warnings.warn(
  408. "twisted.names.client.ThreadedResolver is deprecated since "
  409. "Twisted 9.0, use twisted.internet.base.ThreadedResolver "
  410. "instead.",
  411. category=DeprecationWarning, stacklevel=2)
  412. class DNSClientFactory(protocol.ClientFactory):
  413. def __init__(self, controller, timeout = 10):
  414. self.controller = controller
  415. self.timeout = timeout
  416. def clientConnectionLost(self, connector, reason):
  417. pass
  418. def clientConnectionFailed(self, connector, reason):
  419. """
  420. Fail all pending TCP DNS queries if the TCP connection attempt
  421. fails.
  422. @see: L{twisted.internet.protocol.ClientFactory}
  423. @param connector: Not used.
  424. @type connector: L{twisted.internet.interfaces.IConnector}
  425. @param reason: A C{Failure} containing information about the
  426. cause of the connection failure. This will be passed as the
  427. argument to C{errback} on every pending TCP query
  428. C{deferred}.
  429. @type reason: L{twisted.python.failure.Failure}
  430. """
  431. # Copy the current pending deferreds then reset the master
  432. # pending list. This prevents triggering new deferreds which
  433. # may be added by callback or errback functions on the current
  434. # deferreds.
  435. pending = self.controller.pending[:]
  436. del self.controller.pending[:]
  437. for pendingState in pending:
  438. d = pendingState[0]
  439. d.errback(reason)
  440. def buildProtocol(self, addr):
  441. p = dns.DNSProtocol(self.controller)
  442. p.factory = self
  443. return p
  444. def createResolver(servers=None, resolvconf=None, hosts=None):
  445. """
  446. Create and return a Resolver.
  447. @type servers: C{list} of C{(str, int)} or L{None}
  448. @param servers: If not L{None}, interpreted as a list of domain name servers
  449. to attempt to use. Each server is a tuple of address in C{str} dotted-quad
  450. form and C{int} port number.
  451. @type resolvconf: C{str} or L{None}
  452. @param resolvconf: If not L{None}, on posix systems will be interpreted as
  453. an alternate resolv.conf to use. Will do nothing on windows systems. If
  454. L{None}, /etc/resolv.conf will be used.
  455. @type hosts: C{str} or L{None}
  456. @param hosts: If not L{None}, an alternate hosts file to use. If L{None}
  457. on posix systems, /etc/hosts will be used. On windows, C:\windows\hosts
  458. will be used.
  459. @rtype: C{IResolver}
  460. """
  461. if platform.getType() == 'posix':
  462. if resolvconf is None:
  463. resolvconf = b'/etc/resolv.conf'
  464. if hosts is None:
  465. hosts = b'/etc/hosts'
  466. theResolver = Resolver(resolvconf, servers)
  467. hostResolver = hostsModule.Resolver(hosts)
  468. else:
  469. if hosts is None:
  470. hosts = r'c:\windows\hosts'
  471. from twisted.internet import reactor
  472. bootstrap = _ThreadedResolverImpl(reactor)
  473. hostResolver = hostsModule.Resolver(hosts)
  474. theResolver = root.bootstrap(bootstrap, resolverFactory=Resolver)
  475. L = [hostResolver, cache.CacheResolver(), theResolver]
  476. return resolve.ResolverChain(L)
  477. theResolver = None
  478. def getResolver():
  479. """
  480. Get a Resolver instance.
  481. Create twisted.names.client.theResolver if it is L{None}, and then return
  482. that value.
  483. @rtype: C{IResolver}
  484. """
  485. global theResolver
  486. if theResolver is None:
  487. try:
  488. theResolver = createResolver()
  489. except ValueError:
  490. theResolver = createResolver(servers=[('127.0.0.1', 53)])
  491. return theResolver
  492. def getHostByName(name, timeout=None, effort=10):
  493. """
  494. Resolve a name to a valid ipv4 or ipv6 address.
  495. Will errback with C{DNSQueryTimeoutError} on a timeout, C{DomainError} or
  496. C{AuthoritativeDomainError} (or subclasses) on other errors.
  497. @type name: C{str}
  498. @param name: DNS name to resolve.
  499. @type timeout: Sequence of C{int}
  500. @param timeout: Number of seconds after which to reissue the query.
  501. When the last timeout expires, the query is considered failed.
  502. @type effort: C{int}
  503. @param effort: How many times CNAME and NS records to follow while
  504. resolving this name.
  505. @rtype: C{Deferred}
  506. """
  507. return getResolver().getHostByName(name, timeout, effort)
  508. def query(query, timeout=None):
  509. return getResolver().query(query, timeout)
  510. def lookupAddress(name, timeout=None):
  511. return getResolver().lookupAddress(name, timeout)
  512. def lookupIPV6Address(name, timeout=None):
  513. return getResolver().lookupIPV6Address(name, timeout)
  514. def lookupAddress6(name, timeout=None):
  515. return getResolver().lookupAddress6(name, timeout)
  516. def lookupMailExchange(name, timeout=None):
  517. return getResolver().lookupMailExchange(name, timeout)
  518. def lookupNameservers(name, timeout=None):
  519. return getResolver().lookupNameservers(name, timeout)
  520. def lookupCanonicalName(name, timeout=None):
  521. return getResolver().lookupCanonicalName(name, timeout)
  522. def lookupMailBox(name, timeout=None):
  523. return getResolver().lookupMailBox(name, timeout)
  524. def lookupMailGroup(name, timeout=None):
  525. return getResolver().lookupMailGroup(name, timeout)
  526. def lookupMailRename(name, timeout=None):
  527. return getResolver().lookupMailRename(name, timeout)
  528. def lookupPointer(name, timeout=None):
  529. return getResolver().lookupPointer(name, timeout)
  530. def lookupAuthority(name, timeout=None):
  531. return getResolver().lookupAuthority(name, timeout)
  532. def lookupNull(name, timeout=None):
  533. return getResolver().lookupNull(name, timeout)
  534. def lookupWellKnownServices(name, timeout=None):
  535. return getResolver().lookupWellKnownServices(name, timeout)
  536. def lookupService(name, timeout=None):
  537. return getResolver().lookupService(name, timeout)
  538. def lookupHostInfo(name, timeout=None):
  539. return getResolver().lookupHostInfo(name, timeout)
  540. def lookupMailboxInfo(name, timeout=None):
  541. return getResolver().lookupMailboxInfo(name, timeout)
  542. def lookupText(name, timeout=None):
  543. return getResolver().lookupText(name, timeout)
  544. def lookupSenderPolicy(name, timeout=None):
  545. return getResolver().lookupSenderPolicy(name, timeout)
  546. def lookupResponsibility(name, timeout=None):
  547. return getResolver().lookupResponsibility(name, timeout)
  548. def lookupAFSDatabase(name, timeout=None):
  549. return getResolver().lookupAFSDatabase(name, timeout)
  550. def lookupZone(name, timeout=None):
  551. return getResolver().lookupZone(name, timeout)
  552. def lookupAllRecords(name, timeout=None):
  553. return getResolver().lookupAllRecords(name, timeout)
  554. def lookupNamingAuthorityPointer(name, timeout=None):
  555. return getResolver().lookupNamingAuthorityPointer(name, timeout)