Get rid of duplicate variable definitions
This commit is contained in:
parent
ce615e1855
commit
057db71f3b
|
@ -68,10 +68,9 @@ var config = configuration{
|
||||||
binaryFile: "coredns", // only filename, no path
|
binaryFile: "coredns", // only filename, no path
|
||||||
coreFile: "Corefile", // only filename, no path
|
coreFile: "Corefile", // only filename, no path
|
||||||
FilteringConfig: dnsforward.FilteringConfig{
|
FilteringConfig: dnsforward.FilteringConfig{
|
||||||
ProtectionEnabled: true,
|
ProtectionEnabled: true, // whether or not use any of dnsfilter features
|
||||||
FilteringEnabled: true,
|
FilteringEnabled: true, // whether or not use filter lists
|
||||||
SafeBrowsingEnabled: false,
|
BlockedResponseTTL: 10, // in seconds
|
||||||
BlockedResponseTTL: 10, // in seconds
|
|
||||||
},
|
},
|
||||||
QueryLogEnabled: true,
|
QueryLogEnabled: true,
|
||||||
Ratelimit: 20,
|
Ratelimit: 20,
|
||||||
|
|
|
@ -31,9 +31,9 @@ func generateServerConfig() dnsforward.ServerConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
newconfig := dnsforward.ServerConfig{
|
newconfig := dnsforward.ServerConfig{
|
||||||
UDPListenAddr: &net.UDPAddr{Port: config.CoreDNS.Port},
|
UDPListenAddr: &net.UDPAddr{Port: config.CoreDNS.Port},
|
||||||
BlockedResponseTTL: config.CoreDNS.BlockedResponseTTL,
|
FilteringConfig: config.CoreDNS.FilteringConfig,
|
||||||
Filters: filters,
|
Filters: filters,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, u := range config.CoreDNS.UpstreamDNS {
|
for _, u := range config.CoreDNS.UpstreamDNS {
|
||||||
|
|
|
@ -74,28 +74,25 @@ func (s *Server) RUnlock() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type FilteringConfig struct {
|
type FilteringConfig struct {
|
||||||
ProtectionEnabled bool `yaml:"protection_enabled"`
|
ProtectionEnabled bool `yaml:"protection_enabled"`
|
||||||
FilteringEnabled bool `yaml:"filtering_enabled"`
|
FilteringEnabled bool `yaml:"filtering_enabled"`
|
||||||
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
|
BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
|
||||||
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
|
|
||||||
ParentalEnabled bool `yaml:"parental_enabled"`
|
dnsfilter.Config `yaml:",inline"`
|
||||||
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)
|
Upstreams []Upstream
|
||||||
Upstreams []Upstream
|
Filters []dnsfilter.Filter
|
||||||
Filters []dnsfilter.Filter
|
|
||||||
|
|
||||||
FilteringConfig
|
FilteringConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultValues = ServerConfig{
|
var defaultValues = ServerConfig{
|
||||||
UDPListenAddr: &net.UDPAddr{Port: 53},
|
UDPListenAddr: &net.UDPAddr{Port: 53},
|
||||||
BlockedResponseTTL: 3600,
|
FilteringConfig: FilteringConfig{BlockedResponseTTL: 3600},
|
||||||
Upstreams: []Upstream{
|
Upstreams: []Upstream{
|
||||||
//// dns over HTTPS
|
//// dns over HTTPS
|
||||||
// &dnsOverHTTPS{Address: "https://1.1.1.1/dns-query"},
|
// &dnsOverHTTPS{Address: "https://1.1.1.1/dns-query"},
|
||||||
|
|
Loading…
Reference in New Issue