summaryrefslogtreecommitdiff
path: root/doc/resolver-class.rst
blob: 21c6c466b402f1cb3ee0252f5d5391e3df1568ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
.. _resolver-class:

The dns.resolver.Resolver and dns.resolver.Answer Classes
---------------------------------------------------------

.. autoclass:: dns.resolver.Resolver
   :members:

   .. attribute:: domain

      A ``dns.name.Name``, the domain of this host.

   .. attribute:: nameservers

      A ``list`` of ``str`` or ``dns.nameserver.Nameserver``.  A string may be
      an IPv4 or IPv6 address, or an https URL.

      This field is actually a property, and returns a tuple as of dnspython 2.4.
      Assigning this this field converts any strings into
      ``dns.nameserver.Nameserver`` instances.

   .. attribute:: search

      A ``list`` of dns.name.Name objects.  If the query name is a
      relative name, the resolver will construct absolute query names
      to try by appending values from the search list.

   .. attribute:: use_search_by_default

      A ``bool``, specifes whether or not ``resolve()`` uses the
      search list configured in the system's resolver configuration
      when the ``search`` parameter to ``resolve()`` is ``None``.  The
      default is ``False``.

   .. attribute:: port

      An ``int``, the default DNS port to send to if not overridden by
      *nameserver_ports*.  The default value is 53.

   .. attribute:: nameserver_ports

      A ``dict`` mapping an IPv4 or IPv6 address ``str`` to an ``int``.
      This specifies the port to use when sending to a nameserver.  If
      a port is not defined for an address, the value of the *port*
      attribute will be used.

   .. attribute:: timeout

      A ``float``, the number of seconds to wait for a response from
      a server.

   .. attribute:: lifetime

      A ``float``, the number of seconds to spend trying to get an
      answer to the question.  If the lifetime expires a
      ``dns.exception.Timeout`` exception will be raised.

   .. attribute::  cache

      An object implementing the caching protocol, e.g. a
      ``dns.resolver.Cache`` or a ``dns.resolver.LRUCache``.  The default
      is ``None``, in which case there is no local caching.

   .. attribute:: retry_servfail

      A ``bool``.  Should we retry a nameserver if it says ``SERVFAIL``?
      The default is ``False``.

   .. attribute:: keyring

      A ``dict``, the TSIG keyring to use.  If a *keyring* is
      specified but a *keyname* is not, then the key used will be
      the first key in the *keyring*.  Note that the order of keys
      in a dictionary is not defined, so applications should supply
      a keyname when a keyring is used, unless they know the keyring
      contains only one key.

   .. attribute:: keyname

      A ``dns.name.Name`` or ``None``, the name of the TSIG key to
      use; defaults to ``None``. The key must be defined in the
      keyring.

   .. attribute:: keyalgorithm

      A ``dns.name.Name`` or ``str``, the TSIG algorithm to use.

   .. attribute:: edns

      An ``int``, the EDNS level to use.  Specifying
      ``None``, ``False``, or ``-1`` means "do not use EDNS", and in
      this case the other parameters are ignored.  Specifying
      ``True`` is equivalent to specifying 0, i.e. "use EDNS0".

   .. attribute:: ednsflags

      An ``int``, the EDNS flag values.

   .. attribute:: payload

      An ``int``, is the EDNS sender's payload field, which is the
      maximum size of UDP datagram the sender can handle.  I.e. how big
      a response to this message can be.

   .. attribute:: flags

      An ``int`` or ``None``, the message flags to use.  If ``None``,
      then the default flags as set by the ``dns.message.Message``
      constructor will be used.


.. autoclass:: dns.resolver.Answer
   :members:

   .. attribute:: qname

      A ``dns.name.Name``, the query name.

   .. attribute:: rdclass

      An ``int``, the query class.

   .. attribute:: rdtype

      An ``int``, the query type.

   .. attribute:: response

      A ``dns.message.QueryMessage``, the response message.

   .. attribute:: rrset

      A ``dns.rrset.RRset`` or ``None``, the answer RRset.

   .. attribute:: expiration

      A ``float``, the time when the answer expires.

   .. attribute:: canonical_name

      A ``dns.name.Name``, the canonical name of the query name,
      i.e. the owner name of the answer RRset after any CNAME and DNAME
      chaining.