移除废案只修复请求域名排行显示
This commit is contained in:
33
.trae/documents/修复屏蔽规则解析问题.md
Normal file
33
.trae/documents/修复屏蔽规则解析问题.md
Normal file
@@ -0,0 +1,33 @@
|
||||
1. **修复未定义函数问题**:移除对 `containsRegexSpecialChars` 函数的调用,该函数在代码中未定义
|
||||
|
||||
2. **修改正则表达式处理逻辑**:
|
||||
|
||||
* 对于 `/` 包裹的规则,直接将中间内容作为正则表达式模式
|
||||
|
||||
* 不再添加 `.*` 前缀和后缀,也不再使用 `regexp.QuoteMeta` 转义
|
||||
|
||||
* 确保正则表达式能正确匹配域名中的相关内容
|
||||
|
||||
3. **修改文件**:
|
||||
|
||||
* `/root/dns/shield/manager.go`:更新 `parseRule` 函数中的正则表达式处理逻辑
|
||||
|
||||
**验证修复**:
|
||||
|
||||
确保 `/ad.qq.com/` 规则能正确匹配 `ad.qq.com` 域名
|
||||
|
||||
确保 `/ad/` 规则能匹配包含 `ad` 的域名
|
||||
|
||||
* 确保正则表达式特殊字符能被正确处理
|
||||
* **测试场景**:
|
||||
|
||||
* 测试 `/ad.qq.com/` 规则匹配 `ad.qq.com`
|
||||
|
||||
* 测试 `/ad.qq.com/` 规则匹配 `sub.ad.qq.com`
|
||||
|
||||
* 测试 `/ad/` 规则匹配 `ad.example.com`
|
||||
|
||||
* 测试 `/ad/` 规则匹配 `example.ad.com`
|
||||
|
||||
* 测试 `/^ad/` 规则匹配 `ad.example.com` 但不匹配 `example.ad.com`
|
||||
|
||||
Reference in New Issue
Block a user