+ config: "statistics_interval" setting

This commit is contained in:
Simon Zolin 2019-08-08 12:41:00 +03:00 committed by Ildar Kamalov
parent cc2654c371
commit fe23b33d7e
1 changed files with 10 additions and 2 deletions

View File

@ -107,6 +107,9 @@ type dnsConfig struct {
BindHost string `yaml:"bind_host"` BindHost string `yaml:"bind_host"`
Port int `yaml:"port"` Port int `yaml:"port"`
// time interval for statistics (in days)
StatsInterval uint `yaml:"statistics_interval"`
dnsforward.FilteringConfig `yaml:",inline"` dnsforward.FilteringConfig `yaml:",inline"`
UpstreamDNS []string `yaml:"upstream_dns"` UpstreamDNS []string `yaml:"upstream_dns"`
@ -161,8 +164,9 @@ var config = configuration{
BindPort: 3000, BindPort: 3000,
BindHost: "0.0.0.0", BindHost: "0.0.0.0",
DNS: dnsConfig{ DNS: dnsConfig{
BindHost: "0.0.0.0", BindHost: "0.0.0.0",
Port: 53, Port: 53,
StatsInterval: 1,
FilteringConfig: dnsforward.FilteringConfig{ FilteringConfig: dnsforward.FilteringConfig{
ProtectionEnabled: true, // whether or not use any of dnsfilter features ProtectionEnabled: true, // whether or not use any of dnsfilter features
FilteringEnabled: true, // whether or not use filter lists FilteringEnabled: true, // whether or not use filter lists
@ -264,6 +268,10 @@ func parseConfig() error {
return err return err
} }
if !checkStatsInterval(config.DNS.StatsInterval) {
config.DNS.StatsInterval = 1
}
for _, cy := range config.Clients { for _, cy := range config.Clients {
cli := Client{ cli := Client{
Name: cy.Name, Name: cy.Name,