@@ -33,12 +33,12 @@ as its methods and attributes.
33
33
34
34
Specifies whether DNS queries are performed with
35
35
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 ``.
38
38
39
39
If an implementation of this API is only able to act as a
40
40
recursive resolver, setting `resolution_type `
41
- to ``getdns.GETDNS_RESOLUTION_STUB `` will throw an exception.
41
+ to ``getdns.RESOLUTION_STUB `` will throw an exception.
42
42
43
43
.. py :attribute :: namespaces
44
44
@@ -47,9 +47,9 @@ as its methods and attributes.
47
47
setting is ignored for the getdns.general() function;
48
48
it is used for the other
49
49
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
53
53
normal lookup is done, the API does the lookups in the
54
54
order given and stops when it gets the first result; a
55
55
different method with the same result would be to run the
@@ -59,12 +59,21 @@ as its methods and attributes.
59
59
be information leakage that is similar to that seen with
60
60
POSIX *getaddrinfo() *. The default is determined by the OS.
61
61
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
63
72
64
73
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 ``.
68
77
69
78
.. py :attribute :: limit_outstanding_queries
70
79
@@ -77,9 +86,9 @@ as its methods and attributes.
77
86
.. py :attribute :: follow_redirects
78
87
79
88
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
81
90
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
83
92
would have gone through CNAME and DNAME to return the
84
93
CNAME or DNAME, not the eventual target.
85
94
@@ -105,10 +114,10 @@ as its methods and attributes.
105
114
Specifies whether to append a suffix to the query string
106
115
before the API starts resolving a name. Its value must be
107
116
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
112
121
to append the suffix given by :attr: `suffix `.
113
122
114
123
.. py :attribute :: suffix
@@ -285,30 +294,30 @@ a few circumstances.
285
294
To return the DNSSEC status for each DNS record in the
286
295
``replies_tree `` list, use the ``dnssec_return_status ``
287
296
extension. 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
289
298
the name ``dnssec_status `` added to the other names in
290
299
the 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 ``.
294
303
295
304
If instead of returning the status, you want to only see
296
305
secure results, use the ``dnssec_return_only_secure ``
297
306
extension. 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
299
308
validate as secure with DNSSEC to be returned in the
300
309
``replies_tree `` and ``replies_full lists ``. No additional names are
301
310
added to the dict of the record; the change is that some
302
311
records might not appear in the results. When this context
303
312
option is set, if the API receives DNS replies but none are
304
313
determined 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 ``.
306
315
307
316
Applications that want to do their own validation will want
308
317
to have the DNSSEC-related records for a particular
309
318
response. Use the ``dnssec_return_validation_chain ``
310
319
extension. 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
312
321
DNSSEC-related records needed for validation to be returned
313
322
in the ``response object ``. This set comes as ``validation_chain ``
314
323
(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
321
330
``dnssec_return_status ``, ``dnssec_return_only_secure ``, or
322
331
``dnssec_return_validation_chain `` extensions specified, the API
323
332
will 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 ``.
325
334
326
335
Returning both IPv4 and IPv6 responses
327
336
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -333,7 +342,7 @@ method is able to do this automatically. If you are
333
342
using the :meth: `general ` method,
334
343
you can enable this with the ``return_both_v4_and_v6 ``
335
344
extension. 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
337
346
of either A or AAAA records to include any A and AAAA
338
347
records for the queried name (otherwise, the extension does
339
348
nothing). These results are expected to be usable with Happy
@@ -376,20 +385,20 @@ Getting Warnings for Responses that Violate the DNS Standard
376
385
To receive a warning if a particular response violates some
377
386
parts of the DNS standard, use the ``add_warning_for_bad_dns ``
378
387
extension. 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
380
389
``replies_tree `` to contain an additional name, ``bad_dns `` (a
381
390
list). The list is zero or more values that indicate types of
382
391
bad DNS found in that reply. The list of values is:
383
392
384
- .. py :data :: GETDNS_BAD_DNS_CNAME_IN_TARGET
393
+ .. py :data :: BAD_DNS_CNAME_IN_TARGET
385
394
386
395
A DNS query type that does not allow a target to be a CNAME pointed to a CNAME
387
396
388
- .. py :data :: GETDNS_BAD_DNS_ALL_NUMERIC_LABEL
397
+ .. py :data :: BAD_DNS_ALL_NUMERIC_LABEL
389
398
390
399
One or more labels in a returned domain name is all-numeric; this is not legal for a hostname
391
400
392
- .. py :data :: GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
401
+ .. py :data :: BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
393
402
394
403
A DNS query for a type other than CNAME returned a CNAME response
395
404
@@ -409,7 +418,7 @@ An application might want to see debugging information for
409
418
queries, such as the length of time it takes for each query
410
419
to return to the API. Use the ``return_call_debugging ``
411
420
extension. 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
413
422
list) to the top level of the ``response `` object. Each member
414
423
of the list is a dict that represents one call made for the
415
424
call to the API. Each member has the following names:
@@ -420,7 +429,7 @@ call to the API. Each member has the following names:
420
429
* ``start_time `` is the time the query started in milliseconds since the epoch, represented as an integer
421
430
* ``end_time `` is the time the query was received in milliseconds since the epoch, represented as an integer
422
431
* ``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
424
433
425
434
426
435
Asynchronous queries
@@ -484,12 +493,12 @@ This is an example callback function:
484
493
def cbk (type , result , userarg , tid ):
485
494
if type == getdns.CALLBACK_COMPLETE :
486
495
status = result.status
487
- if status == getdns.GETDNS_RESPSTATUS_GOOD :
496
+ if status == getdns.RESPSTATUS_GOOD :
488
497
for addr in result.just_address_answers:
489
498
addr_type = addr[' address_type' ]
490
499
addr_data = addr[' address_data' ]
491
500
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 :
493
502
print " {0} : No DNSSEC secured responses found" .format(hostname)
494
503
else :
495
504
print " {0} : getdns.address() returned error: {1} " .format(hostname, status)
@@ -514,7 +523,7 @@ At the present time we support one utility method.
514
523
515
524
.. code-block :: python
516
525
517
- if results.replies_full[' status' ] != getdns.GETDNS_RESPSTATUS_GOOD :
526
+ if results.replies_full[' status' ] != getdns.RESPSTATUS_GOOD :
518
527
print (getdns.get_errorstr_by_id(id = results.replies_full[' status' ])
519
528
sys.exit(1 )
520
529
0 commit comments