[dns-operations] good async DNS library

Matthew Pounsett matt at conundrum.com
Tue Apr 30 18:27:20 UTC 2019


On Tue, 30 Apr 2019 at 10:59, Petr Špaček <petr.spacek at nic.cz> wrote:
>
>

> > For python, dnspython is an excellent library for writing an
> > application that needs answers out of the DNS, but falls short when it
> > comes to features you need for doing testing.    It really wants to be
> > either a stub resolver or a recursive resolver, so it takes a bunch of
> > boilerplate code to just send a single -RD query to a single server
> > and get back a reasonable response.  It also tends to do undesirable
> > things like throw exceptions for successful responses, because it
> > thinks answers like NXDOMAIN are errors.  And for testing zone
>
> Maybe you should have a look at low level interface, it is actually two
> lines of useful code (once you have libraries imported):
>
> query = dns.message.make_query('www.example.com.', 'A')
> answer = dns.query.udp(query, '192.0.2.1')
> print(answer.rcode())

What one actually needs to do there, for decent testing code, is to
write an entirely new helper method that takes care of timeouts,
fallback from UDP to TCP, etc..   That middle ground is what's missing
from (that part of) the library.  The zone transfers are a similar
issue; there's really low level functions you can use to generate a
and send a message by hand, writing all of your own timeout and
fallback code, or there's the helper function that does everything for
you but doesn't provide any insight into the response.

If I'm ever in a position where I'm writing that helper function again
(I've done it four times now), and whoever's paying me to write it is
amenable, I will contribute it back to the project.




More information about the dns-operations mailing list