The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,465 other followers

For my link archive: DNS over https

Posted by jpluimers on 2021/09/02

DNS over HTTPS

For my link archive:

JSON DNS output

Some DNS over HTTSP providers support dns-json, which Cloudflare delivers non-pretty printed.

To pretty print in the same order as the input, pipe through json_pp or python -m json.tool which however will sort (either alphabetically or by dictionary hash) the output.

If you like jq and colourised output, then you can pipe through jq .  as well  (which does not sort the nodes).

Piping curl output requires the curl --silent parameter to suppress progress reporting.

See these for more information:

Example:

$ curl --header 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=atlassian-domain-for-localhost-connections-only.com&type=A'
{"Status": 0,"TC": false,"RD": true, "RA": true, "AD": false,"CD": false,"Question":[{"name": "atlassian-domain-for-localhost-connections-only.com.", "type": 1}],"Answer":[{"name": "atlassian-domain-for-localhost-connections-only.com.", "type": 1, "TTL": 1761, "data": "127.0.0.1"}]}
$ curl --silent --header 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=atlassian-domain-for-localhost-connections-only.com&type=A' | json_pp
{
   "Status" : 0,
   "AD" : false,
   "Question" : [
      {
         "type" : 1,
         "name" : "atlassian-domain-for-localhost-connections-only.com."
      }
   ],
   "CD" : false,
   "RD" : true,
   "RA" : true,
   "TC" : false,
   "Answer" : [
      {
         "type" : 1,
         "TTL" : 813,
         "name" : "atlassian-domain-for-localhost-connections-only.com.",
         "data" : "127.0.0.1"
      }
   ]
}
$ curl --silent --header 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=atlassian-domain-for-localhost-connections-only.com&type=A' | jq .
{
  "Status": 0,
  "TC": false,
  "RD": true,
  "RA": true,
  "AD": false,
  "CD": false,
  "Question": [
    {
      "name": "atlassian-domain-for-localhost-connections-only.com.",
      "type": 1
    }
  ],
  "Answer": [
    {
      "name": "atlassian-domain-for-localhost-connections-only.com.",
      "type": 1,
      "TTL": 218,
      "data": "127.0.0.1"
    }
  ]
}

Based on [WayBack] How to check whether DNS is working through a browser? – Super User

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: