For my link archive: DNS over https
Posted by jpluimers on 2021/09/02
DNS over HTTPS
For my link archive:
- DNS over HTTPS – Wikipedia / Public recursive name server – Wikipedia
- [WayBack] RFC 8484 – DNS Queries over HTTPS (DoH)
- [WayBack] DNS over HTTPS · curl/curl Wiki · GitHub (which has a list of publicly available servers)
- [WayBack] A cartoon intro to DNS over HTTPS – Mozilla Hacks – the Web developer blog
- [WayBack] DNS over HTTPS – Cloudflare Resolver
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:
- [WayBack] Using JSON – Cloudflare Resolver
- [WayBack] unix – How can I pretty-print JSON in a shell script? – Stack Overflow
- [WayBack] GitHub – deftek/json_pp: json_pp – JSON Pretty Printer
- [WayBack] json_pp – JSON::PP command utility – metacpan.org
- [WayBack] JSON::PP – JSON::XS compatible pure-Perl module. – metacpan.org
- [WayBack] Stop Alphabetical Sorting? · Issue #561 · open-source-parsers/jsoncpp · GitHub
- [WayBack] curl hide progress bar output on Linux/Unix shell scripts – nixCraft
- [WayBack] Here Strings
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