refactor: 删除未使用的辅助函数
移除两个保留但实际未调用的函数: - proxy: 删除 handleWebSocket(WebSocket逻辑已整合到 ServeHTTP) - variable/ssl: 删除 parsePEMCertificate(证书解析已在其他模块处理) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
50a960c539
commit
20518495b3
@ -680,19 +680,6 @@ func isWebSocketRequest(ctx *fasthttp.RequestCtx) bool {
|
||||
return strings.EqualFold(string(upgrade), "websocket")
|
||||
}
|
||||
|
||||
// handleWebSocket 处理 WebSocket 升级请求(保留用于兼容性,实际逻辑在 ServeHTTP 中)
|
||||
//
|
||||
//nolint:unused // 保留用于未来 WebSocket 功能扩展
|
||||
func (p *Proxy) handleWebSocket(ctx *fasthttp.RequestCtx, target *loadbalance.Target, _ *fasthttp.HostClient) {
|
||||
timeout := p.config.Timeout.Connect
|
||||
if timeout == 0 {
|
||||
timeout = 30 * time.Second
|
||||
}
|
||||
if err := WebSocket(ctx, target, timeout); err != nil {
|
||||
logging.Error().Msgf("WebSocket proxy error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateTargets 更新代理目标并重新初始化客户端。
|
||||
// 适用于动态配置更新。
|
||||
func (p *Proxy) UpdateTargets(targets []*loadbalance.Target) error {
|
||||
|
||||
@ -14,7 +14,6 @@ package variable
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
@ -275,17 +274,3 @@ func calculateFingerprint(raw []byte) string {
|
||||
// 格式化为十六进制
|
||||
return fmt.Sprintf("%X", hash)
|
||||
}
|
||||
|
||||
// parsePEMCertificate 解析 PEM 格式的证书。
|
||||
//
|
||||
// 参数:
|
||||
// - pemData: PEM 编码的证书数据
|
||||
//
|
||||
// 返回值:
|
||||
// - *pem.Block: 解析后的 PEM 块
|
||||
// - []byte: 剩余数据
|
||||
//
|
||||
//nolint:unused // 保留用于未来 SSL 变量解析功能
|
||||
func parsePEMCertificate(pemData []byte) (*pem.Block, []byte) {
|
||||
return pem.Decode(pemData)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user