revert
This commit is contained in:
@@ -12,6 +12,7 @@ type DNSConfig struct {
|
||||
Timeout int `json:"timeout"`
|
||||
StatsFile string `json:"statsFile"` // 统计数据持久化文件
|
||||
SaveInterval int `json:"saveInterval"` // 数据保存间隔(秒)
|
||||
CacheTTL int `json:"cacheTTL"` // DNS缓存过期时间(分钟)
|
||||
}
|
||||
|
||||
// HTTPConfig HTTP控制台配置
|
||||
@@ -19,6 +20,8 @@ type HTTPConfig struct {
|
||||
Port int `json:"port"`
|
||||
Host string `json:"host"`
|
||||
EnableAPI bool `json:"enableAPI"`
|
||||
Username string `json:"username"` // 登录用户名
|
||||
Password string `json:"password"` // 登录密码
|
||||
}
|
||||
|
||||
// BlacklistEntry 黑名单条目
|
||||
@@ -86,12 +89,23 @@ func LoadConfig(path string) (*Config, error) {
|
||||
if config.DNS.SaveInterval == 0 {
|
||||
config.DNS.SaveInterval = 300 // 默认5分钟保存一次
|
||||
}
|
||||
// 默认DNS缓存TTL为30分钟
|
||||
if config.DNS.CacheTTL == 0 {
|
||||
config.DNS.CacheTTL = 30 // 默认30分钟
|
||||
}
|
||||
if config.HTTP.Port == 0 {
|
||||
config.HTTP.Port = 8080
|
||||
}
|
||||
if config.HTTP.Host == "" {
|
||||
config.HTTP.Host = "0.0.0.0"
|
||||
}
|
||||
// 默认用户名和密码,如果未配置则使用admin/admin
|
||||
if config.HTTP.Username == "" {
|
||||
config.HTTP.Username = "admin"
|
||||
}
|
||||
if config.HTTP.Password == "" {
|
||||
config.HTTP.Password = "admin"
|
||||
}
|
||||
if config.Shield.UpdateInterval == 0 {
|
||||
config.Shield.UpdateInterval = 3600
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user