feat(proxy): 支持品赞分组代理与自动白名单

This commit is contained in:
yml
2026-11-19 23:42:56 +08:00
parent 61ea79c7c9
commit 44a5b6c883
24 changed files with 2253 additions and 315 deletions
+18
View File
@@ -4,6 +4,8 @@ import (
"os"
"path/filepath"
"testing"
"douyu_go/internal/constants"
)
func TestMigrateLegacyFile(t *testing.T) {
@@ -110,3 +112,19 @@ func TestExplicitLogDirOverridesWailsDev(t *testing.T) {
t.Fatalf("显式日志目录 = %q, want %q", paths.LogDir, customLogDir)
}
}
func TestLoadConfigNormalizesAccountsPerProxy(t *testing.T) {
path := filepath.Join(t.TempDir(), "config.json")
if err := os.WriteFile(path, []byte(`{"accountsPerProxy":0}`), 0600); err != nil {
t.Fatal(err)
}
if got := LoadConfig(path).AccountsPerProxy; got != constants.DefaultAccountsPerProxy {
t.Fatalf("AccountsPerProxy=%d, want %d", got, constants.DefaultAccountsPerProxy)
}
if err := os.WriteFile(path, []byte(`{"accountsPerProxy":999}`), 0600); err != nil {
t.Fatal(err)
}
if got := LoadConfig(path).AccountsPerProxy; got != constants.MaxAccountsPerProxy {
t.Fatalf("AccountsPerProxy=%d, want %d", got, constants.MaxAccountsPerProxy)
}
}