Code Monkey home page Code Monkey logo

doggo's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ’ฌ Ask me about Devops, DNS, Monitoring, Self Hosting and such.
  • ๐Ÿ“ซ How to reach me: Twitter
  • ๐Ÿ˜„ Pronouns: he/him

doggo's People

Contributors

aliesbelik avatar binc4t avatar chenrui333 avatar dbready avatar dependabot[bot] avatar ffmiruz avatar gaeulbyul avatar huangnauh avatar ianbashford avatar jedisct1 avatar knadh avatar lyekumchew avatar ma27 avatar molikuner avatar mr-karan avatar neo2308 avatar sisheogorath avatar stefanb avatar ztheory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doggo's Issues

Feature request: need option to specific ip of DoH

If i query to https://cloudflare-dns.com/dns-query. Is it possible to specific ip for cloudflare-dns.com to some xxx.xxx.xxx.xxx ip?
In https://github.com/ameshkov/dnslookup have feture to specific ip for it. It's really good to have this feature in some use case.

Incorrect handling of search list

According to resolv.conf(5), "Resolver queries having fewer than ndots dots (default is 1) in them will be attempted using each component of the search path in turn until a match is found". That is, search stops at the first match.

Given:

one.a.sanxiyn.name A 1.1.1.1
one.b.sanxiyn.name A 1.1.1.1

and

search a.sanxiyn.name b.sanxiyn.name

Querying one should return one.a.sanxiyn.name. doggo returns both.

Should print error code

Compare:

$ dog one.sanxiyn.name
Status: NXDomain
SOA sanxiyn.name. 1h00m01s A "dns1.registrar-servers.com." "hostmaster.registrar-servers.com." 1608303233 12h00m00s 1h00m00s 7d0h00m00s 1h00m01s

and

$ doggo one.sanxiyn.name
NAME         	TYPE	CLASS	TTL  	ADDRESS                                                                                        	NAMESERVER
sanxiyn.name.	SOA 	IN   	3601s	dns1.registrar-servers.com. hostmaster.registrar-servers.com. 1608303233 43200 3600 604800 3601	192.168.0.1:53

Note Status: NXDomain. Unless it is NoError, error code should be printed.

Feature Request: Print Extended DNS Errors (EDE)

EDE (Extended DNS Errors - RFC8914) are starting to work their way into major recursive DNS services, such as:

Cloudflare:
https://developers.cloudflare.com/1.1.1.1/infrastructure/extended-dns-error-codes/

Google:
https://developers.google.com/speed/public-dns/docs/troubleshooting/domains#edes

It would be nice if Doggo could report these in the results.

Test domain that should results in EDE 22 (No Reachable Authority): txt: noreply-watch-123456.go.dnscheck.tools

$ dig noreply-watch-123456.go.dnscheck.tools txt @1.1.1.1
;; communications error to 1.1.1.1#53: timed out

; <<>> DiG 9.18.16 <<>> noreply-watch-123456.go.dnscheck.tools txt @1.1.1.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 53260
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; EDE: 22 (No Reachable Authority): (time limit exceeded)
;; QUESTION SECTION:
;noreply-watch-123456.go.dnscheck.tools.	IN TXT

;; Query time: 1063 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) (UDP)
;; WHEN: Mon Jul 24 16:26:46 CEST 2023
;; MSG SIZE  rcvd: 92
$ dig noreply-watch-123456.go.dnscheck.tools txt @8.8.8.8

; <<>> DiG 9.18.16 <<>> noreply-watch-123456.go.dnscheck.tools txt @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 50354
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
; EDE: 22 (No Reachable Authority): (At delegation go.dnscheck.tools for noreply-watch-123456.go.dnscheck.tools/txt)
;; QUESTION SECTION:
;noreply-watch-123456.go.dnscheck.tools.	IN TXT

;; Query time: 1016 msec
;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP)
;; WHEN: Mon Jul 24 16:38:36 CEST 2023
;; MSG SIZE  rcvd: 151

Easy Install Methods

Should have:

  • Fedora
  • Arch
  • Snap (enable classic mode)
  • One line installer script

Can Try:

  • brew for macOS

Installation using `go get` does not work

The issue

The README instructs to use the following command to install doggo through go get.

go get github.com/mr-karan/doggo/cmd/doggo

But it fails with this error:

go get: module github.com/mr-karan/doggo@upgrade found (v0.4.0), but does not contain package github.com/mr-karan/doggo/cmd/doggo

Possible cause

Looks like the CLI exists in cmd/doggo/cli for the 0.4.0 release - source.

Solution

  • Use go get github.com/mr-karan/doggo/cmd/doggo/cli
    • This causes the binary to be named cli instead of doggo
  • Make a new release?
    • Since it looks like the paths are fixed on main

