Dogs can look up!
dog is a command-line DNS client, like dig.
It has colourful output, understands normal command-line argument syntax, supports the DNS-over-TLS and DNS-over-HTTPS protocols, and can emit JSON.
dog example.net Query a domain using default settings
dog example.net MX ...looking up MX records instead
dog example.net MX @1.1.1.1 ...using a specific nameserver instead
dog example.net MX @1.1.1.1 -T ...using TCP rather than UDP
dog -q example.net -t MX -n 1.1.1.1 -T As above, but using explicit arguments
-q, --query <HOST> Host name or domain name to query
-t, --type <TYPE> Type of the DNS record being queried [possible values: A, AAAA, ANAME, ANY, AXFR, CAA, CNAME, DNSKEY, DS, HINFO, HTTPS, IXFR, MX, NAPTR, NS, NULL, OPENPGPKEY, OPT, PTR, SOA, SRV, SSHFP, SVCB, TLSA, TXT, RRSIG, NSEC, NSEC3, NSEC3PARAM, TSIG, CDS, CDNSKEY, CSYNC, KEY, SIG]
-n, --nameserver <ADDR> Address of the nameserver to send packets to
--class <CLASS> Network class of the DNS record being queried (IN, CH, HS)
--edns <SETTING> Whether to OPT in to EDNS (disable, hide, show)
--txid <NUMBER> Set the transaction ID to a specific value
-Z <TWEAKS> Set uncommon protocol tweaks
-U, --udp Use the DNS protocol over UDP
-T, --tcp Use the DNS protocol over TCP
-S, --tls Use the DNS-over-TLS protocol
-H, --https Use the DNS-over-HTTPS protocol
--color <WHEN> When to use terminal colors
--colour <WHEN> When to use terminal colours
-J, --json Display the output as JSON
--seconds Do not format durations, display them as seconds
-1, --short Short mode: display nothing but the first result
-V, --version Print version information
-?, --help Print list of command-line options
-l, --list List known DNS record types
-v, --verbose Print verbose information
--completions <SHELL> Generate shell completions
Instead of using the -q, -t, and -n flags, you can provide the arguments directly:
dog lookup.dog Query a domain
dog lookup.dog MX Query a domain for a specific type
dog lookup.dog @8.8.8.8 Query a domain using a specific nameserver
dog 1.1.1.1 Perform a reverse lookup for an IP address
dog supports the following record types: A, AAAA, ANAME, ANY, AXFR, CAA, CDNSKEY, CDS, CNAME, CSYNC, DNSKEY, DS, HINFO, HTTPS, IXFR, KEY, MX, NAPTR, NS, NSEC, NSEC3, NSEC3PARAM, NULL, OPENPGPKEY, OPT, PTR, RRSIG, SIG, SOA, SRV, SSHFP, SVCB, TLSA, TSIG, TXT.
To install dog, you can download a pre-compiled binary, or you can compile it from source. You may be able to install dog using your OS’s package manager, depending on your platform.
- For Arch Linux, install the
dogpackage. - For Homebrew on macOS, install the
dogformula. - For NixOS, install the
dogdnspackage.
Binary downloads of dog are available from the releases section on GitHub for 64-bit Windows, macOS, and Linux targets. They contain the compiled executable, the manual page, and shell completions.
dog is written in Rust. You will need rustc version 1.45.0 or higher. The recommended way to install Rust for development is from the official download page, using rustup.
To build, download the source code and run:
$ cargo build
$ cargo test
-
If you are compiling a copy for yourself, be sure to run
cargo build --releaseto benefit from release-mode optimisations. Copy the resulting binary, which will be in thetarget/releasedirectory, into a folder in your$PATH./usr/local/binis usually a good choice. -
To compile and install the manual pages, you will need pandoc. The
just mancommand will compile the Markdown into manual pages, which it will place in thetarget/mandirectory. To use them, copy them into a directory thatmanwill read./usr/local/share/manis usually a good choice.
To build the container image of dog, you can use Docker or Kaniko. Here an example using Docker:
$ docker build -t dog .
You can then run it using the following command:
$ docker run -it --rm dog
To run dog directly, you can then define the following alias:
$ alias dog="docker run -it --rm dog"
dog has an integration test suite written as Specsheet check documents. If you have a copy installed, you can run:
$ just xtests
Specsheet will test the compiled binary by making DNS requests over the network, checking that dog returns the correct results and does not crash. Note that this will expose your IP address. For more information, read the xtests README.
mutt, tail, sleep, roff
dog’s source code is licensed under the GNU General Public License v3.0. (Original upstream code by Benjamin Sago licensed under EUPL-1.2).
