Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

client.py 24KB

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