diff options
| author | Shulhan <m.shulhan@gmail.com> | 2020-06-02 01:31:30 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2020-07-26 03:48:51 +0700 |
| commit | e643e59ae5aaac660682b04b2b09e3bf3c399fac (patch) | |
| tree | d5dfa732ba8ac1628de7869e625f4f9740d4ac3b /cmd | |
| parent | b1b190cfb830305e4fddd2b8bf8264984b41f3e3 (diff) | |
| download | rescached-e643e59ae5aaac660682b04b2b09e3bf3c399fac.tar.xz | |
all: store the loaded hosts and master files
To be able to edit the hosts or master file through web UI, we need to
store it some where. This changes is premilinary commit before we add
the actual UI to edit hosts file.
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/rescached/rescached.cfg | 2 | ||||
| -rw-r--r-- | cmd/resolverbench/main.go | 18 |
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)) } |
