{"id":13466128,"url":"https://github.com/picatz/doh","last_synced_at":"2025-04-05T22:04:32.233Z","repository":{"id":34875472,"uuid":"157996951","full_name":"picatz/doh","owner":"picatz","description":"🍩  DNS over HTTPS command-line client","archived":false,"fork":false,"pushed_at":"2025-03-24T01:44:04.000Z","size":184,"stargazers_count":108,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T21:03:10.646Z","etag":null,"topics":["cli-app","cloudflare","dns-over-https","golang","google","quad9"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/picatz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-17T15:20:11.000Z","updated_at":"2025-03-04T11:39:05.000Z","dependencies_parsed_at":"2024-01-20T02:46:28.445Z","dependency_job_id":"1da9c345-a931-4662-910f-154a03f39099","html_url":"https://github.com/picatz/doh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picatz%2Fdoh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picatz%2Fdoh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picatz%2Fdoh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picatz%2Fdoh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/picatz","download_url":"https://codeload.github.com/picatz/doh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406085,"owners_count":20933803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-app","cloudflare","dns-over-https","golang","google","quad9"],"created_at":"2024-07-31T15:00:39.553Z","updated_at":"2025-04-05T22:04:32.213Z","avatar_url":"https://github.com/picatz.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# doh\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/picatz/doh/blob/master/LICENSE)\n[![go report](https://goreportcard.com/badge/github.com/picatz/doh)](https://goreportcard.com/report/github.com/picatz/doh)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/picatz/doh/pulls)\n\n\u003e 🍩  DNS over HTTPs command-line client\n\nUsing [`cloudflare`](https://developers.cloudflare.com/1.1.1.1/dns-over-https/), [`google`](https://developers.google.com/speed/public-dns/docs/dns-over-https), and [`quad9`](https://quad9.net/doh-quad9-dns-servers/) the `doh` command-line utility can concurrently lookup all three sources for one or more given domain(s). You can even specify your own custom source to use.\n\n\u003e [!NOTE]\n\u003e Since `doh` outputs everything as JSON, it pairs really well with tools like [`jq`](https://stedolan.github.io/jq/) to parse relevant parts of the output for your purposes.\n\n# Install\n\nTo get started, you will need [`go`](https://golang.org/doc/install) installed and properly configured.\n\n```shell\n$ go install -v github.com/picatz/doh@latest\n```\n\n# Help Menus\n\nThe `--help` command-line flag can show you the top-level help menu.\n\n```console\n$ doh --help\ndoh is a CLI for querying DNS records from DoH servers\n\nUsage:\n  doh [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  help        Help about any command\n  query       Query DNS records from DoH servers\n\nFlags:\n  -h, --help   help for doh\n\nUse \"doh [command] --help\" for more information about a command.\n```\n\nTo get more information for the `query` command:\n```console\n$ doh query --help\nQuery DNS records from DoH servers using the given domains and record type.\n\nUsers can specify which servers to use for the query, or use the default servers from Google, Cloudflare, and Quad9.\nThey can also specify a timeout for the query, which defaults to 30 seconds if not specified. Each server is queried\nin parallel, and each domain is queried in parallel. Results are streamed to STDOUT as JSON newline delimited objects,\nwhich can be piped to other commands (e.g. jq) or redirected to a file.\n\nUsage:\n  doh query domains... [flags]\n\nFlags:\n  -h, --help                      help for query\n  -k, --insecure-skip-verify      allow insecure server connections (e.g. self-signed TLS certificates)\n      --resolver-addr string      address of a DNS resolver to use for resolving DoH server names (e.g. 8.8.8.8:53)\n      --resolver-network string   protocol to use for resolving DoH server names (e.g. udp, tcp) (default \"udp\")\n      --retry-max int             maximum number of retries for each query (default 10)\n      --servers strings           servers to query (default [https://dns.google/dns-query,https://cloudflare-dns.com/dns-query,https://dns.quad9.net:5053/dns-query])\n      --timeout duration          timeout for query, 0s for no timeout (default 30s)\n      --type string               dns record type to query for each domain, such as A, AAAA, MX, etc. (default \"A\")\n```\n\n# Example Usage\n\nLet's say we're curious about `google.com`'s IPv4 address. We can use `doh` to query three different sources (Google, Cloudflare, and Quad9) for the DNS `A` record type:\n\n```console\n$ doh query google.com\n{\"server\":\"https://dns.google.com/resolve\",\"resp\":{\"Status\":0,\"TC\":false,\"RD\":true,\"RA\":true,\"AD\":false,\"CD\":false,\"Question\":[{\"name\":\"google.com.\",\"type\":1}],\"Answer\":[{\"name\":\"google.com.\",\"type\":1,\"TTL\":283,\"data\":\"172.217.2.46\"}]}}\n{\"server\":\"https://cloudflare-dns.com/dns-query\",\"resp\":{\"Status\":0,\"TC\":false,\"RD\":true,\"RA\":true,\"AD\":false,\"CD\":false,\"Question\":[{\"name\":\"google.com\",\"type\":1}],\"Answer\":[{\"name\":\"google.com\",\"type\":1,\"TTL\":129,\"data\":\"142.251.178.101\"},{\"name\":\"google.com\",\"type\":1,\"TTL\":129,\"data\":\"142.251.178.138\"},{\"name\":\"google.com\",\"type\":1,\"TTL\":129,\"data\":\"142.251.178.113\"},{\"name\":\"google.com\",\"type\":1,\"TTL\":129,\"data\":\"142.251.178.102\"},{\"name\":\"google.com\",\"type\":1,\"TTL\":129,\"data\":\"142.251.178.100\"},{\"name\":\"google.com\",\"type\":1,\"TTL\":129,\"data\":\"142.251.178.139\"}]}}\n{\"server\":\"https://dns.quad9.net:5053/dns-query\",\"resp\":{\"Status\":0,\"TC\":false,\"RD\":true,\"RA\":true,\"AD\":false,\"CD\":false,\"Question\":[{\"name\":\"google.com.\",\"type\":1}],\"Answer\":[{\"name\":\"google.com.\",\"type\":1,\"TTL\":34,\"data\":\"142.250.191.142\"}]}}\n```\n\nTo get just all of the IPs from all of those sources, we could do the following:\n\n```console\n$ doh query google.com | jq -r '.resp.Answer[0].data'\n172.217.2.46\n142.251.178.113\n142.250.191.142\n```\n\nWe can also query multiple domains at once:\n\n```console\n$ doh query bing.com google.com | jq -r '(.resp.Answer[0].name|rtrimstr(\".\")) + \"\\t\" + .resp.Answer[0].data' | sort -n\nbing.com        13.107.21.200\nbing.com        204.79.197.200\nbing.com        204.79.197.200\ngoogle.com      142.250.191.142\ngoogle.com      142.251.178.102\ngoogle.com      172.217.0.174\n```\n\nTo get `IPv6` records, we'll need to specify the `--type` flag, like so:\n\n```console\n$ doh query google.com --type AAAA\n...\n```\n\nTo get `MX` records:\n\n```console\n$ doh query google.com --type MX\n...\n```\n\nTo get `ANY` records (which is only implemented by Google at the moment):\n\n```console\n$ doh query google.com --type ANY --servers=https://dns.google.com/resolve\n...\n```\n\n\u003e [!TIP]\n\u003e  To use a custom DNS over HTTPs source, specify the URL with the `--servers` flag.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicatz%2Fdoh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpicatz%2Fdoh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicatz%2Fdoh/lists"}