ogham / dog

A command-line DNS client.
https://dns.lookup.dog/
European Union Public License 1.2
5.96k stars 164 forks source link
client command-line dns rust

dog

[dog](https://dns.lookup.dog/) is a command-line DNS client. Build status Say thanks!

A screenshot of dog making a DNS request


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.

Examples

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

Command-line options

Query options

<arguments>              Human-readable host names, nameservers, types, or classes
-q, --query=HOST         Host name or domain name to query
-t, --type=TYPE          Type of the DNS record being queried (A, MX, NS...)
-n, --nameserver=ADDR    Address of the nameserver to send packets to
--class=CLASS            Network class of the DNS record being queried (IN, CH, HS)

Sending options

--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-level tweaks

Protocol options

-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

Output options

-1, --short              Short mode: display nothing but the first result
-J, --json               Display the output as JSON
--color, --colour=WHEN   When to colourise the output (always, automatic, never)
--seconds                Do not format durations, display them as seconds
--time                   Print how long the response took to arrive

Installation

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.

Packages

Downloads

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.

Compilation

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

Container image

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"

End-to-end testing

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.

Feature toggles

dog has three Cargo features that can be switched off to remove functionality. While doing so makes dog less useful, it results in a smaller binary that takes less time to build.

There are three feature toggles available, all of which are active by default:

Use cargo to build a binary that uses feature toggles. For example, to disable TLS and HTTPS support but keep IDNA support enabled, you can run:

$ cargo build --no-default-features --features=with_idna

The list of features that have been disabled can be checked at runtime as part of the --version string.


Documentation

For documentation on how to use dog, see the website: https://dns.lookup.dog/

See also

mutt, tail, sleep, roff

Licence

dog’s source code is licenced under the European Union Public Licence.