Files
kami_gateway/internal/utils/proxy_pool_test.go
danial 7bfb3195e1 fix(config): 更新配置文件和代理日志输出优化
- 修改数据库密码和 Redis 连接信息为新的配置
- 更新配置模型中 Redis 默认主机和密码
- 优化获取代理时日志记录,添加成功日志和失败错误日志
- 测试用例中使用 resty 检测代理有效性,替换 sleep 暂停方式
2025-12-09 01:49:58 +08:00

19 lines
423 B
Go

package utils
import (
"gateway/internal/cache"
"github.com/go-resty/resty/v2"
"testing"
)
func TestGetProxy(t *testing.T) {
cache.Start()
StartProxyPool()
channel := []string{"channel_four", "channel_five", "channel_six"}
for _, c := range channel {
proxy, _ := GetProxy(t.Context(), "2434534543", c)
resp, err := resty.New().SetProxy(proxy).R().Get("https://www.qq.com")
t.Log(resp.StatusCode(), err)
}
}