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
+29
View File
@@ -24,6 +24,35 @@ func TestIPZanRequestURLSetsRequestedCount(t *testing.T) {
}
}
func TestIPZanRequestURLForcesJSONForAuthMode(t *testing.T) {
raw := "https://service.ipzan.com/core-extract?num=1&mode=auth&format=txt&secret=x"
got, err := NewIPZanProvider().RequestURL(raw, 8)
if err != nil {
t.Fatal(err)
}
u, err := url.Parse(got)
if err != nil {
t.Fatal(err)
}
if mode := u.Query().Get("mode"); mode != "auth" {
t.Fatalf("mode=%q, want auth", mode)
}
if format := u.Query().Get("format"); format != "json" {
t.Fatalf("format=%q, want json", format)
}
}
func TestIPZanParseRejectsAuthModeWithoutCredentials(t *testing.T) {
body := []byte(`{"code":0,"status":200,"data":{"list":[{"ip":"1.2.3.4","port":8001}]}}`)
_, err := NewIPZanProvider().Parse(
"https://service.ipzan.com/core-extract?mode=auth&protocol=1",
body,
)
if err == nil || !IsFatal(err) {
t.Fatalf("expected fatal missing-credentials error, got %v", err)
}
}
func TestIPZanParseTextMultiple(t *testing.T) {
body := []byte("1.2.3.4:8001\r\n5.6.7.8:8002\r\n")
got, err := NewIPZanProvider().Parse(