* stats: use uint32 or uint64 integer values, not int
This commit is contained in:
@@ -110,7 +110,7 @@ type dnsConfig struct {
|
||||
Port int `yaml:"port"`
|
||||
|
||||
// time interval for statistics (in days)
|
||||
StatsInterval uint `yaml:"statistics_interval"`
|
||||
StatsInterval uint32 `yaml:"statistics_interval"`
|
||||
|
||||
dnsforward.FilteringConfig `yaml:",inline"`
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type statsConfig struct {
|
||||
Interval uint `json:"interval"`
|
||||
Interval uint32 `json:"interval"`
|
||||
}
|
||||
|
||||
// Get stats configuration
|
||||
@@ -89,6 +89,6 @@ func RegisterStatsHandlers() {
|
||||
httpRegister(http.MethodGet, "/control/stats_info", handleStatsInfo)
|
||||
}
|
||||
|
||||
func checkStatsInterval(i uint) bool {
|
||||
func checkStatsInterval(i uint32) bool {
|
||||
return i == 1 || i == 7 || i == 30 || i == 90
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ func initDNSServer(baseDir string) {
|
||||
log.Fatalf("Cannot create DNS data dir at %s: %s", baseDir, err)
|
||||
}
|
||||
|
||||
config.stats, err = stats.New(filepath.Join(baseDir, "stats.db"), int(config.DNS.StatsInterval), nil)
|
||||
statsDBFilename := filepath.Join(baseDir, "stats.db")
|
||||
config.stats, err = stats.New(statsDBFilename, config.DNS.StatsInterval, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't initialize statistics module")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user