From fe23b33d7e9fcace84ea8506db5003936c911dd9 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Thu, 8 Aug 2019 12:41:00 +0300 Subject: [PATCH] + config: "statistics_interval" setting --- home/config.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home/config.go b/home/config.go index b4c943dc..600cad41 100644 --- a/home/config.go +++ b/home/config.go @@ -107,6 +107,9 @@ type dnsConfig struct { BindHost string `yaml:"bind_host"` Port int `yaml:"port"` + // time interval for statistics (in days) + StatsInterval uint `yaml:"statistics_interval"` + dnsforward.FilteringConfig `yaml:",inline"` UpstreamDNS []string `yaml:"upstream_dns"` @@ -161,8 +164,9 @@ var config = configuration{ BindPort: 3000, BindHost: "0.0.0.0", DNS: dnsConfig{ - BindHost: "0.0.0.0", - Port: 53, + BindHost: "0.0.0.0", + Port: 53, + StatsInterval: 1, FilteringConfig: dnsforward.FilteringConfig{ ProtectionEnabled: true, // whether or not use any of dnsfilter features FilteringEnabled: true, // whether or not use filter lists @@ -264,6 +268,10 @@ func parseConfig() error { return err } + if !checkStatsInterval(config.DNS.StatsInterval) { + config.DNS.StatsInterval = 1 + } + for _, cy := range config.Clients { cli := Client{ Name: cy.Name,