This commit is contained in:
Alex Yang
2025-11-23 19:35:02 +08:00
parent d870f6bfcc
commit 5a1d44c3b3
10 changed files with 4783 additions and 17 deletions

View File

@@ -31,6 +31,7 @@ type ShieldConfig struct {
CustomBlockIP string `json:"customBlockIP"` // 自定义屏蔽IP当BlockMethod为"customIP"时使用
StatsFile string `json:"statsFile"` // 计数数据持久化文件
StatsSaveInterval int `json:"statsSaveInterval"` // 计数数据保存间隔(秒)
RemoteRulesCacheDir string `json:"remoteRulesCacheDir"` // 远程规则缓存目录
}
// LogConfig 日志配置
@@ -94,6 +95,9 @@ func LoadConfig(path string) (*Config, error) {
if config.Shield.StatsSaveInterval == 0 {
config.Shield.StatsSaveInterval = 300 // 默认5分钟保存一次
}
if config.Shield.RemoteRulesCacheDir == "" {
config.Shield.RemoteRulesCacheDir = "./data/remote_rules" // 默认远程规则缓存目录
}
if config.Log.Level == "" {
config.Log.Level = "info"
}