Closed yashvardhan-kukreja closed 1 year ago
Signed-off-by: Yashvardhan Kukreja yash.kukreja.98@gmail.com
closes #37
make build output
make build
❯ make build CGO_ENABLED=0 go build -o dnstoys.bin -ldflags="-s -w -X 'main.buildString=v1.0.0-4-ge6f3 (build "\#"e6f346b 2022-09-20 01:09:17)'" ./cmd/dnstoys/*.go
Running the DNS server
❯ ./dnstoys.bin 2022/09/20 01:10:06 main.go:64: reading config: config.toml 2022/09/20 01:10:06 main.go:154: reading geo locations from cities15000.txt 2022/09/20 01:10:06 main.go:162: 26237 geo location names loaded 2022/09/20 01:10:06 main.go:321: listening on :5354
Running the queries in a separate terminal
❯ dig coin @127.0.0.1 -p 5354
; <<>> DiG 9.10.6 <<>> coin @127.0.0.1 -p 5354 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28120 ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; WARNING: recursion requested but not available
;; QUESTION SECTION: ;coin. IN A
;; ANSWER SECTION: coin. 1 IN TXT "tossed = [heads]"
;; Query time: 0 msec ;; SERVER: 127.0.0.1#5354(127.0.0.1) ;; WHEN: Tue Sep 20 01:10:37 IST 2022 ;; MSG SIZE rcvd: 55
```sh ❯ dig 2.coin @127.0.0.1 -p 5354 ; <<>> DiG 9.10.6 <<>> 2.coin @127.0.0.1 -p 5354 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44331 ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;2.coin. IN A ;; ANSWER SECTION: 2. 1 IN TXT "tossed = [tails, tails]" ;; Query time: 0 msec ;; SERVER: 127.0.0.1#5354(127.0.0.1) ;; WHEN: Tue Sep 20 01:10:54 IST 2022 ;; MSG SIZE rcvd: 61
❯ dig 69.coin @127.0.0.1 -p 5354 ; <<>> DiG 9.10.6 <<>> 69.coin @127.0.0.1 -p 5354 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 52852 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;69.coin. IN A ;; ADDITIONAL SECTION: . 1 IN TXT "error: toss overflow" ;; Query time: 0 msec ;; SERVER: 127.0.0.1#5354(127.0.0.1) ;; WHEN: Tue Sep 20 01:11:19 IST 2022 ;; MSG SIZE rcvd: 57
Thanks for the PR @yashvardhan-kukreja. Made a few minor cosmetic changes and merged.
Signed-off-by: Yashvardhan Kukreja yash.kukreja.98@gmail.com
closes #37
make build
outputRunning the DNS server
Running the queries in a separate terminal
; <<>> DiG 9.10.6 <<>> coin @127.0.0.1 -p 5354 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28120 ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; WARNING: recursion requested but not available
;; QUESTION SECTION: ;coin. IN A
;; ANSWER SECTION: coin. 1 IN TXT "tossed = [heads]"
;; Query time: 0 msec ;; SERVER: 127.0.0.1#5354(127.0.0.1) ;; WHEN: Tue Sep 20 01:10:37 IST 2022 ;; MSG SIZE rcvd: 55