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
+7 -3
View File
@@ -180,13 +180,17 @@ func (a *App) Startup(ctx context.Context) {
logger.LogEvent("活动", "warn", "配置中的活动 %q 未识别,已回退到默认活动 %s", a.cfg.Activity, act.DisplayName)
}
proxyURL := a.effectiveProxyURL(a.cfg)
a.client = client.New(act, a.cfg.TimeAPIURL, a.getTrace(), proxyURL)
a.client, _ = client.NewWithProxy(act, a.cfg.TimeAPIURL, a.getTrace(), proxyURL)
if a.client == nil {
logger.LogEvent("代理", "error", "启动时代理配置无效,已回退直连: %s", client.MaskProxyURL(proxyURL))
a.client, _ = client.NewWithProxy(act, a.cfg.TimeAPIURL, a.getTrace(), "")
}
if proxyURL != "" {
logger.LogEvent("代理", "info", "已启用代理: %s", proxyURL)
logger.LogEvent("代理", "info", "已启用代理: %s", client.MaskProxyURL(proxyURL))
}
a.font = imgpkg.LoadFont(a.paths.FontFiles)
a.scheduler = seckill.New(a.client, a.paths, a.font, a.cfg.Concurrency, a.cfg.Attempts, a.cfg.RetryStages, a.cfg.SeckillMode)
a.scheduler.UpdateProxySettings(a.cfg.ProxyEnabled, a.cfg.ProxyURL, a.cfg.ProxyAPI, a.cfg.AutoFetchProxyOnSchedule)
a.scheduler.UpdateProxySettings(a.cfg)
a.scheduler.SetStateChangeCallback(func(state string) {
runtime.EventsEmit(a.ctx, seckillStateEvent, state)
})