From 47d7cd78f596d023b880ea53f400fa88139b9acd Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 8 Jan 2012 16:16:02 +0100 Subject: [PATCH] Fix fqdn use in the examples --- _examples/chaos/chaos.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/_examples/chaos/chaos.go b/_examples/chaos/chaos.go index ab33f8ac..a0b5eeef 100644 --- a/_examples/chaos/chaos.go +++ b/_examples/chaos/chaos.go @@ -42,8 +42,11 @@ func main() { func qhandler(w dns.RequestWriter, m *dns.Msg) { w.Dial() defer w.Close() - w.Send(m) - r, _ := w.Receive() + if err := w.Send(m); err != nil { + w.Write(nil) + return + } + r, _ := w.Receive() w.Write(r) } @@ -52,9 +55,9 @@ func addresses(conf *dns.ClientConfig, c *dns.Client, name string) []string { dns.ListenAndQuery(nil, nil) m4 := new(dns.Msg) - m4.SetQuestion(os.Args[1], dns.TypeA) + m4.SetQuestion(dns.Fqdn(os.Args[1]), dns.TypeA) m6 := new(dns.Msg) - m6.SetQuestion(os.Args[1], dns.TypeAAAA) + m6.SetQuestion(dns.Fqdn(os.Args[1]), dns.TypeAAAA) c.Do(m4, conf.Servers[0] + ":" + conf.Port) c.Do(m6, conf.Servers[0] + ":" + conf.Port)