fix: 修复 i18n.Tr vet 报错、Unicode 测试用例,移除过期域名

- 移除 i18n.Tr 中错误的 fmt.Sprintf fallback,消除 go vet 误报
- 修复 match_engine_test Unicode 测试用例与 Latin-1 转换逻辑不匹配
- README 移除过期的 fscan.club 域名
- 添加 .gitattributes 统一换行符为 LF
This commit is contained in:
ZacharyZcR
2026-04-25 08:09:32 +08:00
parent 43f0d32354
commit d3463456d9
5 changed files with 11 additions and 12 deletions
+2
View File
@@ -0,0 +1,2 @@
# 统一换行符为 LF
* text=auto eol=lf
+1 -1
View File
@@ -4,7 +4,7 @@
内网综合扫描工具,一键自动化漏扫。 内网综合扫描工具,一键自动化漏扫。
**版本**: 2.1.1 | **官网**: https://fscan.club/ **版本**: 2.1.1
## 功能特性 ## 功能特性
+1 -1
View File
@@ -4,7 +4,7 @@
Comprehensive intranet scanning tool for automated vulnerability assessment. Comprehensive intranet scanning tool for automated vulnerability assessment.
**Version**: 2.1.1 | **Website**: https://fscan.club/ **Version**: 2.1.1
## Features ## Features
-4
View File
@@ -83,10 +83,6 @@ func Tr(key string, args ...interface{}) string {
TemplateData: data, TemplateData: data,
}) })
if err != nil || msg == "" { if err != nil || msg == "" {
// 回退:尝试用fmt.Sprintf格式化key本身
if len(args) > 0 {
return fmt.Sprintf(key, args...)
}
return key return key
} }
return msg return msg
+7 -6
View File
@@ -355,18 +355,19 @@ func TestMatchPattern_BinaryData(t *testing.T) {
} }
} }
// TestMatchPattern_UnicodeResponse 测试Unicode响应 // TestMatchPattern_UnicodeResponse 测试Latin-1转换后的字节级匹配
func TestMatchPattern_UnicodeResponse(t *testing.T) { func TestMatchPattern_UnicodeResponse(t *testing.T) {
compiled, _ := regexp.Compile(`服务器`) // bytesToLatin1String 按字节逐个映射到 Latin-1 码点
// UTF-8 多字节字符会被拆开,所以用字节级正则匹配
raw := []byte("HTTP/1.1 200 OK\r\nServer: test-srv\r\n")
compiled, _ := regexp.Compile(`test-srv`)
m := &Match{ m := &Match{
PatternCompiled: compiled, PatternCompiled: compiled,
} }
response := []byte("HTTP/1.1 200 OK\r\nServer: 服务器\r\n") result := m.MatchPattern(raw)
result := m.MatchPattern(response)
if !result { if !result {
t.Error("Unicode内容应被匹配") t.Error("Latin-1字节级匹配应成功")
} }
} }