Esempio n. 1
0
File: xfr.go Progetto: elazarl/godns
func handleXfrIn(i *dns.Msg) os.Error {
	q := new(dns.Msg)
	q.SetAxfr(i.Question[0].Name)

	m := make(chan *dns.Xfr)
	fmt.Printf("Preparing Xfr for %s\n", i.Question[0].Name)

	d := new(dns.Conn)
	d.RemoteAddr = "127.0.0.1:53"
	err := d.Dial("tcp")
	if err != nil {
		return err
	}
	defer d.Close()

	fmt.Printf("Calling 127.0.0.1 successful\n")
	go d.XfrRead(q, m)

	Zone.name = i.Question[0].Name
	j := 0
	for x := range m {
		Zone.rrs[j] = x.RR
		j++
	}
	fmt.Printf("Success retrieved %s\n", Zone.name)
	Zone.size = j
	return nil
}
Esempio n. 2
0
File: q.go Progetto: elazarl/godns
// reply checking 'n stuff
func qhandle(d *dns.Conn, i *dns.Msg) {
	o, err := d.ExchangeMsg(i, false)
	dns.QueryReply <- &dns.Query{Query: i, Reply: o, Conn: d, Err: err}
	d.Close()
}