update
This commit is contained in:
46
dns/.trae/documents/配置文件移除文件路径定义并固定文件位置.md
Normal file
46
dns/.trae/documents/配置文件移除文件路径定义并固定文件位置.md
Normal file
@@ -0,0 +1,46 @@
|
||||
1. **修改配置结构体定义**:
|
||||
|
||||
* 从`config/config.go`中的`DNSConfig`结构体移除`StatsFile`字段
|
||||
|
||||
* 从`ShieldConfig`结构体移除`LocalRulesFile`、`HostsFile`、`StatsFile`、`RemoteRulesCacheDir`字段
|
||||
|
||||
* 从`LogConfig`结构体移除`File`字段
|
||||
|
||||
2. **修改配置加载逻辑**:
|
||||
|
||||
* 在`config/config.go`的`LoadConfig`函数中,移除对上述字段的默认值设置
|
||||
|
||||
3. **修改代码中使用配置的地方**:
|
||||
|
||||
* `dns/server.go`:将`s.config.StatsFile`替换为硬编码的`"data/stats.json"`
|
||||
|
||||
* `shield/manager.go`:将`m.config.StatsFile`替换为硬编码的`"data/shield_stats.json"`
|
||||
|
||||
* 其他使用这些配置项的地方也需要相应修改
|
||||
|
||||
4. **修改默认配置生成**:
|
||||
|
||||
* 在`main.go`的`createDefaultConfig`函数中,移除所有文件路径相关的配置项
|
||||
|
||||
5. **修改Web界面配置处理**:
|
||||
|
||||
* 修改`static/js/config.js`,移除对这些文件路径配置项的处理
|
||||
|
||||
6. **更新配置文件**:
|
||||
|
||||
* 修改`config.json`,移除所有文件路径相关的配置项
|
||||
|
||||
固定的文件位置:
|
||||
|
||||
* 日志文件:`logs/dns-server.log`
|
||||
|
||||
* DNS统计文件:`data/stats.json`
|
||||
|
||||
* Shield统计文件:`data/shield_stats.json`
|
||||
|
||||
* 本地规则文件:`data/rules.txt`
|
||||
|
||||
* Hosts文件:`data/hosts.txt`
|
||||
|
||||
* 远程规则缓存目录:`data/remote_rules`
|
||||
|
||||
Reference in New Issue
Block a user