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

@ -13,56 +13,58 @@ import (
) )
type Config struct { type Config struct {
LogLevel int `toml:"log_level"` LogLevel int `toml:"log_level"`
LogFile *string `toml:"log_file"` LogFile *string `toml:"log_file"`
UseSyslog bool `toml:"use_syslog"` UseSyslog bool `toml:"use_syslog"`
ServerNames []string `toml:"server_names"` ServerNames []string `toml:"server_names"`
ListenAddresses []string `toml:"listen_addresses"` ListenAddresses []string `toml:"listen_addresses"`
Daemonize bool Daemonize bool
ForceTCP bool `toml:"force_tcp"` ForceTCP bool `toml:"force_tcp"`
Timeout int `toml:"timeout_ms"` Timeout int `toml:"timeout_ms"`
CertRefreshDelay int `toml:"cert_refresh_delay"` CertRefreshDelay int `toml:"cert_refresh_delay"`
CertIgnoreTimestamp bool `toml:"cert_ignore_timestamp"` CertIgnoreTimestamp bool `toml:"cert_ignore_timestamp"`
BlockIPv6 bool `toml:"block_ipv6"` BlockIPv6 bool `toml:"block_ipv6"`
Cache bool Cache bool
CacheSize int `toml:"cache_size"` CacheSize int `toml:"cache_size"`
CacheNegTTL uint32 `toml:"cache_neg_ttl"` CacheNegTTL uint32 `toml:"cache_neg_ttl"`
CacheMinTTL uint32 `toml:"cache_min_ttl"` CacheMinTTL uint32 `toml:"cache_min_ttl"`
CacheMaxTTL uint32 `toml:"cache_max_ttl"` CacheMaxTTL uint32 `toml:"cache_max_ttl"`
QueryLog QueryLogConfig `toml:"query_log"` QueryLog QueryLogConfig `toml:"query_log"`
NxLog NxLogConfig `toml:"nx_log"` NxLog NxLogConfig `toml:"nx_log"`
BlockName BlockNameConfig `toml:"blacklist"` BlockName BlockNameConfig `toml:"blacklist"`
BlockIP BlockIPConfig `toml:"ip_blacklist"` BlockIP BlockIPConfig `toml:"ip_blacklist"`
ForwardFile string `toml:"forwarding_rules"` ForwardFile string `toml:"forwarding_rules"`
ServersConfig map[string]ServerConfig `toml:"static"` ServersConfig map[string]ServerConfig `toml:"static"`
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"`
SourceIPv4 bool `toml:"ipv4_servers"` SourceRequireNoFilter bool `toml:"require_nofilter"`
SourceIPv6 bool `toml:"ipv6_servers"` SourceIPv4 bool `toml:"ipv4_servers"`
MaxClients uint32 `toml:"max_clients"` SourceIPv6 bool `toml:"ipv6_servers"`
FallbackResolver string `toml:"fallback_resolver"` MaxClients uint32 `toml:"max_clients"`
IgnoreSystemDNS bool `toml:"ignore_system_dns"` FallbackResolver string `toml:"fallback_resolver"`
IgnoreSystemDNS bool `toml:"ignore_system_dns"`
} }
func newConfig() Config { func newConfig() Config {
return Config{ return Config{
LogLevel: int(dlog.LogLevel()), LogLevel: int(dlog.LogLevel()),
ListenAddresses: []string{"127.0.0.1:53"}, ListenAddresses: []string{"127.0.0.1:53"},
Timeout: 2500, Timeout: 2500,
CertRefreshDelay: 30, CertRefreshDelay: 30,
CertIgnoreTimestamp: false, CertIgnoreTimestamp: false,
Cache: true, Cache: true,
CacheSize: 256, CacheSize: 256,
CacheNegTTL: 60, CacheNegTTL: 60,
CacheMinTTL: 60, CacheMinTTL: 60,
CacheMaxTTL: 8600, CacheMaxTTL: 8600,
SourceRequireNoLog: true, SourceRequireNoLog: true,
SourceIPv4: true, SourceRequireNoFilter: true,
SourceIPv6: false, SourceIPv4: true,
MaxClients: 100, SourceIPv6: false,
FallbackResolver: DefaultFallbackResolver, MaxClients: 100,
IgnoreSystemDNS: false, FallbackResolver: DefaultFallbackResolver,
IgnoreSystemDNS: false,
} }
} }
@ -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

@ -26,8 +26,9 @@ const (
type ServerInformalProperties uint64 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 {