Small IPv6 fixes

This commit is contained in:
Miek Gieben 2011-02-21 17:57:50 +01:00
parent ebdcc4606f
commit 4992b3e6bf
1 changed files with 4 additions and 2 deletions

View File

@ -42,8 +42,8 @@ func reply(a net.Addr, in *dns.Msg, tcp bool) *dns.Msg {
r := new(dns.RR_A)
r.Hdr = dns.RR_Header{Name: "whoami.miek.nl.", Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 0}
ip, _ := net.ResolveUDPAddr(a.String()) // No general variant for both upd and tcp
r.A = ip.IP.To4() // To4 very important
ip, _ := net.ResolveUDPAddr(a.String())
r.A = ip.IP
t := new(dns.RR_TXT)
t.Hdr = dns.RR_Header{Name: "whoami.miek.nl.", Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 0}
@ -118,7 +118,9 @@ func udp(addr string, e chan os.Error) {
func main() {
e := make(chan os.Error)
go udp("127.0.0.1:8053", e)
go udp("[::1]:8053", e)
go tcp("127.0.0.1:8053", e)
go tcp("[::1]:8053", e)
forever:
for {