aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/rescached/rescached.cfg2
-rw-r--r--cmd/resolverbench/main.go18
2 files changed, 10 insertions, 10 deletions
diff --git a/cmd/rescached/rescached.cfg b/cmd/rescached/rescached.cfg
index 93ffb22..0684a69 100644
--- a/cmd/rescached/rescached.cfg
+++ b/cmd/rescached/rescached.cfg
@@ -16,6 +16,7 @@ hosts_block = http://someonewhocares.org/hosts/hosts
[dns "server"]
#parent=udp://18.136.35.199
#parent=tcp://18.136.35.199
+parent = https://kilabit.info/dns-query
listen = 127.0.0.1:53
## Uncomment line below if you want to serve DNS to other computers.
@@ -38,4 +39,3 @@ doh.behind_proxy = false
cache.prune_delay = 1h0m0s
cache.prune_threshold = -1h0m0s
-parent = https://kilabit.info/dns-query
diff --git a/cmd/resolverbench/main.go b/cmd/resolverbench/main.go
index 0b517a2..a12679d 100644
--- a/cmd/resolverbench/main.go
+++ b/cmd/resolverbench/main.go
@@ -7,7 +7,7 @@ import (
"os"
"time"
- libdns "github.com/shuLhan/share/lib/dns"
+ "github.com/shuLhan/share/lib/dns"
)
func usage() {
@@ -22,30 +22,30 @@ func main() {
log.SetFlags(0)
- cl, err := libdns.NewUDPClient(os.Args[1])
+ cl, err := dns.NewUDPClient(os.Args[1])
if err != nil {
log.Fatal(err)
}
- msgs, err := libdns.HostsLoad(os.Args[2])
+ hostsFile, err := dns.ParseHostsFile(os.Args[2])
if err != nil {
log.Fatal(err)
}
var nfail int
- fmt.Printf("= Benchmarking with %d messages\n", len(msgs))
+ fmt.Printf("= Benchmarking with %d messages\n", len(hostsFile.Messages))
timeStart := time.Now()
- for x := 0; x < len(msgs); x++ {
- res, err := cl.Query(msgs[x])
+ for x := 0; x < len(hostsFile.Messages); x++ {
+ res, err := cl.Query(hostsFile.Messages[x])
if err != nil {
nfail++
log.Println("! Send error: ", err)
continue
}
- exp := msgs[x].Answer[0].RData().([]byte)
+ exp := hostsFile.Messages[x].Answer[0].RData().([]byte)
got := res.Answer[0].RData().([]byte)
if !bytes.Equal(exp, got) {
@@ -53,12 +53,12 @@ func main() {
log.Printf(`! Answer not matched %s:
expecting: %s
got: %s
-`, msgs[x].Question.String(), exp, got)
+`, hostsFile.Messages[x].Question.String(), exp, got)
}
}
timeEnd := time.Now()
- fmt.Printf("= Total: %d\n", len(msgs))
+ fmt.Printf("= Total: %d\n", len(hostsFile.Messages))
fmt.Printf("= Failed: %d\n", nfail)
fmt.Printf("= Elapsed time: %v\n", timeEnd.Sub(timeStart))
}