Packing doggo for Nix

Hi,

I recently needed to use doggo but could not find it for Nix(OS). I therefore created a Nix package and opened a pull request for it on Nixpkgs.
I just wanted to share this here in case someone will participate in it.

Move main package

It would be useful to move the main package files from cmd to cmd/doggo.

This way the standard go get github.com/mr-karan/doggo/cmd/doggo would produce the correct binary name in $GOPATH/bin

Feature request(?): config var/file

Is there an existing facility to specify different defaults for command line options, either via config file (in XDG user dirs or otherwise) or via environment variable? For instance, I'd like to turn off color and use the random strategy by default on every query.

doggo does not build van Apple M1 monterey using golang 1.18

The problem reported when installing:
go install github.com/mr-karan/doggo/cmd/doggo@latest
go: downloading github.com/mr-karan/doggo v0.5.0
go: downloading github.com/fatih/color v1.10.0
go: downloading github.com/miekg/dns v1.1.40
go: downloading github.com/knadh/koanf v0.14.0
go: downloading github.com/sirupsen/logrus v1.7.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/ameshkov/dnsstamps v1.0.3
go: downloading github.com/olekukonko/tablewriter v0.0.4
go: downloading github.com/ameshkov/dnscrypt/v2 v2.2.1
go: downloading github.com/lucas-clemente/quic-go v0.24.0
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/mattn/go-runewidth v0.0.9
go: downloading golang.org/x/sys v0.0.0-20210510120138-977fb7262007
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
go: downloading github.com/mitchellh/mapstructure v1.2.2
go: downloading github.com/AdguardTeam/golibs v0.4.2
go: downloading github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da
go: downloading github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635
go: downloading github.com/cheekybits/genny v1.0.0
go: downloading github.com/marten-seemann/qtls-go1-17 v0.1.0

github.com/lucas-clemente/quic-go/internal/qtls

go/pkg/mod/github.com/lucas-clemente/[email protected]/internal/qtls/go118.go:6:13: cannot use "quic-go doesn't build on Go 1.18 yet." (untyped string constant) as int value in variable declaration

Feature Suggestion: Http3 Support

Some of the dns server have supported http3 connection (e.g. Google and Cloudflare). Maybe doggo can also add http3 support in the future, or the http3 support has been in progress?

[Request] Binary releases for arm 32 bits

First of all, thank you for this interesting and very usefull tool.
I stumbled upon it by chance and have been using it on my x86 pc's and servers.

It is very usefull that you release pre compiled binaries on github. These can be especially usefull in devices where you dont want to download 500 Mega of Go just to compile the tool. Or for maintainers of "-bin" package versions of linux distros distributions .

I noticed you also release binaries for arm. But that is only arm 64 bits (aarch64 etc).That leaves out a lot of usefull devices that are not ready for the trash. For example my Raspberry Pi Zero (armv6) many arm chromebooks (armv7h) etc. This doggo utility is also usefull there.

This tool is written in Go. An easy peasy language to compile and provide binaries compared to others.
Since you are automating all of this and using go-releaser, I wonder if it wouldnt just be a small change in that config, and not a lot of extra work to ask for ?

See for example how fzf does it, https://github.com/junegunn/fzf

I'm not 100 % sure but I, think, you dont even have to worry about all the different old arm versions. Only2 arm binaries are sufficient. One "aarch64"for 64bits (you already have it) and another one low common denominator "arm" for all the other 32bit arm's. One that works in armv5, armv6, armv7h etc.

Thanks in advance

Release new version to support Go 1.19

I'm creating an OpenBSD port for doggo with the latest version (0.5.4). I'm using Go 1.19 to build my port (currently supported version on OpenBSD-current / future version 6.3).

But I have an error during my build with Go version 1.19 because github.com/lucas-clemente/quic-go module v0.26.0 (version required for doggo v0.5.4) is not supported with Go 1.19 :

$ go build
(...)
github.com/lucas-clemente/quic-go/internal/qtls
# github.com/lucas-clemente/quic-go/internal/qtls
../../../go/pkg/mod/github.com/lucas-clemente/[email protected]/internal/qtls/go119.go:6:13: cannot use "quic-go doesn't build on Go 1.19 yet." (untyped string constant) as int value in variable declaration

Please could you release a new version (0.5.5 ?) of doggo for the latest requirements supported with Go 1.19 ?

clarification needed, or maybe bug - ndot ignored

First of all, thank you for doggo ๐Ÿถ

While running some tests on effect of NDOTS option in K8s pods, I've noticed a weirdness with doggo (v0.2.0 (4e5b074 2020-12-24T16:33:29Z))

The debug output suggested the ndots cli settings was ignored

