@@ -33,12 +33,12 @@ as its methods and attributes.
3333
3434 Specifies whether DNS queries are performed with
3535 nonrecursive lookups or as a stub resolver. The value is
36- either ``getdns.GETDNS_RESOLUTION_RECURSING `` or
37- ``getdns.GETDNS_RESOLUTION_STUB ``.
36+ either ``getdns.RESOLUTION_RECURSING `` or
37+ ``getdns.RESOLUTION_STUB ``.
3838
3939 If an implementation of this API is only able to act as a
4040 recursive resolver, setting `resolution_type `
41- to ``getdns.GETDNS_RESOLUTION_STUB `` will throw an exception.
41+ to ``getdns.RESOLUTION_STUB `` will throw an exception.
4242
4343 .. py :attribute :: namespaces
4444
@@ -47,9 +47,9 @@ as its methods and attributes.
4747 setting is ignored for the getdns.general() function;
4848 it is used for the other
4949 functions. *) The allowed values are
50- ``getdns.GETDNS_NAMESPACE_DNS ``, ``getdns.GETDNS_NAMESPACE_LOCALNAMES ``,
51- ``getdns.GETDNS_NAMESPACE_NETBIOS ``,
52- ``getdns.GETDNS_NAMESPACE_MDNS ``, and ``getdns.GETDNS_NAMESPACE_NIS ``. When a
50+ ``getdns.NAMESPACE_DNS ``, ``getdns.NAMESPACE_LOCALNAMES ``,
51+ ``getdns.NAMESPACE_NETBIOS ``,
52+ ``getdns.NAMESPACE_MDNS ``, and ``getdns.NAMESPACE_NIS ``. When a
5353 normal lookup is done, the API does the lookups in the
5454 order given and stops when it gets the first result; a
5555 different method with the same result would be to run the
@@ -59,12 +59,21 @@ as its methods and attributes.
5959 be information leakage that is similar to that seen with
6060 POSIX *getaddrinfo() *. The default is determined by the OS.
6161
62- .. py :attribute :: dns_transport
62+ .. py :attribute :: dns_transport_list
63+
64+ An ordered list of transport options to be used for DNS
65+ lookups, ordered by preference (first choice as list
66+ element 0, second as list element 1, and so on). The
67+ possible values are ``getdns.TRANSPORT_UDP ``,
68+ ``getdns.TRANSPORT_TCP ``, ``getdns.TRANSPORT_TLS ``,
69+ and ``getdns.TRANSPORT_STARTTLS ``.
70+
71+ .. py :attribute :: dns_transport
6372
6473 Specifies what transport is used for DNS lookups. The
65- value must be one of ``getdns.GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP ``,
66- ``getdns.GETDNS_TRANSPORT_UDP_ONLY ``, ``getdns.GETDNS_TRANSPORT_TCP_ONLY ``, or
67- ``getdns.GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN ``.
74+ value must be one of ``getdns.TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP ``,
75+ ``getdns.TRANSPORT_UDP_ONLY ``, ``getdns.TRANSPORT_TCP_ONLY ``, or
76+ ``getdns.TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN ``.
6877
6978 .. py :attribute :: limit_outstanding_queries
7079
@@ -77,9 +86,9 @@ as its methods and attributes.
7786 .. py :attribute :: follow_redirects
7887
7988 Specifies whether or not DNS queries follow
80- redirects. The value must be one of ``getdns.GETDNS_REDIRECTS_FOLLOW `` for
89+ redirects. The value must be one of ``getdns.REDIRECTS_FOLLOW `` for
8190 normal following of redirects though CNAME and DNAME; or
82- ``getdns.GETDNS_REDIRECTS_DO_NOT_FOLLOW `` to cause any lookups that
91+ ``getdns.REDIRECTS_DO_NOT_FOLLOW `` to cause any lookups that
8392 would have gone through CNAME and DNAME to return the
8493 CNAME or DNAME, not the eventual target.
8594
@@ -105,10 +114,10 @@ as its methods and attributes.
105114 Specifies whether to append a suffix to the query string
106115 before the API starts resolving a name. Its value must be
107116 one of
108- ``getdns.GETDNS_APPEND_NAME_ALWAYS ``,
109- ``getdns.GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE ``,
110- ``getdns.GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE ``,
111- or ``getdns.GETDNS_APPEND_NAME_NEVER ``. This controls whether or not
117+ ``getdns.APPEND_NAME_ALWAYS ``,
118+ ``getdns.APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE ``,
119+ ``getdns.APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE ``,
120+ or ``getdns.APPEND_NAME_NEVER ``. This controls whether or not
112121 to append the suffix given by :attr: `suffix `.
113122
114123 .. py :attribute :: suffix
@@ -285,30 +294,30 @@ a few circumstances.
285294To return the DNSSEC status for each DNS record in the
286295``replies_tree `` list, use the ``dnssec_return_status ``
287296extension. Set the extension's value to
288- ``getdns.GETDNS_EXTENSION_TRUE `` to cause the returned status to have
297+ ``getdns.EXTENSION_TRUE `` to cause the returned status to have
289298the name ``dnssec_status `` added to the other names in
290299the record's dictionary ("header", "question", and so on). The
291- potential values for that name are ``getdns.GETDNS_DNSSEC_SECURE ``,
292- ``getdns.GETDNS_DNSSEC_BOGUS ``, ``getdns.GETDNS_DNSSEC_INDETERMINATE ``, and
293- ``getdns.GETDNS_DNSSEC_INSECURE ``.
300+ potential values for that name are ``getdns.DNSSEC_SECURE ``,
301+ ``getdns.DNSSEC_BOGUS ``, ``getdns.DNSSEC_INDETERMINATE ``, and
302+ ``getdns.DNSSEC_INSECURE ``.
294303
295304If instead of returning the status, you want to only see
296305secure results, use the ``dnssec_return_only_secure ``
297306extension. The extension's value is set to
298- ``getdns.GETDNS_EXTENSION_TRUE `` to cause only records that the API can
307+ ``getdns.EXTENSION_TRUE `` to cause only records that the API can
299308validate as secure with DNSSEC to be returned in the
300309``replies_tree `` and ``replies_full lists ``. No additional names are
301310added to the dict of the record; the change is that some
302311records might not appear in the results. When this context
303312option is set, if the API receives DNS replies but none are
304313determined to be secure, the error code at the top level of
305- the ``response `` object is ``getdns.GETDNS_RESPSTATUS_NO_SECURE_ANSWERS ``.
314+ the ``response `` object is ``getdns.RESPSTATUS_NO_SECURE_ANSWERS ``.
306315
307316Applications that want to do their own validation will want
308317to have the DNSSEC-related records for a particular
309318response. Use the ``dnssec_return_validation_chain ``
310319extension. Set the extension's value to
311- ``getdns.GETDNS_EXTENSION_TRUE `` to cause a set of additional
320+ ``getdns.EXTENSION_TRUE `` to cause a set of additional
312321DNSSEC-related records needed for validation to be returned
313322in the ``response object ``. This set comes as ``validation_chain ``
314323(a list) at the top level of the ``response `` object. This list
@@ -321,7 +330,7 @@ set, and that request also has any of the
321330``dnssec_return_status ``, ``dnssec_return_only_secure ``, or
322331``dnssec_return_validation_chain `` extensions specified, the API
323332will not perform the request and will instead return an
324- error of ``getdns.GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED ``.
333+ error of ``getdns.RETURN_DNSSEC_WITH_STUB_DISALLOWED ``.
325334
326335Returning both IPv4 and IPv6 responses
327336^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -333,7 +342,7 @@ method is able to do this automatically. If you are
333342using the :meth: `general ` method,
334343you can enable this with the ``return_both_v4_and_v6 ``
335344extension. The extension's value must be set to
336- ``getdns.GETDNS_EXTENSION_TRUE `` to cause the results to be the lookup
345+ ``getdns.EXTENSION_TRUE `` to cause the results to be the lookup
337346of either A or AAAA records to include any A and AAAA
338347records for the queried name (otherwise, the extension does
339348nothing). These results are expected to be usable with Happy
@@ -376,20 +385,20 @@ Getting Warnings for Responses that Violate the DNS Standard
376385To receive a warning if a particular response violates some
377386parts of the DNS standard, use the ``add_warning_for_bad_dns ``
378387extension. The extension's value is set to
379- ``getdns.GETDNS_EXTENSION_TRUE `` to cause each reply in the
388+ ``getdns.EXTENSION_TRUE `` to cause each reply in the
380389``replies_tree `` to contain an additional name, ``bad_dns `` (a
381390list). The list is zero or more values that indicate types of
382391bad DNS found in that reply. The list of values is:
383392
384- .. py :data :: GETDNS_BAD_DNS_CNAME_IN_TARGET
393+ .. py :data :: BAD_DNS_CNAME_IN_TARGET
385394
386395 A DNS query type that does not allow a target to be a CNAME pointed to a CNAME
387396
388- .. py :data :: GETDNS_BAD_DNS_ALL_NUMERIC_LABEL
397+ .. py :data :: BAD_DNS_ALL_NUMERIC_LABEL
389398
390399 One or more labels in a returned domain name is all-numeric; this is not legal for a hostname
391400
392- .. py :data :: GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
401+ .. py :data :: BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
393402
394403 A DNS query for a type other than CNAME returned a CNAME response
395404
@@ -409,7 +418,7 @@ An application might want to see debugging information for
409418queries, such as the length of time it takes for each query
410419to return to the API. Use the ``return_call_debugging ``
411420extension. The extension's value is set to
412- ``getdns.GETDNS_EXTENSION_TRUE `` to add the name ``call_debugging `` (a
421+ ``getdns.EXTENSION_TRUE `` to add the name ``call_debugging `` (a
413422list) to the top level of the ``response `` object. Each member
414423of the list is a dict that represents one call made for the
415424call to the API. Each member has the following names:
@@ -420,7 +429,7 @@ call to the API. Each member has the following names:
420429 * ``start_time `` is the time the query started in milliseconds since the epoch, represented as an integer
421430 * ``end_time `` is the time the query was received in milliseconds since the epoch, represented as an integer
422431 * ``entire_reply `` is the entire response received
423- * ``dnssec_result `` is the DNSSEC status, or ``getdns.GETDNS_DNSSEC_NOT_PERFORMED `` if DNSSEC validation was not performed
432+ * ``dnssec_result `` is the DNSSEC status, or ``getdns.DNSSEC_NOT_PERFORMED `` if DNSSEC validation was not performed
424433
425434
426435Asynchronous queries
@@ -484,12 +493,12 @@ This is an example callback function:
484493 def cbk (type , result , userarg , tid ):
485494 if type == getdns.CALLBACK_COMPLETE :
486495 status = result.status
487- if status == getdns.GETDNS_RESPSTATUS_GOOD :
496+ if status == getdns.RESPSTATUS_GOOD :
488497 for addr in result.just_address_answers:
489498 addr_type = addr[' address_type' ]
490499 addr_data = addr[' address_data' ]
491500 print ' {0} : {1} {2} ' .format(userarg, addr_type, addr_data)
492- elif status == getdns.GETDNS_RESPSTATUS_NO_SECURE_ANSWERS :
501+ elif status == getdns.RESPSTATUS_NO_SECURE_ANSWERS :
493502 print " {0} : No DNSSEC secured responses found" .format(hostname)
494503 else :
495504 print " {0} : getdns.address() returned error: {1} " .format(hostname, status)
@@ -514,7 +523,7 @@ At the present time we support one utility method.
514523
515524.. code-block :: python
516525
517- if results.replies_full[' status' ] != getdns.GETDNS_RESPSTATUS_GOOD :
526+ if results.replies_full[' status' ] != getdns.RESPSTATUS_GOOD :
518527 print (getdns.get_errorstr_by_id(id = results.replies_full[' status' ])
519528 sys.exit(1 )
520529
0 commit comments