Closed anapsix closed 3 years ago
ndots=0
in that debug logs seems to be a bug. Will investigate this.
@anapsix Still Investigating this, looks like the ndots
param isn't unmarshalled properly. Will fix this soon :)
thanks @mr-karan
shouldn't --ndots=0
be possible and behave as if a dot was added to the query as last character?
for example
$ docker run -it --rm --entrypoint /bin/sh ghcr.io/mr-karan/doggo:latest
$ echo "search 10.0.0.1.xip.io" >> /etc/resolv.conf
$ cat /etc/resolv.conf
# This file is fetched from the host via vpnkit-bridge
nameserver 192.168.65.1
search 10.0.0.1.xip.io
$ doggo | grep VERSION -A1
VERSION:
v0.2.3 (a8769e1 2021-02-15T04:43:12Z) - unknown
$ doggo --search --debug -q localhost.
DEBUG[2021-02-15T12:53:41Z] initiating UDP resolver
DEBUG[2021-02-15T12:53:41Z] Starting doggo ๐ถ
DEBUG[2021-02-15T12:53:41Z] Attempting to resolve domain=localhost. nameserver="192.168.65.1:53" ndots=1
NAME TYPE CLASS TTL ADDRESS NAMESERVER
localhost. A IN 1s 127.0.0.1 192.168.65.1:53
$ doggo --search --ndots=0 --debug -q localhost
DEBUG[2021-02-15T12:50:17Z] initiating UDP resolver
DEBUG[2021-02-15T12:50:17Z] Starting doggo ๐ถ
DEBUG[2021-02-15T12:50:17Z] Attempting to resolve domain=localhost.10.0.0.1.xip.io. nameserver="192.168.65.1:53" ndots=1
NAME TYPE CLASS TTL ADDRESS NAMESERVER
localhost.10.0.0.1.xip.io. A IN 375s 10.0.0.1 192.168.65.1:53
compare to dig
$ docker run -it --rm --entrypoint /bin/sh ghcr.io/mr-karan/doggo:latest
$ echo "search 10.0.0.1.xip.io" >> /etc/resolv.conf
$ cat /etc/resolv.conf
# This file is fetched from the host via vpnkit-bridge
nameserver 192.168.65.1
search 10.0.0.1.xip.io
$ apk add -q bind-tools
$ dig +noall +showsearch +question +answer +search +ndots=0 localhost
;localhost. IN A
localhost. 1 IN A 127.0.0.1
$ dig +noall +showsearch +question +answer +search +ndots=3 localhost
;localhost.10.0.0.1.xip.io. IN A
localhost.10.0.0.1.xip.io. 377 IN A 10.0.0.1
@anapsix I agree. ndots=0
should be valid. Can you try once more with the latest version please? :)
ndots=0
looks good now
$ docker run -it --rm golang:alpine
$ go get github.com/mr-karan/doggo/cmd/doggo
$ echo "search 10.0.0.1.xip.io" >> /etc/resolv.conf
$ cat /etc/resolv.conf
# This file is fetched from the host via vpnkit-bridge
nameserver 192.168.65.1
search 10.0.0.1.xip.io
$ doggo --search --ndots=0 --debug -q localhost
DEBUG[2021-02-17T10:26:54Z] initiating UDP resolver
DEBUG[2021-02-17T10:26:54Z] Starting doggo ๐ถ
DEBUG[2021-02-17T10:26:54Z] Attempting to resolve domain=localhost. nameserver="192.168.65.1:53" ndots=0
NAME TYPE CLASS TTL ADDRESS NAMESERVER
localhost. A IN 1s 127.0.0.1 192.168.65.1:53
$ doggo --search --ndots=1 --debug -q localhost
DEBUG[2021-02-17T10:27:00Z] initiating UDP resolver
DEBUG[2021-02-17T10:27:00Z] Starting doggo ๐ถ
DEBUG[2021-02-17T10:27:00Z] Attempting to resolve domain=localhost.10.0.0.1.xip.io. nameserver="192.168.65.1:53" ndots=1
NAME TYPE CLASS TTL ADDRESS NAMESERVER
localhost.10.0.0.1.xip.io. A IN 377s 10.0.0.1 192.168.65.1:53
$ doggo --search --ndots=3 --debug -q localhost
DEBUG[2021-02-17T10:28:32Z] initiating UDP resolver
DEBUG[2021-02-17T10:28:32Z] Starting doggo ๐ถ
DEBUG[2021-02-17T10:28:32Z] Attempting to resolve domain=localhost.10.0.0.1.xip.io. nameserver="192.168.65.1:53" ndots=3
NAME TYPE CLASS TTL ADDRESS NAMESERVER
localhost.10.0.0.1.xip.io. A IN 377s 10.0.0.1 192.168.65.1:53
$ doggo --search --ndots=3 --debug -q localhost.
DEBUG[2021-02-17T10:28:17Z] initiating UDP resolver
DEBUG[2021-02-17T10:28:17Z] Starting doggo ๐ถ
DEBUG[2021-02-17T10:28:17Z] Attempting to resolve domain=localhost. nameserver="192.168.65.1:53" ndots=3
NAME TYPE CLASS TTL ADDRESS NAMESERVER
localhost. A IN 1s 127.0.0.1 192.168.65.1:53
Thanks!
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
I've expected to see
doggo
use the query as is, without adding a dot (whatdig
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
Perhaps I'm using it wrong? Please clarify.