resolver-class.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. .. _resolver-class:
  2. The dns.resolver.Resolver and dns.resolver.Answer Classes
  3. ---------------------------------------------------------
  4. .. autoclass:: dns.resolver.Resolver
  5. :members:
  6. .. attribute:: domain
  7. A ``dns.name.Name``, the domain of this host.
  8. .. attribute:: nameservers
  9. A ``list`` of ``text``, each item containing an IPv4 or IPv6 address.
  10. .. attribute:: search
  11. A ``list`` of dns.name.Name objects. If the query name is a
  12. relative name, the resolver will construct absolute query names
  13. to try by appending values from the search list.
  14. .. attribute:: port
  15. An ``int``, the default DNS port to send to if not overriden by
  16. *nameserver_ports*. The default value is 53.
  17. .. attribute:: nameserver_ports
  18. A ``dict`` mapping an IPv4 or IPv6 address ``text`` to an ``int``.
  19. This specifies the port to use when sending to a nameserver. If
  20. a port is not defined for an address, the value of the *port*
  21. attribute will be used.
  22. .. attribute:: timeout
  23. A ``float``, the number of seconds to wait for a response from
  24. a server.
  25. .. attribute:: lifetime
  26. A ``float``, the number of seconds to spend trying to get an
  27. answer to the question. If the lifetime expires a
  28. ``dns.exception.Timeout`` exception will be raised.
  29. .. attribute:: cache:
  30. An object implementing the caching protocol, e.g. a
  31. ``dns.resolver.Cache`` or a ``dns.resolver.LRUCache``. The default
  32. is ``None``, in which case there is no local caching.
  33. .. attribute:: retry_servfail
  34. A ``bool``. Should we retry a nameserver if it says ``SERVFAIL``?
  35. The default is ``False``.
  36. .. attribute:: keyring
  37. A ``dict``, the TSIG keyring to use. If a *keyring* is
  38. specified but a *keyname* is not, then the key used will be
  39. the first key in the *keyring*. Note that the order of keys
  40. in a dictionary is not defined, so applications should supply
  41. a keyname when a keyring is used, unless they know the keyring
  42. contains only one key.
  43. .. attribute:: keyname
  44. A ``dns.name.Name`` or ``None``, the name of the TSIG key to
  45. use; defaults to ``None``. The key must be defined in the
  46. keyring.
  47. .. attribute:: keyalgorithm
  48. A ``dns.name.Name`` or ``text``, the TSIG algorithm to use.
  49. *edns*, an ``int``, is the EDNS level to use. Specifying
  50. ``None``, ``False``, or ``-1`` means "do not use EDNS", and in
  51. this case the other parameters are ignored. Specifying
  52. ``True`` is equivalent to specifying 0, i.e. "use EDNS0".
  53. .. attribute:: ednsflags
  54. An ``int``, the EDNS flag values.
  55. .. attribute:: payload
  56. An ``int``, is the EDNS sender's payload field, which is the
  57. maximum size of UDP datagram the sender can handle. I.e. how big
  58. a response to this message can be.
  59. .. attribute:: flags
  60. An ``int`` or ``None``, the message flags to use. If ``None``,
  61. then the default flags as set by the ``dns.message.Message``
  62. constructor will be used.
  63. .. autoclass:: dns.resolver.Answer
  64. :members:
  65. .. attribute:: qname
  66. A ``dns.name.Name``, the query name.
  67. .. attribute:: rdclass
  68. An ``int``, the query class.
  69. .. attribute:: rdtype
  70. An ``int``, the query type.
  71. .. attribute:: response
  72. A ``dns.message.Message``, the response message.
  73. .. attribute:: rrset
  74. A ``dns.rrset.RRset`` or ``None``, the answer RRset.
  75. .. attribute:: expiration
  76. A ``float``, the time when the answer expires.
  77. .. attribute:: canonical_name
  78. A ``dns.name.Name``, the canonical name of the query name,
  79. i.e. the owner name of the answer RRset after any CNAME and DNAME
  80. chaining.