Skip to content

Instantly share code, notes, and snippets.

@userid
Forked from bagder/simple-doh.c
Created September 3, 2019 09:40
Show Gist options
  • Save userid/2bc208428b2568879dc64ca670115a85 to your computer and use it in GitHub Desktop.
Save userid/2bc208428b2568879dc64ca670115a85 to your computer and use it in GitHub Desktop.
libcurl example using DOH
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://curl.haxx.se/");
curl_easy_setopt(curl, CURLOPT_DOH_URL,
"https://dns.cloudflare.com/.well-known/dns-query");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment