Add dns.hpp: the DNS resolver

This diff implements a plain DNS resolver that can be used
by the net/connection code to resolve DNS names.
dns.hpp: implement custom DNS resolver

A custom DNS resolver is needed to implement OONI's dnst.
dns.hpp tests: check for timeout when server is nonexistent

While there, avoid calling one member `result` and another `results`
because this is very very very confusing.
dns.hpp tests: add pathological test case

One may be tempted to pass the return value of DNSResolver() to
DNSRequest() to avoid saving a resolver.

The code is not designed to support this use case (supporting this
use case requires to implement reference counting of the DNS resolver
object, and we don't want to go down that road).

So, at least make sure that using the code like this does not
lead to crashing libight.
dns.hpp tests: check that it's safe to forget about pending requests
dns.hpp tests: check that it's safe to cancel pending responses
dns.hpp tests: add one more commented-out test
dns.hpp: improve relation between DNSRequest and DNSResolver

1) Do not automatically convert DNSResolver to event_base because code
   like the following

     auto reso = ight::DNSResolver(...);
     auto r = ight::DNSRequest("A", "www.neubot.org", [](void) {
         // nothing
     }, reso);

   may lead one to think that the following is OK

     auto r = ight::DNSRequest("A", "www.neubot.org", [](void) {
         // nothing
     }, ight::DNSResolver(...));

   while it is not.

   So, be explicit and replace the automatic cast with an explicit
   ->get_evdns_base() method.

2) While at it, introduce syntactic sugar by which one could construct
   a request from a resolver such that the following

     auto reso = ight::DNSResolver(...);
     auto r = ight::DNSRequest("A", "www.neubot.org", [](void) {
         // nothing
     }, reso.get_evdns_base());

   could be more intuitively written as

     auto reso = ight::DNSResolver(...);
     auto r = reso.request("A", "www.neubot.org", [](void) {
         // nothing
     });
dns.hpp: fix incorrect DNSResolver.request() return value

After c59571685099, DNSResolver.request() returned a DNSRequest&&
using std::move(). This was wrong, because the underlying state was
destroyed when the stack was unwinded, so the actually returned
request contained a NULL state. As a consequence, no callback was
called when the response was received, and all tests failed.

This leads me to explaining why I assumed that the problem was
caused by libevent rather than by c59571685099, as I wrote when I
closed pull request #41 on github.

Basically, when the test failed I throwed a runtime_error to exit
libevent's event loop. The problem with this approach is that the
event loop is not properly exited. Therefore, when next tests run,
libevent failed to enter the event loop because another loop was
already running (libevent has no knowledge of exceptions).

This explains the libevent warning messages, and explains why I
believed the problem was related to libevent on different platforms.

Our poller can probably be improved such that it catches exceptions
around libevent's event loop and such that libevent's event loop
is properly exited in such case?

Returning to this commit, after I fixed the above bug I also needed
to tweak tests checking for specific IPv6 addresses, since they
were represented differently by different platforms.

Moreover, I also needed to rewrote the test checking that if the
resolver dies request are aborted, because after c59571685099 it
was simpler to check that using the heap rather than stack unwinding.

Finally, also the commented out last test was changed because it
was used to debug what was going on.
dns: refactor code to have also a .cpp file

Lately, I'm starting to like the idea that we don't expose
on the public header the private implementation details.
Include less headers in dns.hpp
dns: pass callback function using move semantic

While there, also fix a couple of imprecise comments.
dns: refactor to process result in DNSResponse constructor
dns: avoid leaks in regress tests

Thanks, valgrind!

While there, tweak a couple of comments.
dns: collect data usefult to compile OONI reports - step 1
Teach DNSRequest accessors to return OONI-report-friendly data
Fix eab20a0da... doofus

Lesson learned: "fixing" valgrind warnings can be very dangerous,
unless you think carefully at what you're doing.

In this case, the delete that I removed in eab20a0da... was used to
unschedule the request while it was in flight, and see whether something
bad happened becuase of this.

So, in eab20a0da... I fixed the leak but fucked the test.

Problem was, `delete` was used to unschedule the request, which is
implicit and not explicit, so more difficult to review.

To improve the code, I've added the `cancel()` method that only
cancels a pending request.
dns: map evdns errors to OONI failures
DNSResponse: the query can be generated if needed

Since the query is composed of name, type and class, one can
construct it using the getters of DNSResponse.
dns: query_type is always equal to reply_type

Evdns only passes to us resources of the type that we have
requested, all the rest is skipped, e.g.:

    https://github.com/libevent/libevent/blob/master/evdns.c#L1112

Therefore, there is no need to store query_type when we issue
the query, because it will be equal to reply_type.