feat: 支持国密 TLS 网站扫描
测试构建 / 代码检查 (push) Has been cancelled
测试构建 / 单元测试和构建 (push) Has been cancelled
测试构建 / 构建验证 (push) Has been cancelled

- 添加 tjfoc/gmsm 依赖,提供 gmtls 国密 TLS 支持
- 新增国密 HTTP 客户端 ClientGM/ClientNoRedirectGM
- DetectHTTPScheme 增加国密 TLS 回退检测,返回 https-gm 协议标识
- webtitle 插件识别并路由到国密客户端
- DoRequest 标准 TLS 失败时自动回退国密客户端
This commit is contained in:
ZacharyZcR
2026-05-13 19:10:37 +08:00
parent b2e91d9fc0
commit d412786228
6 changed files with 161 additions and 17 deletions
+13
View File
@@ -446,6 +446,19 @@ func DoRequest(req *http.Request, redirect bool) (*Response, error) {
oResp, err = ClientNoRedirect.Do(req)
}
// 标准TLS连接失败时,尝试国密TLS客户端
if err != nil && req.URL.Scheme == "https" {
if redirect {
if oResp2, err2 := ClientGM.Do(req); err2 == nil {
oResp, err = oResp2, nil
}
} else {
if oResp2, err2 := ClientNoRedirectGM.Do(req); err2 == nil {
oResp, err = oResp2, nil
}
}
}
if err != nil {
// HTTP请求失败,计为TCP失败
common.GetGlobalState().IncrementTCPFailedPacketCount()