feat(proxy): 支持品赞分组代理与自动白名单
This commit is contained in:
@@ -174,6 +174,7 @@ func defaultConfig() types.Config {
|
||||
RetryStages: defaultRetryStages(),
|
||||
SeckillMode: types.SeckillModeAggressive,
|
||||
XiaodianPageSize: 200,
|
||||
AccountsPerProxy: constants.DefaultAccountsPerProxy,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,11 +229,21 @@ func LoadConfig(path string) types.Config {
|
||||
if len(cfg.RetryStages) == 0 {
|
||||
cfg.RetryStages = defaultRetryStages()
|
||||
}
|
||||
normalizeProxyConfig(&cfg)
|
||||
normalizeXiaodianConfig(&cfg)
|
||||
logger.LogEvent("配置", "success", "配置加载完成: %s", path)
|
||||
return cfg
|
||||
}
|
||||
|
||||
func normalizeProxyConfig(cfg *types.Config) {
|
||||
if cfg.AccountsPerProxy <= 0 {
|
||||
cfg.AccountsPerProxy = constants.DefaultAccountsPerProxy
|
||||
}
|
||||
if cfg.AccountsPerProxy > constants.MaxAccountsPerProxy {
|
||||
cfg.AccountsPerProxy = constants.MaxAccountsPerProxy
|
||||
}
|
||||
}
|
||||
|
||||
// normalizeXiaodianConfig 约束和平小店分页参数,接口单页最大为 200。
|
||||
func normalizeXiaodianConfig(cfg *types.Config) {
|
||||
if cfg.XiaodianPageSize <= 0 || cfg.XiaodianPageSize > 200 {
|
||||
|
||||
Reference in New Issue
Block a user