godns/godns_test.go

27 lines
334 B
Go
Raw Normal View History

2013-07-25 04:32:57 +00:00
package main
import (
"testing"
2015-02-10 09:04:57 +00:00
"github.com/miekg/dns"
2013-07-25 04:32:57 +00:00
)
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)
}
}