feat(proxy): 支持品赞分组代理与自动白名单
This commit is contained in:
+7
-3
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user