# doggo --search --ndots=15 --debug -q qa-app-api.corp-qa.svc.cluster.local
DEBUG[2021-02-05T12:50:28Z] initiating UDP resolver
DEBUG[2021-02-05T12:50:28Z] Starting doggo ๐Ÿถ
DEBUG[2021-02-05T12:50:28Z] Attempting to resolve  domain=qa-app-api.corp-qa.svc.cluster.local. nameserver="10.96.0.10:53" ndots=0
NAME                                  	TYPE	CLASS	TTL	ADDRESS      	NAMESERVER
qa-app-api.corp-qa.svc.cluster.local.	A   	IN   	30s	10.108.49.117	10.96.0.10:53

I've expected to see doggo use the query as is, without adding a dot (what dig does).
And then how it iterates over search domains from /etc/resolv.conf until it exhausts all possibilities and returns NXDOMAIN or succeeds.

Something like this

dig +noall +showsearch +question +answer +search +ndots=15 @10.96.0.10 qa-app-api.corp-qa.svc.cluster.local
;qa-app-api.corp-qa.svc.cluster.local.corp-qa.svc.cluster.local. IN A
;qa-app-api.corp-qa.svc.cluster.local.svc.cluster.local. IN A
;qa-app-api.corp-qa.svc.cluster.local.cluster.local. IN	A
;qa-app-api.corp-qa.svc.cluster.local.dev.example.com.	IN A
;qa-app-api.corp-qa.svc.cluster.local.prod.example.com. IN A
;qa-app-api.corp-qa.svc.cluster.local. IN A
qa-app-api.corp-qa.svc.cluster.local. 30 IN A	10.108.49.117

Perhaps I'm using it wrong? Please clarify.

Hostname verification over TLS

Hi,

Just came across this doggo after looking for a way to do DoT lookups, looks neat and appreciate the colored formatting, nice work.

I want to do a lookup with a couple of specific nameservers but it requires tls hostname verification.

doggo google.se @tls://193.19.108.3
ERROR[2021-08-25T16:45:40+02:00] error looking up DNS records 
error="x509: cannot validate certificate for 193.19.108.3 because it doesn't contain any IP SANs"

Is there a way we can pass the expected hostname of the dns resolver like adblock.doh.mullvad.net for verification?
If I use doggo google.se @tls://adblock.doh.mullvad.net, the lookup succeeds but then I do not know which of mullvad's servers responded (there are 2 nameservers listed under adblock.doh.mullvad.net) and I want to be able to test them individually.

can not install with go 1.9

