godns/godns_test.go
2013-07-25 12:32:57 +08:00

26 lines
333 B
Go

package main
import (
"github.com/miekg/dns"
"testing"
)
const (
nameserver = "127.0.0.1:53"
domain = "www.sina.com.cn"
)
func BenchmarkDig(b *testing.B) {
m := new(dns.Msg)
m.SetQuestion(dns.Fqdn(domain), dns.TypeA)
c := new(dns.Client)
b.ResetTimer()
for i := 0; i < b.N; i++ {
c.Exchange(m, nameserver)
}
}