Commit Graph

97 Commits

Author SHA1 Message Date
Simon Zolin a59e346d4a * dnsfilter: major refactoring
* dnsfilter is controlled by package home, not dnsforward
* move HTTP handlers to dnsfilter/
* apply filtering settings without DNS server restart
* use only 1 goroutine for filters update
* apply new filters quickly (after they are ready to be used)
2019-10-09 20:05:21 +03:00
Simon Zolin adb422fedf filtering: refactor; change API; add "filters_update_interval" setting
+ config: "filters_update_interval"
* add /control/filtering_info
* remove /control/filtering/enable
* remove /control/filtering/disable

* add /control/filtering_config
* remove /control/filtering/status

* add /control/filtering/set_url
* remove /control/filtering/enable_url
* remove /control/filtering/disable_url
2019-09-12 18:38:13 +03:00
Simon Zolin c616259e8b * dnsfilter: use golibs/cache
+ config: add cache size settings
+ config: add cache_time setting
2019-09-02 19:12:53 +03:00
Andrey Meshkov c82e93cfc7 -(dnsforward): fixed sigsegv when protection is disabled
Also, fixed all golint issues

 Closes: #941
2019-08-20 00:55:32 +03:00
Simon Zolin d46ebe1c8b Revert "+ config: add cache size settings"
This reverts commit 81303b5db7.
2019-08-16 15:17:38 +03:00
Simon Zolin 68d5d595b6 Revert "* dnsfilter: use fastcache instead of gcache"
This reverts commit 6f51df7d2e.
2019-08-16 15:17:38 +03:00
Simon Zolin 56c69cdb79 Revert "fix tests"
This reverts commit d9265aa9a8.
2019-08-16 15:11:57 +03:00
Simon Zolin ccf72b6008 * safebrowsing/parental: split some code
* dnsfilter.CheckHost() doesn't support host="hostname." (with a trailing dot) anymore
2019-08-08 12:11:24 +03:00
Simon Zolin 15d07a40eb * refactor 2019-08-05 14:12:22 +03:00
Simon Zolin e81a9c7d56 + dnsfilter: use global and per-client BlockedServices array 2019-08-05 14:12:22 +03:00
Simon Zolin 1bb6638db7 + dnsforward: use Rewrites table 2019-07-29 11:48:24 +03:00
Simon Zolin b66e370ffc * dnsfilter: refactor: a simple approach to convert Reason to string 2019-07-29 11:37:10 +03:00
Simon Zolin d9265aa9a8 fix tests 2019-07-23 20:01:50 +03:00
Simon Zolin 6f51df7d2e * dnsfilter: use fastcache instead of gcache 2019-07-23 17:14:13 +03:00
Simon Zolin 81303b5db7 + config: add cache size settings 2019-07-23 15:57:44 +03:00
Simon Zolin a79643f23e + dnsfilter-test: override global safe-browsing setting with a per-client setting 2019-07-15 14:03:22 +03:00
Simon Zolin 57c510631e - dnsfilter: fix crash when global setting 'SafeSearch' is off
but per-client setting is on
2019-07-15 12:10:43 +03:00
Simon Zolin 0a1d7fd707 - fix tests 2019-07-09 11:35:39 +03:00
Simon Zolin b0cfd7228e - dnsfilter: fix post-install error "filter file not found"
Right after installation we don't have the filter files downloaded.
While they are being downloaded, we replace them with an empty filter.
2019-07-05 17:35:40 +03:00
Simon Zolin 134d9275bb * use urlfilter v0.4.0
Now we pass filtering rules to urlfilter as filer file names,
 rather than the list of rule strings.
(Note: user rules are still passed as the list of rule strings).

As a result, we don't store the contents of filter files in memory.
2019-07-04 14:10:01 +03:00
Simon Zolin 1c9abd6107 Merge: + dhcpd, clients, dnsfilter: add more tests
#788

* commit '25da23497a19118a22b97d64749fa70337544116':
  + dnsfilter: more tests
  + dhcpd, clients: add more tests
