Add axfr example prog
This commit is contained in:
parent
b4a69fad37
commit
9b595ed836
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style
|
||||||
|
# license that can be found in the LICENSE file.
|
||||||
|
include $(GOROOT)/src/Make.inc
|
||||||
|
TARG=axfr
|
||||||
|
GOFILES=axfr.go
|
||||||
|
DEPS=../../
|
||||||
|
include $(GOROOT)/src/Make.cmd
|
|
@ -0,0 +1,22 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"dns"
|
||||||
|
"dns/resolver"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
res := new(resolver.Resolver)
|
||||||
|
ch := res.NewXfer()
|
||||||
|
|
||||||
|
res.Servers = []string{"127.0.0.1"}
|
||||||
|
m := new(dns.Msg)
|
||||||
|
m.Question = make([]dns.Question, 1)
|
||||||
|
m.Question[0] = dns.Question{"atoom.net", dns.TypeAXFR, dns.ClassINET}
|
||||||
|
|
||||||
|
ch <- resolver.DnsMsg{m, nil}
|
||||||
|
for dm := range ch {
|
||||||
|
fmt.Printf("%v\n",dm.Dns)
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,5 +8,4 @@ TARG=dns/resolver
|
||||||
GOFILES=\
|
GOFILES=\
|
||||||
resolver.go\
|
resolver.go\
|
||||||
|
|
||||||
#DEPS=../
|
|
||||||
include $(GOROOT)/src/Make.pkg
|
include $(GOROOT)/src/Make.pkg
|
||||||
|
|
Loading…
Reference in New Issue