1010getdns contexts
1111---------------
1212
13- This section describes the *getdns * Context object, as well as its
13+ This section describes the *getdns * Context object, as well
14+ as its
1415as its methods and attributes.
1516
1617.. py :class :: Context([set_from_os])
@@ -22,12 +23,14 @@ as its methods and attributes.
2223 attributes described below.
2324
2425 Context() takes one optional constructor argument.
25- ``set_from_os `` is an integer and may take the value either
26+ ``set_from_os `` is an integer and may take the value
27+ either
2628 0 or 1. If 1, which most developers will want, getdns
2729 will populate the context with default values for the
2830 platform on which it's running.
2931
30- The :class: `Context ` class has the following public read/write attributes:
32+ The :class: `Context ` class has the following public
33+ read/write attributes:
3134
3235 .. py :attribute :: append_name
3336
@@ -37,7 +40,8 @@ as its methods and attributes.
3740 ``getdns.APPEND_NAME_ALWAYS ``,
3841 ``getdns.APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE ``,
3942 ``getdns.APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE ``,
40- or ``getdns.APPEND_NAME_NEVER ``. This controls whether or not
43+ or ``getdns.APPEND_NAME_NEVER ``. This controls whether or
44+ not
4145 to append the suffix given by :attr: `suffix `.
4246
4347 .. py :attribute :: dns_root_servers
@@ -53,8 +57,10 @@ as its methods and attributes.
5357
5458 For example, the addresses list could look like
5559
56- >>> addrs = [ { ' address_data' : ' 2001:7b8:206:1::4:53' , ' address_type' : ' IPv6' },
57- ... { ' address_data' : ' 65.22.9.1' , ' address_type' : ' IPv4' } ]
60+ >>> addrs = [ { ' address_data' : ' 2001:7b8:206:1::4:53' ,
61+ 'address_type': 'IPv6' },
62+ ... { ' address_data' : ' 65.22.9.1' ,
63+ 'address_type': 'IPv4' } ]
5864 >>> mycontext.dns_root_servers = addrs
5965
6066 .. py :attribute :: dns_transport_list
@@ -63,8 +69,7 @@ as its methods and attributes.
6369 lookups, ordered by preference (first choice as list
6470 element 0, second as list element 1, and so on). The
6571 possible values are ``getdns.TRANSPORT_UDP ``,
66- ``getdns.TRANSPORT_TCP ``, ``getdns.TRANSPORT_TLS ``,
67- and ``getdns.TRANSPORT_STARTTLS ``.
72+ ``getdns.TRANSPORT_TCP ``, and ``getdns.TRANSPORT_TLS ``.
6873
6974 .. py :attribute :: dnssec_allowed_skew
7075
@@ -84,11 +89,13 @@ as its methods and attributes.
8489
8590 .. py :attribute :: edns_do_bit
8691
87- Its value must be an integer valued either 0 or 1. The default is 0.
92+ Its value must be an integer valued either 0 or 1. The
93+ default is 0.
8894
8995 .. py :attribute :: edns_extended_rcode
9096
91- Its value must be an integer between 0 and 255, inclusive.
97+ Its value must be an integer between 0 and 255,
98+ inclusive.
9299 The default is 0.
93100
94101 .. py :attribute :: edns_maximum_udp_payload_size
@@ -98,15 +105,18 @@ as its methods and attributes.
98105
99106 .. py :attribute :: edns_version
100107
101- Its value must be an integer between 0 and 255, inclusive.
108+ Its value must be an integer between 0 and 255,
109+ inclusive.
102110 The default is 0.
103111
104112 .. py :attribute :: follow_redirects
105113
106114 Specifies whether or not DNS queries follow
107- redirects. The value must be one of ``getdns.REDIRECTS_FOLLOW `` for
115+ redirects. The value must be one of
116+ ``getdns.REDIRECTS_FOLLOW `` for
108117 normal following of redirects though CNAME and DNAME; or
109- ``getdns.REDIRECTS_DO_NOT_FOLLOW `` to cause any lookups that
118+ ``getdns.REDIRECTS_DO_NOT_FOLLOW `` to cause any lookups
119+ that
110120 would have gone through CNAME and DNAME to return the
111121 CNAME or DNAME, not the eventual target.
112122
@@ -122,30 +132,36 @@ as its methods and attributes.
122132
123133 .. py :attribute :: limit_outstanding_queries
124134
125- Specifies `limit ` (an integer value) on the number of outstanding DNS
135+ Specifies `limit ` (an integer value) on the number of
136+ outstanding DNS
126137 queries. The API will block itself from sending more
127138 queries if it is about to exceed this value, and instead
128139 keep those queries in an internal queue. The a value of 0
129- indicates that the number of outstanding DNS queries is unlimited.
140+ indicates that the number of outstanding DNS queries is
141+ unlimited.
130142
131143 .. py :attribute :: namespaces
132144
133145 The `namespaces ` attribute takes an ordered list of
134- namespaces that will be queried. (*Important: this context
146+ namespaces that will be queried. (*Important: this
147+ context
135148 setting is ignored for the getdns.general() function;
136149 it is used for the other
137150 functions. *) The allowed values are
138- ``getdns.NAMESPACE_DNS ``, ``getdns.NAMESPACE_LOCALNAMES ``,
151+ ``getdns.NAMESPACE_DNS ``,
152+ ``getdns.NAMESPACE_LOCALNAMES ``,
139153 ``getdns.NAMESPACE_NETBIOS ``,
140- ``getdns.NAMESPACE_MDNS ``, and ``getdns.NAMESPACE_NIS ``. When a
154+ ``getdns.NAMESPACE_MDNS ``, and
155+ ``getdns.NAMESPACE_NIS ``. When a
141156 normal lookup is done, the API does the lookups in the
142157 order given and stops when it gets the first result; a
143158 different method with the same result would be to run the
144159 queries in parallel and return when it gets the first
145160 result. Because lookups might be done over different
146161 mechanisms because of the different namespaces, there can
147162 be information leakage that is similar to that seen with
148- POSIX *getaddrinfo() *. The default is determined by the OS.
163+ POSIX *getaddrinfo() *. The default is determined by the
164+ OS.
149165
150166 .. py :attribute :: resolution_type
151167
@@ -166,22 +182,28 @@ as its methods and attributes.
166182
167183 .. py :attribute :: timeout
168184
169- Its value must be an integer specifying a timeout for a query, expressed
185+ Its value must be an integer specifying a timeout for a
186+ query, expressed
170187 in milliseconds.
171188
172189 .. py :attribute :: tls_authentication
173190
174191 The mechanism to be used for authenticating the TLS
175- server when using a TLS transport. May be ``getdns.AUTHENTICATION_HOSTNAME `` or
192+ server when using a TLS transport. May be
193+ ``getdns.AUTHENTICATION_REQUIRED `` or
176194 ``getdns.AUTHENTICATION_NONE ``.
195+ (getdns.AUTHENTICATION_HOSTNAME remains as an alias for
196+ getdns.AUTHENTICATION_REQUIRED but is deprecated and will
197+ be removed in a future release)
177198
178199 .. py :attribute :: tls_query_padding_blocksize
179200
180- Optional padding blocksize for queries when using TLS. Used to
201+ Optional padding blocksize for queries when using TLS.
202+ Used to
181203 increase the difficulty for observers to guess traffic
182204 content.
183205
184- .. py :attribute :: upstream_recursive_servers
206+ .. py :attribute :: upstream_recursive_servers
185207
186208 A list of dicts defining where a stub resolver will send queries.
187209 Each dict in the list contains at least two names: address_type
@@ -193,11 +215,19 @@ as its methods and attributes.
193215 tsig_algorithm (a bindata) that is the name of the TSIG hash
194216 algorithm, and tsig_secret (a bindata) that is the TSIG key.
195217
218+ There is also now support for pinning an upstream's
219+ certificate's public keys, with pinsets (when using TLS
220+ for transport. Add an element to the
221+ upstream_recursive_server list entry, called
222+ 'tls_pubkey_pinset', which is a list of public key pins.
223+ (See the example code in our examples directory).
224+
196225 .. py :attribute :: version_string
197226
198227 The libgetdns version, retrieved from the underlying
199228 getdns library.
200-
229+
230+
201231 The :class: `Context ` class includes public methods to execute a DNS query, as well as a
202232 method to return the entire set of context attributes as a Python dictionary. :class: `Context `
203233 methods are described below:
@@ -253,7 +283,7 @@ as its methods and attributes.
253283
254284 * ``version_string ``
255285 * ``implementation_string ``
256- * ``resolver_type ``
286+ * ``resolution_type ``
257287 * ``all_context ``
258288
259289 ``all_context `` is a dictionary containing the following keys:
@@ -263,13 +293,13 @@ as its methods and attributes.
263293 * ``dnssec_allowed_skew ``
264294 * ``edns_do_bit ``
265295 * ``edns_extended_rcode ``
266- * ``edns_maximum_udp_payload_size ``
267296 * ``edns_version ``
268297 * ``follow_redirects ``
269298 * ``limit_outstanding_queries ``
270299 * ``namespaces ``
271300 * ``suffix ``
272301 * ``timeout ``
302+ * ``tls_authentication ``
273303 * ``upstream_recursive_servers ``
274304
275305 .. py :method :: get_supported_attributes()
@@ -301,13 +331,7 @@ The extensions currently supported by :py:mod:`getdns` are:
301331 * ``add_opt_parameters ``
302332 * ``add_warning_for_bad_dns ``
303333 * ``specify_class ``
304- * ``return_call_debugging ``
305-
306- Extensions that are optionally built (see above) include
307-
308- * ``edns-cookies ``
309-
310- ``edns-cookies `` also takes the value ``getdns.EXTENSION_TRUE ``.
334+ * ``return_call_reporting ``
311335
312336Extensions for DNSSEC
313337^^^^^^^^^^^^^^^^^^^^^
@@ -407,6 +431,9 @@ record sets the resource record appropriately, making the
407431needed changes to the settings from the ``add_opt_parameters ``
408432extension.
409433
434+ The ``client_subnet.py `` program in our example directory
435+ shows how to pack and send an OPT record.
436+
410437Getting Warnings for Responses that Violate the DNS Standard
411438^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
412439
@@ -444,9 +471,9 @@ Extensions relating to the API
444471
445472An application might want to see debugging information for
446473queries, such as the length of time it takes for each query
447- to return to the API. Use the ``return_call_debugging ``
474+ to return to the API. Use the ``return_call_reporting ``
448475extension. The extension's value is set to
449- ``getdns.EXTENSION_TRUE `` to add the name ``call_debugging `` (a
476+ ``getdns.EXTENSION_TRUE `` to add the name ``call_reporting `` (a
450477list) to the top level of the ``response `` object. Each member
451478of the list is a dict that represents one call made for the
452479call to the API. Each member has the following names:
@@ -543,21 +570,3 @@ This is an example callback function:
543570 print ' Unknown error'
544571
545572
546- Utility methods
547- ---------------
548-
549- At the present time we support one utility method.
550-
551- .. py :method :: get_errorstr_by_id(id )
552-
553- ``getdns.get_errorstr_by_id `` returns a string containing
554- text describing a getdns return code, helping to make
555- reporting errors to users a little easier. For example:
556-
557- .. code-block :: python
558-
559- if results.replies_full[' status' ] != getdns.RESPSTATUS_GOOD :
560- print (getdns.get_errorstr_by_id(id = results.replies_full[' status' ])
561- sys.exit(1 )
562-
563-
0 commit comments