2019-07-01 19:26:27 +03:00
Simon Zolin 64f66cfb5d * dnsfilter: fix tests: pass config object to NewForTest() 2019-07-01 19:24:52 +03:00
Simon Zolin 42b76ada9d rename dnsfContext -> dnsFilterContext 2019-06-27 10:48:12 +03:00
Simon Zolin 25da23497a + dnsfilter: more tests 2019-06-26 18:13:09 +03:00
Simon Zolin 2307f55715 * dnsfilter: use a single global context object 2019-06-24 19:00:03 +03:00
Andrey Meshkov 082354204b Fix #831
This commit fixes panic when customDialContext fails to resolve the host's address.
2019-06-18 16:18:13 +03:00
Andrey Meshkov 07db927246 Fix #727 - use default parental sensitivity when it's not set 2019-06-06 22:42:17 +03:00
Simon Zolin 3baa6919dc - fix tests and linter issues 2019-05-31 12:27:13 +03:00
Simon Zolin 8bf76c331d + dnsfilter: use callback function for applying per-client settings 2019-05-28 18:44:27 +03:00
Simon Zolin f23507a554 * dnsfilter: parental/safebrowsing: add setting to switch between HTTP and HTTPS 2019-05-27 18:11:05 +03:00
Simon Zolin e2579c72bd * dnsfilter: fix tests 2019-05-24 18:08:08 +03:00
Simon Zolin ac8f703407 + dnsforward: support IPv6 (AAAA response)
If question type is AAAA:
 Before this patch we responded with NXDOMAIN.
 Now we send an empty response if host rule is IPv4;
 or we send an AAAA answer if host rule is IPv6.

+ block ipv6 if rule is "0.0.0.0 blockdomain"
2019-05-24 18:08:08 +03:00
Simon Zolin 9ad4bba9ab * dnsfilter: return the correct IP address (host rules) 2019-05-24 18:08:08 +03:00
Simon Zolin 00e1b6ca08 * dnsfilter: use 'https' for safe-browsing and parental control 2019-05-23 17:26:50 +03:00
Simon Zolin 5ec747b30b * dnsfilter: adapt tests to new interface 2019-05-17 18:22:57 +03:00
Simon Zolin 829415da5b * dnsfilter: use urlfilter package
+ new config setting 'filtering_temp_filename'

* remove AddRules(), modify New()
2019-05-17 18:22:57 +03:00
Simon Zolin 3396d68019 * dnsfilter: remove code for filtering rules 2019-05-17 18:22:57 +03:00
Simon Zolin bd68bf2e25 * dns: rename dnsfilter.Filter.Rule -> dnsfilter.Filter.Data 2019-05-17 18:22:57 +03:00
Simon Zolin d918e5b418 use maxDialCacheSize constant 2019-05-15 12:03:20 +03:00
Simon Zolin b3461d37ca rename functions and container 2019-05-13 14:47:55 +03:00
Simon Zolin 24ae61de3e + dnsfilter: cache IP addresses of safebrowsing and parental control servers 2019-05-13 14:16:07 +03:00
Simon Zolin c4e67690f4 * dnsfilter: don't use global variable for custom resolver function 2019-04-24 12:49:12 +03:00
Simon Zolin f6023b395e - dnsfilter: prevent recursion when both parental control and safebrowsing are enabled 2019-04-24 12:38:05 +03:00
Aleksey Dmitrevskiy a860c8e6ff - dnsfilter: fix npe in dnsfilter test 2019-04-23 15:09:23 +03:00
Aleksey Dmitrevskiy 0794704f74 - dnsfilter: fix safesearch issue #268 2019-04-23 15:08:41 +03:00
Simon Zolin a1b1877667 + parental, safesearch: use our own DNS resolver instead of system default 2019-04-18 14:31:13 +03:00
Johann Richard dfa39293a1
Update safesearch.go
* Beautify again with`gofmt -s`
2019-03-24 19:34:29 +01:00
Johann Richard 65364930f7
Update safesearch.go
* Beautify the addition
2019-03-24 19:26:40 +01:00
Johann Richard 53ea2d28cf
Update safesearch.go
* Add SafeSearch for duckduckgo.com
2019-03-24 19:24:31 +01:00
Aleksey Dmitrevskiy 6b223e2992 * dnsfilter: extend logging 2019-03-18 14:50:33 +03:00