* querylog: refactor: move HTTP handlers to querylog/

This commit is contained in:
Simon Zolin
2019-09-27 18:58:57 +03:00
parent f4451dca7b
commit 90db91b0fd
11 changed files with 276 additions and 246 deletions

View File

@@ -12,9 +12,10 @@ import (
func TestQueryLog(t *testing.T) {
conf := Config{
Enabled: true,
Interval: 1,
}
l := New(conf)
l := newQueryLog(conf)
q := dns.Msg{}
q.Question = append(q.Question, dns.Question{
@@ -37,10 +38,10 @@ func TestQueryLog(t *testing.T) {
res := dnsfilter.Result{}
l.Add(&q, &a, &res, 0, nil, "upstream")
params := GetDataParams{
params := getDataParams{
OlderThan: time.Now(),
}
d := l.GetData(params)
d := l.getData(params)
m := d[0]
mq := m["question"].(map[string]interface{})
assert.True(t, mq["host"].(string) == "example.org")