From 6a0194c7a184b7f4b10b71d9b531efb59056c548 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Thu, 11 Jun 2020 15:39:54 +0300 Subject: [PATCH 1/3] fix whois test --- home/whois_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/home/whois_test.go b/home/whois_test.go index 75af9f14114..da93426f9f3 100644 --- a/home/whois_test.go +++ b/home/whois_test.go @@ -27,9 +27,9 @@ func TestWhois(t *testing.T) { w := Whois{timeoutMsec: 5000} resp, err := w.queryAll("8.8.8.8") - assert.True(t, err == nil) + assert.Nil(t, err) m := whoisParse(resp) - assert.True(t, m["orgname"] == "Google LLC") - assert.True(t, m["country"] == "US") - assert.True(t, m["city"] == "Mountain View") + assert.Equal(t, "Google LLC", m["orgname"]) + assert.Equal(t, "US", m["country"]) + assert.Equal(t, "Mountain View", m["city"]) } From b6052a4cd1c11f5f34db23781138eb7b6cb710f7 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 16 Jun 2020 11:14:04 +0300 Subject: [PATCH 2/3] doc --- AGHTechDoc.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/AGHTechDoc.md b/AGHTechDoc.md index cc20d60a4ff..b2f4ab734b3 100644 --- a/AGHTechDoc.md +++ b/AGHTechDoc.md @@ -1236,7 +1236,7 @@ Request: GET /control/querylog ?older_than=2006-01-02T15:04:05.999999999Z07:00 &search=... - &response_status=""|blocked|whitelisted|processed + &response_status="..." `older_than` setting is used for paging. UI uses an empty value for `older_than` on the first request and gets the latest log entries. To get the older entries, UI sets `older_than` to the `oldest` value from the server's response. @@ -1248,9 +1248,15 @@ The server matches substrings by default: e.g. `adguard.com` matches `www.adguar Strict matching can be enabled by enclosing the value in double quotes: e.g. `"adguard.com"` matches `adguard.com` but doesn't match `www.adguard.com`. `response_status`: -* blocked: only blocked entries -* whitelisted: only white-listed entries -* processed: all not blocked, not white-listed entries +* all +* filtered - all kinds of filtering +* blocked - blocked or blocked service +* blocked_safebrowsing - blocked by safebrowsing +* blocked_parental - blocked by parental control +* whitelisted - whitelisted +* rewritten - all kinds of rewrites +* safe_search - enforced safe search +* processed - not blocked, not white-listed entries Response: From 15e714350cf7dfa3ed39ff2a02a083fa1f4fa46d Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 16 Jun 2020 11:47:26 +0300 Subject: [PATCH 3/3] fix search by "whitelisted", "rewritten" --- querylog/search_criteria.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/querylog/search_criteria.go b/querylog/search_criteria.go index bc2aa43537b..3c1ee0de738 100644 --- a/querylog/search_criteria.go +++ b/querylog/search_criteria.go @@ -101,7 +101,10 @@ func (c *searchCriteria) match(entry *logEntry) bool { case filteringStatusAll: return true case filteringStatusFiltered: - return res.IsFiltered + return res.IsFiltered || + res.Reason == dnsfilter.NotFilteredWhiteList || + res.Reason == dnsfilter.ReasonRewrite || + res.Reason == dnsfilter.RewriteEtcHosts case filteringStatusBlocked: return res.IsFiltered && (res.Reason == dnsfilter.FilteredBlackList || @@ -111,11 +114,10 @@ func (c *searchCriteria) match(entry *logEntry) bool { case filteringStatusBlockedSafebrowsing: return res.IsFiltered && res.Reason == dnsfilter.FilteredSafeBrowsing case filteringStatusWhitelisted: - return res.IsFiltered && res.Reason == dnsfilter.NotFilteredWhiteList + return res.Reason == dnsfilter.NotFilteredWhiteList case filteringStatusRewritten: - return res.IsFiltered && - (res.Reason == dnsfilter.ReasonRewrite || - res.Reason == dnsfilter.RewriteEtcHosts) + return (res.Reason == dnsfilter.ReasonRewrite || + res.Reason == dnsfilter.RewriteEtcHosts) case filteringStatusSafeSearch: return res.IsFiltered && res.Reason == dnsfilter.FilteredSafeSearch