support experimental DNS-over-HTTPS
Issue moved from https://github.com/CZ-NIC/knot-resolver/issues/24
Google DNS announced DNS-over-HTTPS. This is a great step towards a really new DNS API for application developers that doesn't force DNS consumers to understand how DNS works.
Problem
Given this, a client would require only a thin library to figure out which resolver to ask (instead of hardcoding user resolver) and payload could be delivered directly to client either understanding JSON (typically web browsers) or unpacking the JSON response to native structure in given library, and not cramming custom data types / event loops / whatever in the DNS library.
Deliverables
-
Lua module that starts an HTTPS server and listens for requests -
Translate the requests to internal DNS resolution lookups (already API for this) -
Convert DNS raw answer to schema in JSON -
Write a user-space library and tooling around it
Mock API library
struct dns_resolve {};
/*@ Select next address for query (if clients does DNS/HTTPS itself). */
char *dns_select_server(void);
/*@ Open DNS context for resolution. */
int dns_open(struct dns_resolve *context);
/*@ Submit a query, return file descriptor that the application can poll on. */
int dns_submit(struct dns_resolve *context, [query ...]);
/*@ Receive a DNS response object. */
<obj> dns_recv(struct dns_resolve *context);