proxy-pool/examples/config/08-sequential-failover.yaml
2026-07-30 14:15:48 +08:00

41 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Provider 返回连续 5 次合法空结果后Routing 从 A 原子前进到 B。
version: 1
security: {requireProtectionOnPublicListen: true}
gateway: {enabled: true, listen: '127.0.0.1:8080', auth: {mode: none}}
routing:
- name: sequential-gateway
enabled: true
purpose: gateway
match: {hostRegex: '.*'}
upstreams: [provider-a, provider-b]
strategy:
type: sequential
switchAfterEmptyFetch: 5
endBehavior: stayLast
onUnavailable: {action: reject}
upstreams:
provider-a:
enabled: true
exposure: [gateway]
provider: {billingMode: fetch, protocols: [http]}
api: {url: https://provider-a.example/proxies, method: GET, auth: {type: none}, template: '{{.}}'}
proxyAuth: {type: response}
pool: {maxSize: 500}
capacity: {maxConcurrencyPerProxy: 10}
refill: {reconcileInterval: 1s, minimumAvailableSlots: 25, targetAvailableSlots: 50}
lifecycle: {ttl: 2m, allocationSafetyMargin: 15s}
fetch: {estimatedIPsPerCall: 10, requestInterval: 1s, timeout: 3s, maxAttempts: 3, maxInFlight: 1, maxTotal: 10000}
check: {interval: 30s, jitter: 20, maxInFlight: 100, timeout: 2s, maxAttempts: 2, maxConsecutiveFailures: 3}
provider-b:
enabled: true
exposure: [gateway]
provider: {billingMode: subscription, protocols: [http]}
api: {url: https://provider-b.example/proxies, method: GET, auth: {type: none}, template: '{{.}}'}
proxyAuth: {type: response}
pool: {maxSize: 500}
capacity: {maxConcurrencyPerProxy: 10}
refill: {reconcileInterval: 1s, minimumAvailableSlots: 25, targetAvailableSlots: 50}
lifecycle: {ttl: 3m, allocationSafetyMargin: 15s}
fetch: {estimatedIPsPerCall: 10, requestInterval: 2s, timeout: 3s, maxAttempts: 3, maxInFlight: 1}
check: {interval: 30s, jitter: 20, maxInFlight: 100, timeout: 2s, maxAttempts: 2, maxConsecutiveFailures: 3}