Implement the nofilter filter

This commit is contained in:
Frank Denis 2018-01-30 19:13:50 +01:00
parent 3448b5b170
commit a7d75c7923
2 changed files with 54 additions and 48 deletions

View File

@ -38,6 +38,7 @@ type Config struct {
SourcesConfig map[string]SourceConfig `toml:"sources"` SourcesConfig map[string]SourceConfig `toml:"sources"`
SourceRequireDNSSEC bool `toml:"require_dnssec"` SourceRequireDNSSEC bool `toml:"require_dnssec"`
SourceRequireNoLog bool `toml:"require_nolog"` SourceRequireNoLog bool `toml:"require_nolog"`
SourceRequireNoFilter bool `toml:"require_nofilter"`
SourceIPv4 bool `toml:"ipv4_servers"` SourceIPv4 bool `toml:"ipv4_servers"`
SourceIPv6 bool `toml:"ipv6_servers"` SourceIPv6 bool `toml:"ipv6_servers"`
MaxClients uint32 `toml:"max_clients"` MaxClients uint32 `toml:"max_clients"`
@ -58,6 +59,7 @@ func newConfig() Config {
CacheMinTTL: 60, CacheMinTTL: 60,
CacheMaxTTL: 8600, CacheMaxTTL: 8600,
SourceRequireNoLog: true, SourceRequireNoLog: true,
SourceRequireNoFilter: true,
SourceIPv4: true, SourceIPv4: true,
SourceIPv6: false, SourceIPv6: false,
MaxClients: 100, MaxClients: 100,
@ -215,6 +217,9 @@ func ConfigLoad(proxy *Proxy, svcFlag *string, config_file string) error {
if config.SourceRequireNoLog { if config.SourceRequireNoLog {
requiredProps |= ServerInformalPropertyNoLog requiredProps |= ServerInformalPropertyNoLog
} }
if config.SourceRequireNoFilter {
requiredProps |= ServerInformalPropertyNoFilter
}
for cfgSourceName, cfgSource := range config.SourcesConfig { for cfgSourceName, cfgSource := range config.SourcesConfig {
if cfgSource.URL == "" { if cfgSource.URL == "" {

View File

@ -28,6 +28,7 @@ type ServerInformalProperties uint64
const ( const (
ServerInformalPropertyDNSSEC = ServerInformalProperties(1) << 0 ServerInformalPropertyDNSSEC = ServerInformalProperties(1) << 0
ServerInformalPropertyNoLog = ServerInformalProperties(1) << 1 ServerInformalPropertyNoLog = ServerInformalProperties(1) << 1
ServerInformalPropertyNoFilter = ServerInformalProperties(1) << 2
) )
type RegisteredServer struct { type RegisteredServer struct {