mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-06 13:01:51 +08:00
Merge pull request #107 from RuoJi6/feat/proxy-pool
feat: 全局代理池(健康检查、定时/失效轮换、热切换、脱敏)— Depends on #106
This commit is contained in:
1 parent
f0993424e5
commit
05dd5b40e8
20 files changed
+2646
-68
No files matched your search
@@ -368,7 +368,7 @@ func (s *Server) runScriptTool(ctx context.Context, key string, execRaw json.Raw
|
||||
}
|
||||
body, err := execPython(ctx, interp, key, spec.Code, params, workDir, sessionEnv, timeoutOr(spec.TimeoutMs, 120000))
|
||||
if err != nil {
|
||||
return actool.Errorf(err.Error()), nil
|
||||
return actool.Errorf(maskSecrets(err.Error())), nil
|
||||
}
|
||||
return actool.Text(actool.Capture(tc, body)), nil
|
||||
}
|
||||
@@ -436,7 +436,7 @@ func (s *Server) runHTTPTool(ctx context.Context, execRaw json.RawMessage, param
|
||||
defer cancel()
|
||||
req, err := http.NewRequestWithContext(runCtx, method, rawURL, bodyReader)
|
||||
if err != nil {
|
||||
return actool.Errorf(err.Error()), nil
|
||||
return actool.Errorf(maskSecrets(err.Error())), nil
|
||||
}
|
||||
for k, v := range spec.Headers {
|
||||
req.Header.Set(k, renderTemplate(v, params, identity))
|
||||
@@ -450,7 +450,7 @@ func (s *Server) runHTTPTool(ctx context.Context, execRaw json.RawMessage, param
|
||||
if spec.UseRecordingProxy || strings.TrimSpace(spec.Proxy) == strings.TrimSpace(s.m.GlobalProxy()) {
|
||||
s.handleProxyToolFailure(runCtx, err)
|
||||
}
|
||||
return actool.Errorf("请求失败: " + err.Error()), nil
|
||||
return actool.Errorf("请求失败: " + maskSecrets(err.Error())), nil
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
|
||||
|
||||
Reference in new issue
Block a user