fix(parsers): 修复带横杠域名被误识别为IP范围的问题

如 111-555.sss.com 这类域名因包含 - 被错误解析为 IP 范围,
添加 looksLikeIPRange() 检查,只有 - 前是有效 IP 才走范围解析
This commit is contained in:
ZacharyZcR
2026-01-21 16:34:07 +08:00
parent 80f16fe039
commit 98641d49b8
2 changed files with 24 additions and 1 deletions
+10
View File
@@ -444,6 +444,16 @@ func TestParseIP_SingleIP(t *testing.T) {
"example.com",
[]string{"example.com"},
},
{
"带横杠的域名",
"111-555.sss.com",
[]string{"111-555.sss.com"},
},
{
"多段横杠域名",
"my-test-server.example.com",
[]string{"my-test-server.example.com"},
},
}
for _, tt := range tests {