[ANN] Simple DNS Server implemented in Go

359 views
Skip to first unread message

Daniel Lorch

unread,
Jun 25, 2019, 4:23:06 PM6/25/19
to golang-nuts
Hi all

I have implemented a simple authoritative DNS Server in Go. You can find it here: https://github.com/dlorch/dnsserver/

It's a study project to teach myself Go and DNS.

Usage as follows:

$ go run dnsserver.go &
Listening at:  :1053

$ dig example.com @localhost -p 1053
Received request from  [::1]:63282

; <<>> DiG 9.10.6 <<>> example.com @localhost -p 1053
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17060
;; flags: qr; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com.			IN	A

;; ANSWER SECTION:
example.com.		31337	IN	A	3.1.3.7

;; Query time: 0 msec
;; SERVER: ::1#1053(::1)
;; WHEN: Mon Jun 17 17:02:43 CEST 2019
;; MSG SIZE  rcvd: 56

Looking forward to any feedback you might have.

Regards
Daniel

Eric S. Raymond

unread,
Jun 25, 2019, 4:36:10 PM6/25/19
to Daniel Lorch, golang-nuts
Daniel Lorch <dlo...@gmail.com>:
> I have implemented a simple authoritative DNS Server in Go. You can find it
> here: https://github.com/dlorch/dnsserver/
>
> It's a study project to teach myself Go and DNS.

Haven't looked at it yet, but I must say I think you just nailed one
of the ideal use cases for Go. Provable buffer overrun protection is
especially desirable in this kind of service, and the language
libraries undoubtedly make for a small, clean, exceptionally auditable
implementation. Good on you.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


Matt Harden

unread,
Jun 25, 2019, 8:54:39 PM6/25/19
to e...@thyrsus.com, Daniel Lorch, golang-nuts
I realize this is a learning exercise for you, but in case you're interested, the DNS message types are implemented for you in https://godoc.org/golang.org/x/net/dns/dnsmessage.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20190625203542.GB118392%40thyrsus.com.
For more options, visit https://groups.google.com/d/optout.

Olu Peter

unread,
Jun 26, 2019, 2:39:20 AM6/26/19
to golang-nuts
Cool stuff. I’ll check it out and revert

Daniel Lorch

unread,
Jun 26, 2019, 1:27:41 PM6/26/19
to golang-nuts
Hi Matt

I was not aware of this, thank you! I added a note in my repository.

Daniel


On Wednesday, June 26, 2019 at 2:54:39 AM UTC+2, Matt Harden wrote:
I realize this is a learning exercise for you, but in case you're interested, the DNS message types are implemented for you in https://godoc.org/golang.org/x/net/dns/dnsmessage.

On Tue, Jun 25, 2019 at 1:36 PM Eric S. Raymond <e...@thyrsus.com> wrote:
Daniel Lorch <dlo...@gmail.com>:
> I have implemented a simple authoritative DNS Server in Go. You can find it
> here: https://github.com/dlorch/dnsserver/
>
> It's a study project to teach myself Go and DNS.

Haven't looked at it yet, but I must say I think you just nailed one
of the ideal use cases for Go.  Provable buffer overrun protection is
especially desirable in this kind of service, and the language
libraries undoubtedly make for a small, clean, exceptionally auditable
implementation. Good on you.
--
                <a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages