Skip to content
🍩 DNS over HTTPs command-line client
Branch: master
Clone or download
Latest commit 532416b Nov 28, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
core Update core/sources/quad9.go Nov 17, 2018
.gitattributes Initial commit Nov 17, 2018
LICENSE Initial commit Nov 17, 2018 Update Nov 27, 2018
main.go Update main.go Nov 18, 2018


🍩 DNS over HTTPs command-line client

Using cloudflare, google, and quad9 the doh command-line utility can concurrently lookup all three sources for one or more given domain(s).

Note: Since doh outputs everything as JSON, it pairs really well with tools like jq to parse relevant parts of the output for your purposes.


To get started, you will need go installed and properly configured.

$ go get


As new updates come out, you can update doh using the -u flag with go get.

$ go get -u

Help Menus

The --help command-line flag can show you the top-level help menu.

$ doh --help
  doh [command]

Available Commands:
  help        Help about any command
  query       Query domains for DNS records in JSON

  -h, --help   help for doh

Use "doh [command] --help" for more information about a command.

To get more information for the query command:

$ doh query --help
Query domains for DNS records in JSON

  doh query [domains] [flags]

  -h, --help              help for query
      --joined            join results into a JSON object
      --labels            show source of the dns record
      --limit int         limit the number of responses from backend sources (default 1)
      --lock int          number of concurrent workers (default 8)
      --no-limit          do not limit results
      --no-timeout        do not timeout
      --sources strings   sources to use for query (default [google,cloudflare,quad9])
      --timeout int       number of seconds until timeout (default 30)
      --type string       dns record type to query for ("A", "AAAA", "MX" ...) (default "A")
      --verbose           show errors and other available diagnostic information

Example Usage

Let's say I'm curious about's IPv4 address and want to use doh to find out what it is.

$ doh query 

You can see the source of the DNS record using the --labels flag:

$ doh query --labels

You can wait for responses from all sources with the --no-limit flag:

$ doh query --labels --no-limit

To get just all of the IPs from all of those sources, we could do the following:

$ doh query --no-limit --joined | jq 'map(.Answer | map(.data)) | flatten | .[]' --raw-output

If we want to filter the output to just the first IP address in the first JSON record with jq:

$ doh query | jq .Answer[0].data --raw-output

Now, perhaps isn't the only record we're also interested in, since we also want, which is where the cool kids are at.

$ doh query --limit 2 | jq '(.Answer[0].name|rtrimstr(".")) + "\t" + .Answer[0].data' --raw-output

To get IPv6 records, we'll need to specify the --type flag, like so:

$ doh query --type AAAA

To get MX records:

$ doh query --type MX

To get ANY records (which is only implemented by the google source):

$ doh query --type ANY --sources=google
You can’t perform that action at this time.