feat: Antigravity (googleapis.com) 也走 Node.js TLS 代理,消除 Go 指纹
This commit is contained in:
parent
ab1d263cf4
commit
2b7ead30be
@ -124,6 +124,15 @@ func NewHTTPUpstream(cfg *config.Config) service.HTTPUpstream {
|
||||
// - 调用方必须关闭 resp.Body,否则会导致 inFlight 计数泄漏
|
||||
// - inFlight > 0 的客户端不会被淘汰,确保活跃请求不被中断
|
||||
func (s *httpUpstreamService) Do(req *http.Request, proxyURL string, accountID int64, accountConcurrency int) (*http.Response, error) {
|
||||
// Node.js TLS 代理:Anthropic + Google APIs(无 per-account 代理时)
|
||||
if s.isNodeTLSProxyEnabled() && proxyURL == "" && req != nil && req.URL != nil && req.URL.Scheme == "https" {
|
||||
host := req.URL.Hostname()
|
||||
if host == "api.anthropic.com" ||
|
||||
strings.HasSuffix(host, ".googleapis.com") {
|
||||
return s.doViaNodeTLSProxy(req, proxyURL, accountID, accountConcurrency)
|
||||
}
|
||||
}
|
||||
|
||||
if err := s.validateRequestHost(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -175,10 +184,12 @@ func (s *httpUpstreamService) DoWithTLS(req *http.Request, proxyURL string, acco
|
||||
return s.Do(req, proxyURL, accountID, accountConcurrency)
|
||||
}
|
||||
|
||||
// 优先使用 Node.js TLS 代理模式(仅 Anthropic API 且无 per-account 代理)
|
||||
// 如果账号配置了独立代理,走原有 uTLS 路径(保持代理 IP 不变)
|
||||
if s.isNodeTLSProxyEnabled() && proxyURL == "" && req != nil && req.URL != nil && req.URL.Hostname() == "api.anthropic.com" {
|
||||
return s.doViaNodeTLSProxy(req, proxyURL, accountID, accountConcurrency)
|
||||
// 优先使用 Node.js TLS 代理模式(Anthropic + Google APIs,无 per-account 代理)
|
||||
if s.isNodeTLSProxyEnabled() && proxyURL == "" && req != nil && req.URL != nil {
|
||||
host := req.URL.Hostname()
|
||||
if host == "api.anthropic.com" || strings.HasSuffix(host, ".googleapis.com") {
|
||||
return s.doViaNodeTLSProxy(req, proxyURL, accountID, accountConcurrency)
|
||||
}
|
||||
}
|
||||
|
||||
// TLS 指纹已启用,记录调试日志
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user