Skip to content

Instantly share code, notes, and snippets.

@m13253
Created October 3, 2017 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m13253/f354f601bb741d1c0ef903ee2104e936 to your computer and use it in GitHub Desktop.
Save m13253/f354f601bb741d1c0ef903ee2104e936 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"github.com/miekg/dns"
)
func main() {
err := dns.ListenAndServe(":5533", "udp", dns.HandlerFunc(handler))
if err != nil {
log.Fatalln(err)
}
}
func handler(w dns.ResponseWriter, r *dns.Msg) {
w.WriteMsg(new(dns.Msg).SetReply(r))
log.Println(r.String())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment