fix testing
This commit is contained in:
parent
ddeeadc22a
commit
769307b9ce
3
Makefile
3
Makefile
|
@ -16,3 +16,6 @@ include $(GOROOT)/src/Make.pkg
|
|||
|
||||
restest: restest.go
|
||||
6g -I _obj restest.go && 6l -L _obj -o restest restest.6
|
||||
|
||||
packtest: packtest.go
|
||||
6g -I _obj packtest.go && 6l -L _obj -o packtest packtest.6
|
||||
|
|
|
@ -412,7 +412,7 @@ func printStructValue(val *reflect.StructValue) string {
|
|||
fval := val.Field(i)
|
||||
if fv, ok := fval.(*reflect.StructValue); ok {
|
||||
s += printStructValue(fv)
|
||||
} else if fv, ok := fval.(*reflect.UintValue); ok && f.Tag == "ipv4" {
|
||||
} else if fv, ok := fval.(*reflect.UintValue); ok && f.Tag == "ipv4" { // TODO ipv4 can go here
|
||||
i := fv.Get()
|
||||
s += net.IPv4(byte(i>>24), byte(i>>16), byte(i>>8), byte(i)).String()
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"dns"
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func main() {
|
||||
res := new(dns.Resolver)
|
||||
res.Servers = []string{"192.168.1.2"}
|
||||
res.Timeout = 2
|
||||
res.Attempts = 1
|
||||
|
||||
a := new(dns.RR_A)
|
||||
a.A = net.ParseIP("192.168.1.2").To4()
|
||||
|
||||
aaaa := new(dns.RR_AAAA)
|
||||
aaaa.AAAA = net.ParseIP("2003::53").To16()
|
||||
|
||||
fmt.Printf("%v\n", a)
|
||||
fmt.Printf("%v\n", aaaa)
|
||||
|
||||
// msg, _ := res.Query("miek.nl.", dns.TypeTXT, dns.ClassINET)
|
||||
// fmt.Printf("%v\n", msg)
|
||||
//
|
||||
// msg, _ = res.Query("www.nlnetlabs.nl", dns.TypeAAAA, dns.ClassINET)
|
||||
// fmt.Printf("%v\n", msg)
|
||||
//
|
||||
msg, _ := res.Query("nlnetlabs.nl", dns.TypeDNSKEY, dns.ClassINET)
|
||||
fmt.Printf("%v\n", msg)
|
||||
|
||||
msg, _ = res.Query("jelte.nlnetlabs.nl", dns.TypeDS, dns.ClassINET)
|
||||
fmt.Printf("%v\n", msg)
|
||||
}
|
Loading…
Reference in New Issue