$ go install github.com/mr-karan/doggo/cmd/doggo@latest
# github.com/lucas-clemente/quic-go/internal/qtls
../dev/golang/libs/pkg/mod/github.com/lucas-clemente/[email protected]/internal/qtls/go119.go:6:13: cannot use "quic-go doesn't build on Go 1.19 yet." (untyped string constant) as int value in variable declaration
$ go version                                           
go version go1.19 linux/amd64
export GOROOT=~/dev/golang/go
export GOPATH=~/dev/golang/libs
export GOBIN=
export PATH=$PATH:$GOROOT/bin:${GOPATH//://bin:}/bin
export GO111MODULE=on
export GOPROXY=https://goproxy.cn,direct

Installing from source fails with `cannot use h.allow0RTT`

$ go install github.com/mr-karan/doggo/cmd/doggo@latest
# github.com/quic-go/quic-go/internal/handshake
../../go/pkg/mod/github.com/quic-go/[email protected]/internal/handshake/crypto_setup.go:334:37: cannot use h.allow0RTT (variable of type bool) as tls.QUICSessionTicketOptions value in argument to h.conn.SendSessionTicket

$ go version
go version go1.21.0 darwin/arm64

Release new version to support Go 1.20

I'm updating my OpenBSD port for doggo with the latest version (0.5.5). I'm using Go 1.20 to build my port (currently supported version on OpenBSD-current / future version 6.4).

But I have an error during my build with Go version 1.20 because github.com/lucas-clemente/quic-go module v0.31.1 (version required for doggo v0.5.5) is not supported:

$ go build
(...)
github.com/lucas-clemente/quic-go/internal/qtls
# github.com/lucas-clemente/quic-go/internal/qtls
../../../go/pkg/mod/github.com/lucas-clemente/[email protected]/internal/qtls/go120.go:5:13: cannot use "The version of quic-go you're using can't be built on Go 1.20 yet. For more details, please see https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.20 yet. F...) as int value in variable declaration

The latest version v0.35.1 of quic-go module supports Go 1.20.

Please could you release a new version (0.5.6 ?) of doggo to support build with Go 1.20 ?

Exit codes on resolve errors

Currently doggo doesn't provide any error exit code when it can't reach any resolver:

doggo/cmd/doggo/cli.go

Lines 150 to 164 in 0da9178

// Resolve Queries.
var responses []resolvers.Response
for _, q := range app.Questions {
for _, rslv := range app.Resolvers {
resp, err := rslv.Lookup(q)
if err != nil {
app.Logger.WithError(err).Error("error looking up DNS records")
}
responses = append(responses, resp)
}
}
app.Output(responses)
// Quitting.
app.Logger.Exit(0)

This would be really useful not only to indicate to shell integrations, that the command failed, but also when using doggo in any kind of script, to allow error handling.

dig for example returns an exit code 9, when trying to query 127.0.0.1 and no DNS server is available. doggo returns 0 when running: podman run --rm -it ghcr.io/mr-karan/doggo:latest mrkaran.dev @127.0.0.1 same as run ghcr.io/mr-karan/doggo:latest mrkaran.dev @9.9.9.9, while the former fails, the latter is successful.

So I wonder what would be the expectation for this feature? Should it mimic dig exit codes? Should it just be 2 like many other errors? Should it stay as it is?

rtt measurement is unfair

  • rtt in Classic mode, is not including transport layer Dial time

     >  Dial before rtt timer start  
    https://github.com/miekg/dns/blob/55216486109ae476af60b09a456281903fa2888e/client.go#L164
    

    in, rtt, err := r.client.Exchange(&msg, r.server)

  • rtt in doh, including transport layer Dial time

    now := time.Now()

you can test with a large latency doh server, and will find that tcp dial time can not be ignored
there is a server list https://kb.adguard.com/en/general/dns-providers

Parsing issue in Windows Terminal + PowerShell

There seems to be an issue with the parsing of the DNS server @...:

PS C:\Users\yop> doggo google.com
NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
google.com.     A       IN      300s    142.250.179.110 192.168.10.3:53

PS C:\Users\yop> doggo google.com @1.1.1.1
ParserError:
Line |
   1 |  doggo google.com @1.1.1.1
     |                      ~
     | Missing property name after reference operator.

PS C:\Users\yop> doggo google.com "@1.1.1.1"
NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
google.com.     A       IN      264s    142.250.179.78  1.1.1.1:53

zsh completion is broken

when press TAB, it shows

_arguments:comparguments:327: invalid argument: {--color}[Defaults to true. Set --color=false to disable colored output]:(setting):(true false)

not the right completion

DNS over QUIC slow

DNS queries over QUIC are always slow and appear to be hitting some sort of timeout. This behavior is the same on MacOS and Linux. Queries to @quic://dns.adguard.com are always over 6 seconds. This is using main branch and Go 1.21.0 and the following patch which appears to be required for the HTTPS queries:

diff --git a/pkg/resolvers/doq.go b/pkg/resolvers/doq.go
index 33bc47f..0242c99 100644
--- a/pkg/resolvers/doq.go
+++ b/pkg/resolvers/doq.go
@@ -26,7 +26,8 @@ type DOQResolver struct {
 func NewDOQResolver(server string, resolverOpts Options) (Resolver, error) {
        return &DOQResolver{
                tls: &tls.Config{
-                       NextProtos: []string{"doq"},
+                       InsecureSkipVerify: true,
+                       NextProtos:         []string{"doq"},
                },
                server:          server,
                resolverOptions: resolverOpts,
time doggo @https://cloudflare-dns.com/dns-query A AAAA HTTPS cloudflare.com;
time doggo @quic://dns.adguard.com A AAAA HTTPS cloudflare.com

NAME                   TYPE    CLASS   TTL     ADDRESS                                                 NAMESERVER
cloudflare.com.        A       IN      32s     104.16.132.229                                          https://cloudflare-dns.com/dns-query
cloudflare.com.        A       IN      32s     104.16.133.229                                          https://cloudflare-dns.com/dns-query
cloudflare.com.        AAAA    IN      136s    2606:4700::6810:84e5                                    https://cloudflare-dns.com/dns-query
cloudflare.com.        AAAA    IN      136s    2606:4700::6810:85e5                                    https://cloudflare-dns.com/dns-query
cloudflare.com.        HTTPS   IN      56s     1 . alpn="h3,h2"                                        https://cloudflare-dns.com/dns-query
                                               ipv4hint="104.16.132.229,104.16.133.229"
                                               ipv6hint="2606:4700::6810:84e5,2606:4700::6810:85e5"

________________________________________________________
Executed in  129.20 millis    fish           external
   usr time    4.88 millis   38.00 micros    4.84 millis
   sys time    4.80 millis  721.00 micros    4.08 millis

NAME                   TYPE    CLASS   TTL     ADDRESS                                                 NAMESERVER
cloudflare.com.        A       IN      212s    104.16.133.229                                          dns.adguard.com:853
cloudflare.com.        A       IN      212s    104.16.132.229                                          dns.adguard.com:853
cloudflare.com.        AAAA    IN      212s    2606:4700::6810:84e5                                    dns.adguard.com:853
cloudflare.com.        AAAA    IN      212s    2606:4700::6810:85e5                                    dns.adguard.com:853
cloudflare.com.        HTTPS   IN      300s    1 . alpn="h3,h2"                                        dns.adguard.com:853
                                               ipv4hint="104.16.132.229,104.16.133.229"
                                               ipv6hint="2606:4700::6810:84e5,2606:4700::6810:85e5"

________________________________________________________
Executed in    6.41 secs      fish           external
   usr time    5.65 millis   50.00 micros    5.60 millis
   sys time    5.51 millis  473.00 micros    5.04 millis

error in cli.go (parser) cannot parse `nameserver` flag

f.StringSliceP("nameservers", "n", []string{}, "Address of the nameserver to send packets to")

should be nameserver according to the usage/help.

$ doggo --nameserver=8.8.8.8 --query cnn.com
ERROR[2022-10-23T13:42:42-04:00] error parsing flags                           error="unknown flag: --nameserver"

$ doggo --nameservers=8.8.8.8 --query cnn.com
NAME    	TYPE	CLASS	TTL	ADDRESS      	NAMESERVER
cnn.com.	A   	IN   	60s	151.101.67.5 	8.8.8.8:53
cnn.com.	A   	IN   	60s	151.101.195.5	8.8.8.8:53
cnn.com.	A   	IN   	60s	151.101.131.5	8.8.8.8:53
cnn.com.	A   	IN   	60s	151.101.3.5  	8.8.8.8:53

CLI exits with zero code even when there are errors and no responses

Seems like there's a bug in doggo, where this condition:

doggo/cmd/doggo/cli.go

Lines 166 to 168 in 8492ccd

if len(responses) == 0 && len(responseErrors) > 0 {
app.Logger.Exit(9)
}

Never evaluates to true, because here:

doggo/cmd/doggo/cli.go

Lines 158 to 162 in 8492ccd

if err != nil {
app.Logger.WithError(err).Error("error looking up DNS records")
responseErrors = append(responseErrors, err)
}
responses = append(responses, resp)

An empty response is always appended to responses, making len(responses) always greater than zero.

I can reproduce this by running doggo foo.local @0.0.0.0, and observing responses with a debugger:

DeepinScreenshot_select-area_20230323124738

Issue with snap version - socket: permission denied

When trying to use doggo on ubuntu core or debian 11 with snap installed I get the same error:

aragorn@Aragorn:~/Extract$ doggo mrkaran.dev A @192.168.2.22
ERROR[2022-06-16T16:15:21-04:00] error looking up DNS records error="dial udp 192.168.2.22:53: socket: permission denied"
NAME TYPE CLASS TTL ADDRESS NAMESERVER

Screenshot:
image

doggo should only query one resolver by default

When your operating system is using multiple resolvers, doggo sends the query to all of them and shows the result for each resolver. This makes simple, quick hostname lookups much harder to read because the output is basically duplicated.

For example in my network the same nameserver can be reached over IPv4 and IPv6, so I always get two rows for each DNS record. This makes doggo uncomfortable to use.

I think doggo should only use one resolver unless I explicitly pass arguments to doggo telling it to use multiple resolvers.

Is it possible to test localhost DoH server ?

I have try to test my DoH server (self-sign) at localhost by run
doggo -q www.google.com -t A @https://127.0.0.1:8353/dns-query
it said
certificate signed by unknown authority
Do you have any argument to bypass it ?

Bug: wrong domain name when querying a non existing record

When querying a non existing record, "box." is somehow used?

# ./doggo example.com srv
NAME    TYPE    CLASS   TTL     ADDRESS                         NAMESERVER      STATUS
box.    SOA     IN      3600s   ns0.centralnic.net.             127.0.0.1:53    NXDOMAIN
                                hostmaster.centralnic.net.
                                1673271736 900 1800 6048000
                                3600

# ./doggo doesnotexist.example.com
NAME    TYPE    CLASS   TTL     ADDRESS                         NAMESERVER      STATUS
box.    SOA     IN      3600s   ns0.centralnic.net.             127.0.0.1:53    NXDOMAIN
                                hostmaster.centralnic.net.
                                1673274650 900 1800 6048000
                                3600

Edit:

I guess, these records in /etc/resolve.conf are causing this behaviour:

domain fritz.box
search fritz.box

Still weird to me ๐Ÿ˜‰

a new way to use doggo: `x doggo`

Hello, friends.

I have recently included doggo as a package in x-cmd. Now, users can simply type "x doggo" and x-cmd will automatically download and execute the binary. You can check out the demo at https://www.x-cmd.com/pkg/doggo.

Installing x-cmd is extremely easy. Just run eval "$(curl https://get.x-cmd.com)" and the process should be quick since x-cmd only uses shawk (shell/awk) and curl.

For more information on installation, please visit https://www.x-cmd.com.

We highly recommend using x-cmd as the preferred method for using doggo.

ERROR i/o timeout not showing in json Output when --json

doggo google.com A @4.2.2.12 --time --json

ERROR[2023-10-06T18:44:33-04:00] error looking up DNS records error="read udp 10.10.10.10:45326->4.2.2.12:53: i/o timeout"

When we get an ERROR in the response (and we have --json in the output) it would be nice to showcase this in --json as the error > we use this as a monitoring tool to see if our servers respond and if they dont we have to do different parsing. like to have full json error out too

Panic invalid memory address or nil pointer dereference

crash with docker run ghcr.io/mr-karan/doggo:v0.2.0 thepiratebay.org @https://doh.franciliens.net

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x710ca6]

goroutine 1 [running]:
github.com/sirupsen/logrus.(*Logger).newEntry(0x0, 0xc0000938c8)
	/home/runner/go/pkg/mod/github.com/sirupsen/[email protected]/logger.go:96 +0x26
github.com/sirupsen/logrus.(*Logger).WithFields(0x0, 0xc000093a20, 0x0)
	/home/runner/go/pkg/mod/github.com/sirupsen/[email protected]/logger.go:121 +0x4a
github.com/mr-karan/doggo/pkg/resolvers.(*DOHResolver).Lookup(0xc0000ca230, 0x7fff6738ef58, 0x10, 0x10001, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/runner/work/doggo/doggo/pkg/resolvers/doh.go:51 +0x679
main.main()
	/home/runner/work/doggo/doggo/cmd/doggo/cli.go:134 +0xbb3

Support reverse DNS lookups for IP addresses

It's possible to perform a reverse DNS lookup on an IP address if there's a domain pointing at that IP address:

doggo mydomain.com PTR

However if you provide the IP address from the A record of that domain, you get an NXDOMAIN error.

It would be ideal if it accepted IP addresses instead of erroring.

doggo issues on arm

โžœ ~ ./doggo a.com ERROR[2020-12-21T07:46:46Z] error loading nameservers error="error fetching system default nameserver"

doggo supports osx scoped queries on accident, but doesn't report correctly

I use OSX's DNS configuration for scoped queries. I use this so my work-related private/internal domains are resolved using DNS servers in our infrastructure, but the rest of the internet is resolved using the "normal" resolvers.

It looks like doggo is doing a lookup that respects the scoped query functionality in osx, but it's happening transparently and causing doggo to "lie" about the origin of the answer. This suggests that resolver-specific queries are leaking to other resolvers silently.

doggo reports that the normal resolvers are answering for domains that should be responding with NXDOMAIN, and don't list the resolver for the scoped query at all:

> doggo -t cname logikal.test.record.foo.tld
NAME                                          	TYPE 	CLASS	TTL	ADDRESS                                                                	NAMESERVER
logikal.test.record.foo.tld	CNAME	IN   	30s	lb-name-abcd1234-1234567890.us-east-1.elb.amazonaws.com.	192.168.1.87:53
logikal.test.record.foo.tld	CNAME	IN   	30s	lb-name-abcd1234-1234567890.us-east-1.elb.amazonaws.com.	192.168.1.1:53
logikal.test.record.foo.tld	CNAME	IN   	30s	lb-name-abcd1234-1234567890.us-east-1.elb.amazonaws.com.	8.8.8.8:53
logikal.test.record.foo.tld	CNAME	IN   	30s	lb-name-abcd1234-1234567890.us-east-1.elb.amazonaws.com.	1.1.1.1:53

# those resolvers all actually report NXDOMAIN for the record
> doggo @udp://8.8.8.8 -t cname sean.test.record.foo.tld
NAME           	TYPE	CLASS	TTL 	ADDRESS                       	NAMESERVER	STATUS
foo.tld.	SOA 	IN   	900s	ns-1371.awsdns-43.org.        	8.8.8.8:53	NXDOMAIN
               	    	     	    	awsdns-hostmaster.amazon.com.
               	    	     	    	1 7200 900 1209600 86400

> doggo @udp://192.168.1.87 -t cname logikal.test.record.foo.tld
NAME           	TYPE	CLASS	TTL 	ADDRESS                       	NAMESERVER     	STATUS
foo.tld.	SOA 	IN   	900s	ns-1371.awsdns-43.org.        	192.168.1.87:53	NXDOMAIN
               	    	     	    	awsdns-hostmaster.amazon.com.
               	    	     	    	1 7200 900 1209600 86400

> doggo @udp://1.1.1.1 -t cname logikal.test.record.foo.tld
NAME           	TYPE	CLASS	TTL 	ADDRESS                       	NAMESERVER	STATUS
foo.tld.	SOA 	IN   	900s	ns-1371.awsdns-43.org.        	1.1.1.1:53	NXDOMAIN
               	    	     	    	awsdns-hostmaster.amazon.com.
               	    	     	    	1 7200 900 1209600 86400

> doggo @udp://192.168.1.1 -t cname logikal.test.record.foo.tld
NAME           	TYPE	CLASS	TTL 	ADDRESS                       	NAMESERVER    	STATUS
foo.tld.	SOA 	IN   	900s	ns-1371.awsdns-43.org.        	192.168.1.1:53	NXDOMAIN
               	    	     	    	awsdns-hostmaster.amazon.com.
               	    	     	    	1 7200 900 1209600 86400

# but the resolver for the scoped query does return the right answer for the query.
doggo @udp://10.100.0.2 logikal.test.record.foo.tld
NAME                                                                 	TYPE 	CLASS	TTL 	ADDRESS                                                              	NAMESERVER
logikal.test.record.foo.tld.                                     	CNAME	IN   	60s 	*.ssl.hub.foo.tld.                                              	10.100.0.2:53
*.ssl.hub.foo.tld.                                              	CNAME	IN   	300s	nlb-1234567890abcedf.elb.us-east-1.amazonaws.com.	10.100.0.2:53
nlb-1234567890abcedf.elb.us-east-1.amazonaws.com.	A    	IN   	60s 	1.2.3.4                                                        	10.100.0.2:53
nlb-1234567890abcedf.elb.us-east-1.amazonaws.com.	A    	IN   	60s 	1.2.3.4                                                         	10.100.0.2:53

My resolver configuration

# some irrelevant resolvers removed
scutil --dns
DNS configuration

resolver #1
  search domain[0] : foo.tld (my work domain)
  search domain[3] : hq (my LAN search domain)
  nameserver[0] : 192.168.1.87
  nameserver[1] : 192.168.1.1
  nameserver[2] : 8.8.8.8
  nameserver[3] : 1.1.1.1
  if_index : 13 (en4)
  flags    : Request A records
  reach    : 0x00020002 (Reachable,Directly Reachable Address)

resolver #2
  domain   : foo.tld
  nameserver[0] : 10.100.0.2
  flags    : Supplemental, Request A records
  reach    : 0x00000002 (Reachable)
  order    : 102600

DNS configuration (for scoped queries)

resolver #1
  search domain[0] : hq (my LAN search domain)
  nameserver[0] : 192.168.1.87
  nameserver[1] : 192.168.1.1
  nameserver[2] : 8.8.8.8
  nameserver[3] : 1.1.1.1
  if_index : 13 (en4)
  flags    : Scoped, Request A records
  reach    : 0x00020002 (Reachable,Directly Reachable Address)

resolver #2
  search domain[0] : hq (my LAN search domain)
  nameserver[0] : 192.168.1.87
  nameserver[1] : 192.168.1.1
  nameserver[2] : 8.8.8.8
  nameserver[3] : 1.1.1.1
  if_index : 15 (en0)
  flags    : Scoped, Request A records
  reach    : 0x00020002 (Reachable,Directly Reachable Address)

resolver #3
  search domain[0] : foo.tld (my work domain)
  nameserver[0] : 10.100.0.2
  if_index : 26 (utun10)
  flags    : Scoped, Request A records
  reach    : 0x00000002 (Reachable)

doq request don't work

$ doggo archive.org @quic://dns.adguard.com
ERROR[2023-04-12T15:19:24+03:00] error looking up DNS records error="dial udp: lookup quic://dns.adguard.com: no such host"

Feature request: set source-interface

Hi,

I'm working on network appliances which have non-trivial routing setup.
I need to be able to choose the source interface for DNS queries.

I've already wrote a kind of "patch" to be able to choose source-interface from CLI (here)

Can you help me to finalize this patch to be able to submit a clean pull-request?
I think the first step is to add this --iface option to others resolvers (TCP, DOH, DOT, DOQ and DNSCrypt).

What are the others steps/needs?

BR

Feature request: trace

When explaining some aspects of DNS resolution, I noted that dig 9.10.6 has the following query option:

+[no]trace

Toggle tracing of the delegation path from the root name servers for the name being looked up. Tracing is disabled by default. When tracing is enabled, dig makes iterative queries to resolve the name being looked up. It will follow referrals from the root servers, showing the answer from each server that was used to resolve the lookup.

If @server is also specified, it affects only the initial query for the root zone name servers.

I found this pretty handy for investigating some configurations โ€” I'd love to see an equivalent feature in doggo.

The dig version's behaviour:

$ dig github.com +trace +nodnssec @1.1.1.1

; <<>> DiG 9.10.6 <<>> github.com +trace +nodnssec @1.1.1.1
;; global options: +cmd
.			514951	IN	NS	a.root-servers.net.
.			514951	IN	NS	b.root-servers.net.
.			514951	IN	NS	c.root-servers.net.
.			514951	IN	NS	d.root-servers.net.
.			514951	IN	NS	e.root-servers.net.
.			514951	IN	NS	f.root-servers.net.
.			514951	IN	NS	g.root-servers.net.
.			514951	IN	NS	h.root-servers.net.
.			514951	IN	NS	i.root-servers.net.
.			514951	IN	NS	j.root-servers.net.
.			514951	IN	NS	k.root-servers.net.
.			514951	IN	NS	l.root-servers.net.
.			514951	IN	NS	m.root-servers.net.
;; Received 811 bytes from 1.1.1.1#53(1.1.1.1) in 54 ms

com.			172800	IN	NS	l.gtld-servers.net.
com.			172800	IN	NS	b.gtld-servers.net.
com.			172800	IN	NS	c.gtld-servers.net.
com.			172800	IN	NS	d.gtld-servers.net.
com.			172800	IN	NS	e.gtld-servers.net.
com.			172800	IN	NS	f.gtld-servers.net.
com.			172800	IN	NS	g.gtld-servers.net.
com.			172800	IN	NS	a.gtld-servers.net.
com.			172800	IN	NS	h.gtld-servers.net.
com.			172800	IN	NS	i.gtld-servers.net.
com.			172800	IN	NS	j.gtld-servers.net.
com.			172800	IN	NS	k.gtld-servers.net.
com.			172800	IN	NS	m.gtld-servers.net.
;; Received 835 bytes from 192.5.5.241#53(f.root-servers.net) in 4 ms

github.com.		172800	IN	NS	ns-520.awsdns-01.net.
github.com.		172800	IN	NS	ns-421.awsdns-52.com.
github.com.		172800	IN	NS	ns-1707.awsdns-21.co.uk.
github.com.		172800	IN	NS	ns-1283.awsdns-32.org.
github.com.		172800	IN	NS	dns1.p08.nsone.net.
github.com.		172800	IN	NS	dns2.p08.nsone.net.
github.com.		172800	IN	NS	dns3.p08.nsone.net.
github.com.		172800	IN	NS	dns4.p08.nsone.net.
;; Received 278 bytes from 192.26.92.30#53(c.gtld-servers.net) in 173 ms

github.com.		60	IN	A	20.248.137.48
github.com.		900	IN	NS	dns1.p08.nsone.net.
github.com.		900	IN	NS	dns2.p08.nsone.net.
github.com.		900	IN	NS	dns3.p08.nsone.net.
github.com.		900	IN	NS	dns4.p08.nsone.net.
github.com.		900	IN	NS	ns-1283.awsdns-32.org.
github.com.		900	IN	NS	ns-1707.awsdns-21.co.uk.
github.com.		900	IN	NS	ns-421.awsdns-52.com.
github.com.		900	IN	NS	ns-520.awsdns-01.net.
;; Received 278 bytes from 205.251.193.165#53(ns-421.awsdns-52.com) in 14 ms

doggo issues on Windows

Hi,

Thanks for your project. I'm using Windows 10 19041.685 and this is the output when using doggo:

> doggo.exe github.com
time="2020-12-18T21:52:35-08:00" level=error msg="error loading nameservers" error="error fetching system default nameserver"

I think I need to put @9.9.9.9 in quotes but doing so, generates this:

> doggo mrkaran.dev MX "@9.9.9.9"
time="2020-12-18T21:56:03-08:00" level=error msg="error looking up DNS records" error="dns: domain must be fully qualified"

Ah, I think this explains it:
https://github.com/mr-karan/doggo/blob/main/cmd/doggo/nameservers.go#L61

doggo cannt work well on wsl1

I installed doggo on wsl1, and this is the output when using doggo.

> doggo baidu.com
ERROR[2020-12-22T17:22:44+08:00] error looking up DNS records                  error="read udp [2001:0:2851:b9f0:2444:b43f:496b:c4f4]:54677->[fec0:0:0:ffff::1]:53: i/o timeout"

Create a website

Maybe a documentation website to show

  • Shell completions
  • Different commands
  • Usecases / Usage Examples
  • API docs
  • Installation
  • Features

Fails to build with current Go versions:

vendor/github.com/lucas-clemente/quic-go/internal/qtls/go118.go:6:13: cannot use "quic-go doesn't build on Go 1.18 yet." (untyped string constant) as int value in variable declaration

OS: FreeBSD 13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.