Move filtering setting fields from main app to dnsforward.
This commit is contained in:
parent
7120f551c8
commit
8316d39b42
64
config.go
64
config.go
|
@ -44,25 +44,21 @@ type configuration struct {
|
||||||
|
|
||||||
// field ordering is important -- yaml fields will mirror ordering from here
|
// field ordering is important -- yaml fields will mirror ordering from here
|
||||||
type coreDNSConfig struct {
|
type coreDNSConfig struct {
|
||||||
binaryFile string
|
binaryFile string
|
||||||
coreFile string
|
coreFile string
|
||||||
Filters []filter `yaml:"-"`
|
Filters []filter `yaml:"-"`
|
||||||
Port int `yaml:"port"`
|
Port int `yaml:"port"`
|
||||||
ProtectionEnabled bool `yaml:"protection_enabled"`
|
|
||||||
FilteringEnabled bool `yaml:"filtering_enabled"`
|
dnsforward.FilteringConfig `yaml:",inline"`
|
||||||
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
|
|
||||||
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
|
QueryLogEnabled bool `yaml:"querylog_enabled"`
|
||||||
ParentalEnabled bool `yaml:"parental_enabled"`
|
Ratelimit int `yaml:"ratelimit"`
|
||||||
ParentalSensitivity int `yaml:"parental_sensitivity"`
|
RefuseAny bool `yaml:"refuse_any"`
|
||||||
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"`
|
Pprof string `yaml:"-"`
|
||||||
QueryLogEnabled bool `yaml:"querylog_enabled"`
|
Cache string `yaml:"-"`
|
||||||
Ratelimit int `yaml:"ratelimit"`
|
Prometheus string `yaml:"-"`
|
||||||
RefuseAny bool `yaml:"refuse_any"`
|
BootstrapDNS string `yaml:"bootstrap_dns"`
|
||||||
Pprof string `yaml:"-"`
|
UpstreamDNS []string `yaml:"upstream_dns"`
|
||||||
Cache string `yaml:"-"`
|
|
||||||
Prometheus string `yaml:"-"`
|
|
||||||
BootstrapDNS string `yaml:"bootstrap_dns"`
|
|
||||||
UpstreamDNS []string `yaml:"upstream_dns"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// field ordering is important -- yaml fields will mirror ordering from here
|
// field ordering is important -- yaml fields will mirror ordering from here
|
||||||
|
@ -84,20 +80,22 @@ var config = configuration{
|
||||||
BindPort: 3000,
|
BindPort: 3000,
|
||||||
BindHost: "127.0.0.1",
|
BindHost: "127.0.0.1",
|
||||||
CoreDNS: coreDNSConfig{
|
CoreDNS: coreDNSConfig{
|
||||||
Port: 53,
|
Port: 53,
|
||||||
binaryFile: "coredns", // only filename, no path
|
binaryFile: "coredns", // only filename, no path
|
||||||
coreFile: "Corefile", // only filename, no path
|
coreFile: "Corefile", // only filename, no path
|
||||||
ProtectionEnabled: true,
|
FilteringConfig: dnsforward.FilteringConfig{
|
||||||
FilteringEnabled: true,
|
ProtectionEnabled: true,
|
||||||
SafeBrowsingEnabled: false,
|
FilteringEnabled: true,
|
||||||
BlockedResponseTTL: 10, // in seconds
|
SafeBrowsingEnabled: false,
|
||||||
QueryLogEnabled: true,
|
BlockedResponseTTL: 10, // in seconds
|
||||||
Ratelimit: 20,
|
},
|
||||||
RefuseAny: true,
|
QueryLogEnabled: true,
|
||||||
BootstrapDNS: "8.8.8.8:53",
|
Ratelimit: 20,
|
||||||
UpstreamDNS: defaultDNS,
|
RefuseAny: true,
|
||||||
Cache: "cache",
|
BootstrapDNS: "8.8.8.8:53",
|
||||||
Prometheus: "prometheus :9153",
|
UpstreamDNS: defaultDNS,
|
||||||
|
Cache: "cache",
|
||||||
|
Prometheus: "prometheus :9153",
|
||||||
},
|
},
|
||||||
Filters: []filter{
|
Filters: []filter{
|
||||||
{Filter: dnsforward.Filter{ID: 1}, Enabled: true, URL: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt", Name: "AdGuard Simplified Domain Names filter"},
|
{Filter: dnsforward.Filter{ID: 1}, Enabled: true, URL: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt", Name: "AdGuard Simplified Domain Names filter"},
|
||||||
|
|
|
@ -72,12 +72,24 @@ func (s *Server) RUnlock() {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
type FilteringConfig struct {
|
||||||
|
ProtectionEnabled bool `yaml:"protection_enabled"`
|
||||||
|
FilteringEnabled bool `yaml:"filtering_enabled"`
|
||||||
|
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
|
||||||
|
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
|
||||||
|
ParentalEnabled bool `yaml:"parental_enabled"`
|
||||||
|
ParentalSensitivity int `yaml:"parental_sensitivity"`
|
||||||
|
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"`
|
||||||
|
}
|
||||||
|
|
||||||
// The zero ServerConfig is empty and ready for use.
|
// The zero ServerConfig is empty and ready for use.
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
UDPListenAddr *net.UDPAddr // if nil, then default is is used (port 53 on *)
|
UDPListenAddr *net.UDPAddr // if nil, then default is is used (port 53 on *)
|
||||||
BlockedResponseTTL uint32 // if 0, then default is used (3600)
|
BlockedResponseTTL uint32 // if 0, then default is used (3600)
|
||||||
Upstreams []Upstream
|
Upstreams []Upstream
|
||||||
Filters []Filter
|
Filters []Filter
|
||||||
|
|
||||||
|
FilteringConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultValues = ServerConfig{
|
var defaultValues = ServerConfig{
|
||||||
|
|
Loading…
Reference in New Issue