Merge pull request #67 in DNS/adguard-dns from feature/333 to master

* commit '383f1c2fb38437e682ec9fc6623672730dae4581':
  Hide badge if core is not running
  Add client requests for toggle protection
  API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering
This commit is contained in:
Eugene Bujak
2018-10-11 16:23:01 +03:00
8 changed files with 129 additions and 239 deletions

View File

@@ -35,6 +35,7 @@ type coreDNSConfig struct {
coreFile string
FilterFile string `yaml:"-"`
Port int `yaml:"port"`
ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
@@ -69,6 +70,7 @@ var config = configuration{
binaryFile: "coredns", // only filename, no path
coreFile: "Corefile", // only filename, no path
FilterFile: "dnsfilter.txt", // only filename, no path
ProtectionEnabled: true,
FilteringEnabled: true,
SafeBrowsingEnabled: false,
BlockedResponseTTL: 10, // in seconds
@@ -165,13 +167,13 @@ func writeAllConfigs() error {
}
const coreDNSConfigTemplate = `. {
dnsfilter {{if .FilteringEnabled}}{{.FilterFile}}{{end}} {
{{if .ProtectionEnabled}}dnsfilter {{if .FilteringEnabled}}{{.FilterFile}}{{end}} {
{{if .SafeBrowsingEnabled}}safebrowsing{{end}}
{{if .ParentalEnabled}}parental {{.ParentalSensitivity}}{{end}}
{{if .SafeSearchEnabled}}safesearch{{end}}
{{if .QueryLogEnabled}}querylog{{end}}
blocked_ttl {{.BlockedResponseTTL}}
}
}{{end}}
{{.Pprof}}
hosts {
fallthrough