godns/godns_test.go
2015-02-10 17:04:57 +08:00

27 lines
334 B
Go

package main
import (
"testing"
"github.com/miekg/dns"
)
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)
}
}