Skip to content

Commit

Permalink
Merge branch '1421-new-qlog-v2' into feature/1421
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemBaskal committed Jun 16, 2020
2 parents 9857682 + 15e7143 commit e0faa04
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
14 changes: 10 additions & 4 deletions AGHTechDoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,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.

Expand All @@ -1246,9 +1246,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:

Expand Down
8 changes: 4 additions & 4 deletions home/whois_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
}
12 changes: 7 additions & 5 deletions querylog/search_criteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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

Expand Down

0 comments on commit e0faa04

Please sign in to comment.