feat(proxy): 增加代理池演练并修复账号密码提取,发布 0.5.1

This commit is contained in:
yml
2026-11-20 12:08:13 +08:00
parent 98b3dc4b16
commit 635d80e63e
13 changed files with 874 additions and 19 deletions
+2 -3
View File
@@ -5,7 +5,6 @@ import (
"fmt"
"net/http"
"net/http/httptest"
"strconv"
"sync/atomic"
"testing"
"time"
@@ -98,6 +97,7 @@ func TestPrepareProxyGroupsRoutesAccountsToDistinctClients(t *testing.T) {
defer apiServer.Close()
act := *activity.Get("peace")
act.StoreHomeURL = timeAPIURL
base := client.New(&act, timeAPIURL, &trace.Recorder{}, "")
scheduler := New(base, types.AppPaths{}, nil, 8, 1, nil, types.SeckillModeAggressive)
scheduler.UpdateProxySettings(types.Config{
@@ -156,9 +156,8 @@ func TestPrepareProxyGroupsRoutesAccountsToDistinctClients(t *testing.T) {
func newTimeProxyServer(t *testing.T) *httptest.Server {
t.Helper()
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
now := strconv.FormatInt(time.Now().Unix(), 10)
w.Header().Set("Content-Type", "application/json")
fmt.Fprintf(w, `{"error":0,"data":{"preExchange":{"currentTime":%q}}}`, now)
fmt.Fprint(w, `{"error":0,"msg":"","data":{"list":[{"commodityId":"bag-1","commodityName":"测试商品"}]}}`)
}))
t.Cleanup(server.Close)
return server