I've built this using Go, my daily driver. It doesn't use any CLI frameworks, that was mostly out of choice as I didn't want to add external deps unless really required. My favourite part was to build this small help.go[3] utility which renders colored/formatted help text.
Over the time I got some good quality external contributions, especially the one from @jedisct1 for adding DNSCrypt[2] support to it.
Releasing a v1.0 has been on the back burner forever (like, a whole year+ :'). Life, other projects, and probably a bit of procrastination got in the way. Finally sat down last week and forced myself to come up with a deadline to push this out.
[1]: https://mrkaran.dev/posts/ndots-kubernetes/
[2]: https://github.com/mr-karan/doggo/pull/17
[3]: https://github.com/mr-karan/doggo/blob/main/cmd/help.go
It's totally inspired from dog which is written in Rust. I wanted to add some features to it but since I don't know Rust, I found it as a nice opportunity to experiment with writing a DNS Client from scratch in Go myself. Hence the name dog +go => doggo."
It'd be great if communities could adopt the Go backwards compatibility promise[0] (it's best-effort, after all) so that packages continue to compile for a decade into the future and only introduce breaking changes for security reasons.
It's actually not that difficult to do -- just needs to be made an important goal of any project, and it makes it much easier to trust the stability of the dependency.
ubuntu $ (new) target/release/dog google.com
A google.com. 2m13s 142.250.189.206
NS 15h15m07s A "i.root-servers.net."
NS 15h15m07s A "d.root-servers.net."
NS 15h15m07s A "a.root-servers.net."
NS 15h15m07s A "b.root-servers.net."
NS 15h15m07s A "c.root-servers.net."
NS 15h15m07s A "f.root-servers.net."
NS 15h15m07s A "e.root-servers.net."
NS 15h15m07s A "h.root-servers.net."
NS 15h15m07s A "m.root-servers.net."
NS 15h15m07s A "j.root-servers.net."
NS 15h15m07s A "k.root-servers.net."
NS 15h15m07s A "g.root-servers.net."
NS 15h15m07s A "l.root-servers.net."
A a.root-servers.net. 2d10h37m14s + 198.41.0.4
ubuntu $ (new) git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Cargo.lock
modified: dns-transport/Cargo.toml
no changes added to commit (use "git add" and/or "git commit -a")
ubuntu $ (new) git diff dns-transport/Cargo.toml
diff --git a/dns-transport/Cargo.toml b/dns-transport/Cargo.toml
index 67552c3..d68d542 100644
--- a/dns-transport/Cargo.toml
+++ b/dns-transport/Cargo.toml
@@ -19,6 +19,8 @@ log = "0.4"
# tls networking
native-tls = { version = "0.2", optional = true }
+openssl-sys = ">=0.9.102"
+openssl = ">=0.10.64"
# http response parsing
httparse = { version = "1.3", optional = true }
docker run --rm -it ghcr.io/mr-karan/doggo:latest mrkaran.dev MX
Short answer: Why not :)
It's a lot of code to "just run a UDP packet" IMHO.
~ doggo google.com
NAME TYPE CLASS TTL ADDRESS NAMESERVER
google.com. A IN 296s 142.250.67.14 127.0.2.2:53
google.com. A IN 296s 142.250.67.14 127.0.2.3:53
~ doggo news.ycombinator.com
NAME TYPE CLASS TTL ADDRESS NAMESERVER
news.ycombinator.com. A IN 1s 209.216.230.207 127.0.2.2:53
news.ycombinator.com. A IN 1s 209.216.230.207 127.0.2.3:53
You could have a look at https://dnsdiag.org/ that provides a few tools for further introspection in the many (different) answers resolvers can give.
doggo google.com --short
142.250.185.238
Will release soon
Here is a demo video, you can take a look: https://x-cmd.com/pkg/doggo
> It's totally inspired from dog which is written in Rust. I wanted to add some features to it but since I don't know Rust, I found it as a nice opportunity to experiment with writing a DNS Client from scratch in Go myself. Hence the name dog +go => doggo.
There’s are a bunch of cli tools: dig like tool called ‘dns’, a stub resolver called ‘resolve’, a recursive resolver called ‘recurse’, and some other random maintenance tools. These are all to make it easier to test certain details outside other people’s dependency trees.
The documentation is a little sparse…
Both ask for the specific query to run (A, AAAA, etc.). Why not default to query all records? (at least when querying a single domain).
--
---
1: https://en.wikipedia.org/wiki/List_of_DNS_record_types#/medi...
Python, Java, JavaScript, C#, etc. can't say the same.
To be fair, I do not think the author understands what static binaries are and why they may or may not want them, and how what Go does differs to what C/C++ toolchain does. I’d be very surprised if they do, being a Go developer. Next time they will learn another excuse to promote their language.
From the readme:
> It's totally inspired from dog [0] which is written in Rust. I wanted to add some features to it but since I don't know Rust, I found it as a nice opportunity to experiment with writing a DNS Client from scratch in Go myself. Hence the name dog +go => doggo.
go: downloading github.com/mr-karan/doggo v0.5.7
go: github.com/mr-karan/doggo/cmd@latest:
module github.com/mr-karan/doggo@latest found (v0.5.7),
but does not contain package github.com/mr-karan/doggo/cmd
go install github.com/mr-karan/doggo/cmd@latest
go: downloading github.com/mr-karan/doggo v1.0.0
go install github.com/mr-karan/doggo/cmd/doggo@v1.0.2
2. What is there to configure?
3. It’s a Go program, so compilation happens transparently on installation provided the developers don’t release broken code. This isn’t the C/C++ world where you have complex bespoke build systems that only seem to work on the developers’ machines.
2- I meant run the configure file. Typically configures in what folder you install the program, under what user, that kind of stuff. I'm just alluding to the whole open source installation process, which is more complex than installing an .msi on Windows, or installing an apt distributed .deb package on debian.
3- oh, ok sure. Btw, now I have to install a go compiler. In order to install a program that's been done 100 times by first year Comp Sci students. I'd rather kill myself.
Is there a way to query all DNS records? (I was surprised to learn that isn't the default.) This would be really helpful for troubleshooting people's Caddy questions (which are actually DNS problems).
At Andrew McWatters & Co., we use a small internal utility called digany(1)[1][2] that does this for you.
[1]: https://github.com/andrewmcwattersandco/digany
[2]: https://github.com/andrewmcwattersandco/digany/blob/main/dig...
andrewmcwatters@Andrews-MacBook-Pro digany % ./digany andrewmcwatters.com
andrewmcwatters.com. 1799 IN A 107.172.29.10
andrewmcwatters.com. 1800 IN NS dns1.registrar-servers.com.
andrewmcwatters.com. 1800 IN NS dns2.registrar-servers.com.
andrewmcwatters.com. 3601 IN SOA dns1.registrar-servers.com. hostmaster.registrar-servers.com. 1719805485 43200 3600 604800 3601
andrewmcwatters.com. 1800 IN MX 20 eforward5.registrar-servers.com.
andrewmcwatters.com. 1800 IN MX 15 eforward4.registrar-servers.com.
andrewmcwatters.com. 1800 IN MX 10 eforward1.registrar-servers.com.
andrewmcwatters.com. 1800 IN MX 10 eforward2.registrar-servers.com.
andrewmcwatters.com. 1800 IN MX 10 eforward3.registrar-servers.com.
andrewmcwatters.com. 1799 IN TXT "google-site-verification=39W1-Db36mrNNekPXww8TUdo7LcrmEUfv-gBmVTT1Dk"
andrewmcwatters.com. 1799 IN TXT "v=spf1 include:spf.efwd.registrar-servers.com a:andrewmcwatters-17ce78.andrewmcwatters.com ~all"
...
However, each lookup happens serially right now, I'll take a look at making it concurrent per resolver atleast.
Edit: I just pushed the concurrent version of lookups in each resolver. Speed up is quite good around 70-80% on most domains. Will test this more before releasing to main!
https://github.com/mr-karan/doggo/pull/128#issuecomment-2202...
alias doggo-all='doggo $1 A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME CSYNC DHCID DLV DNAME DNSKEY DS EUI48 EUI64 HINFO HIP HTTPS IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM OPENPGPKEY RRSIG RP SIG SMIMEA SOA SRV SSHFP SVCB TLSA TSIG TXT URI ZONEMD ${2:+@$2}'
doggo-all example.com @1.1.1.1
$ doggo google.com A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME CSYNC DHCID DLV DNAME DNSKEY DS EUI48 EUI64 HINFO HIP HTTPS IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM OPENPGPKEY RRSIG RP SIG SMIMEA SOA SRV SSHFP SVCB TLSA TSIG TXT URI ZONEMD
It takes 5+ seconds to get a response.Classic `dig` though takes 50ms.
https://github.com/mr-karan/doggo/pull/128#issuecomment-2202...
time doggo google.com A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME CSYNC DHCID DLV
0.02s user 0.02s system 1% cpu 2.981 total
Meanwhile, the docs link is https://doggo.mrkaran.dev/docs/
BTW I really enjoyed reading your blog on Nomad while setting up our own clusters, kudos!
BTW, the "visit demo" link in the docs returns 404.
Yes, you can run the web server locally: https://github.com/mr-karan/doggo/tree/main/web
cd web
go run .
$ geodns ycombinator.com
108.156.133.117 Singapore
108.156.133.21 Singapore
108.156.133.25 Singapore
108.156.133.59 Singapore
108.156.39.26 London
108.156.39.61 London
108.156.39.62 London
108.156.39.64 London
13.32.27.123 Frankfurt am Main
13.32.27.47 Frankfurt am Main
13.32.27.51 Frankfurt am Main
13.32.27.80 Frankfurt am Main
13.35.93.12 Clifton
13.35.93.14 Clifton
13.35.93.46 Clifton
13.35.93.47 Clifton
18.239.94.100 Amsterdam
18.239.94.114 Amsterdam
18.239.94.33 Amsterdam
18.239.94.79 Amsterdam
99.86.20.42 Doddaballapura
99.86.20.54 Doddaballapura
99.86.20.64 Doddaballapura
99.86.20.96 Doddaballapura
https://gitlab.com/shodan-public/geonet-rs > dig +short news.ycombinator.com
209.216.230.207
> ipinfo 209.216.230.207
{
"ip": "209.216.230.207",
"hostname": "news.ycombinator.com",
"city": "San Diego",
"region": "California",
"country": "US",
"loc": "32.7157,-117.1647",
"org": "AS21581 M5 Computer Security",
"postal": "92101",
"timezone": "America/Los_Angeles",
"readme": "https://ipinfo.io/missingauth"
}
It was moved to AWS temporarily the last time the servers failed: https://news.ycombinator.com/item?id=32031136 curl -H "accept: application/dns-json" "https://cloudflare-dns.com/dns-query?name=ycombinator.com&type=A"
$ curl ipkitten.com
27.44.144.144
And if you visit it in a browser, you get your IP address and a kitten GIF!: $ curl ipinfo.io/json
or you can look up these details for any other IP: $ curl ipinfo.io/18.18.18.18
It has a ton of bells and whistles, including summarize IPs, bulk enrichment, grepip, and a ton of network-related tools. I was writing a series of blog posts on the CLI, but I think the series got too long and left users to discover the features of the CLI on their own.
ifconfig.me/ip
curl ifconfig.me
Dig was an early and widespread DNS CLI tool. "dog" is a logical name for a next-gen dns cli, and of course that exists. "Doggo" is both a pretty standard linguistic drift pattern of English slang (random -> rando, weird -> weirdo), a common internet term of endearment for "dog", and a logical derivation of *-go for go-based tools and software.