version: 1 security: requireProtectionOnPublicListen: true defaults: fetch: estimatedIPsPerCall: 100 requestInterval: 1s timeout: 5s maxAttempts: 3 maxInFlight: 1 maxResponseBytes: 1048576 templateTimeout: 100ms retry: initial: 500ms max: 30s jitter: 20 check: interval: 30s jitter: 20 maxInFlight: 200 timeout: 3s maxAttempts: 2 maxConsecutiveFailures: 3 urls: - http://connect.rom.miui.com/generate_204 gateway: enabled: true listen: 0.0.0.0:8080 access: allowCIDRs: - 10.0.0.0/8 - 172.16.0.0/12 trustedProxies: [] auth: mode: usernamePassword username: "${GATEWAY_USER}" password: "${GATEWAY_PASSWORD}" limits: maxConcurrentConnections: 200000 retry: maxAttempts: 2 retryMethods: [GET, HEAD] destinationPolicy: denyPrivateNetworks: true denyLoopback: true denyLinkLocal: true denyCIDRs: - 169.254.169.254/32 distribution: enabled: true listen: 0.0.0.0:8081 access: allowCIDRs: - 10.0.0.0/8 - 172.16.0.0/12 trustedProxies: [] auth: mode: apiKey header: X-API-Key token: "${DISTRIBUTION_API_KEY}" limits: requestsPerMinute: 6000 requestsPerMinutePerClient: 600 clientIdentification: mode: authenticatedClientOrSourceIP extraction: fulfillment: partial maxCountPerRequest: 100 minRemainingTTL: 30s maxHealthCheckAge: 15s reserveForGateway: 100 idempotencyTTL: 5m admin: enabled: true listen: 127.0.0.1:8082 auth: mode: none metrics: enabled: true listen: 127.0.0.1:9090 storage: postgresURL: "${POSTGRES_URL}" redisURL: "${REDIS_URL}" routing: - name: gateway-default enabled: true purpose: gateway match: hostRegex: '.*' upstreams: [provider-a, provider-b] strategy: type: sequential switchAfterEmptyFetch: 5 endBehavior: stayLast onUnavailable: action: reject - name: extract-default enabled: true purpose: extract match: hostRegex: '.*' upstreams: [provider-a, provider-b] strategy: type: sequential switchAfterEmptyFetch: 5 endBehavior: stayLast onUnavailable: action: reject upstreams: provider-a: enabled: true exposure: [gateway, extract] provider: billingMode: fetch protocols: [http, https] api: url: https://provider-a.example/api/proxies method: GET auth: type: apiKey location: header name: X-Provider-Key value: "${PROVIDER_A_TOKEN}" query: count: '100' template: '{{.}}' proxyAuth: type: response pool: maxSize: 10000 shrinkDelay: 30s capacity: maxConcurrencyPerProxy: 20 refill: reconcileInterval: 1s minimumAvailableSlots: 8000 targetAvailableSlots: 12000 lifecycle: ttl: 5m allocationSafetyMargin: 30s fetch: estimatedIPsPerCall: 100 requestInterval: 1s timeout: 5s maxAttempts: 3 maxInFlight: 1 maxTotal: 1000000 maxResponseBytes: 1048576 templateTimeout: 100ms retry: initial: 500ms max: 30s jitter: 20 check: interval: 30s jitter: 20 maxInFlight: 200 timeout: 3s maxAttempts: 2 maxConsecutiveFailures: 3 urls: - http://connect.rom.miui.com/generate_204 provider-b: enabled: true exposure: [gateway, extract] provider: billingMode: subscription protocols: [http] api: url: https://provider-b.example/api/proxies method: POST auth: type: basic username: "${PROVIDER_B_USER}" password: "${PROVIDER_B_PASSWORD}" headers: Content-Type: application/json body: type: json value: count: '100' template: '{{.}}' proxyAuth: type: static username: "${PROXY_USER}" password: "${PROXY_PASSWORD}" pool: maxSize: 5000 shrinkDelay: 30s capacity: maxConcurrencyPerProxy: 10 refill: reconcileInterval: 1s minimumAvailableSlots: 8000 targetAvailableSlots: 12000 lifecycle: ttl: 2m allocationSafetyMargin: 20s fetch: estimatedIPsPerCall: 100 requestInterval: 2s timeout: 5s maxAttempts: 3 maxInFlight: 1 maxTotal: 0 maxResponseBytes: 1048576 templateTimeout: 100ms retry: initial: 1s max: 30s jitter: 20 check: interval: 20s jitter: 20 maxInFlight: 100 timeout: 3s maxAttempts: 2 maxConsecutiveFailures: 3 urls: - http://connect.rom.miui.com/generate_204