feat(proxy): 支持多实例独立代理与短效API动态提取
- 实例配置独立:支持为每个实例单独配置 http/https/socks5 代理,避免单机多开挤兑触发斗鱼出口 IP 限流 - 动态 API 提取:原生支持星空代理等平台的 API 提取(兼容 JSON/文本格式),提供前端一键提取填入与连通性/延迟测速 - 定时前自动拉取:针对 3 分钟短效代理,支持在开抢前 15 秒自动提取并绑定最新 IP,并在预热前完成热连接与时间复校 - 修复复校竞态:将 resyncBeforeTrigger 从 3s 提升至 8s,确保三轮采样在开抢前顺利落盘,消除时钟漂移 - 验证方式:通过 go test ./... 全量测试与前端 vue-tsc/vite 编译,实测通过星空代理 API 解析测试用例
This commit is contained in:
@@ -17,6 +17,29 @@ type Config struct {
|
||||
RetryStages []RetryStage `json:"retryStages"` // 精英/电竞手册的锁单重试节奏(按经过秒数分档)
|
||||
SeckillMode SeckillMode `json:"seckillMode"` // 抢购模式:0=标准, 1=激进
|
||||
XiaodianPageSize int `json:"xiaodianPageSize"`
|
||||
ProxyEnabled bool `json:"proxyEnabled"` // 是否启用代理
|
||||
ProxyURL string `json:"proxyUrl"` // 代理地址,支持 http://, https://, socks5://
|
||||
ProxyAPI string `json:"proxyApi"` // 代理提取 API 地址(如星空代理)
|
||||
AutoFetchProxyOnSchedule bool `json:"autoFetchProxyOnSchedule"` // 定时抢购触发前自动从 API 提取最新代理
|
||||
}
|
||||
|
||||
// ProxyTestResult 代理测试结果。
|
||||
type ProxyTestResult struct {
|
||||
Success bool `json:"success"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Latency int64 `json:"latency"` // 往返耗时(毫秒)
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// ProxyFetchResult 代理 API 提取结果。
|
||||
type ProxyFetchResult struct {
|
||||
Success bool `json:"success"`
|
||||
ProxyURL string `json:"proxyUrl,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Port string `json:"port,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// XiaodianProductListOptions 是和平小店商品列表的角色与分页参数。
|
||||
|
||||
Reference in New Issue
Block a user