proxy-pilot 0.6.1

Core-agnostic proxy health monitor, automatic failover daemon, and multi-channel alerting tool for Linux servers.
Documentation
# ==============================================================================
# proxy-pilot Configuration Example
# ==============================================================================
# Copy this file to /etc/proxy-pilot/config.yaml on your server and edit it.
# IMPORTANT: Never commit your real config.yaml (with tokens) to Git!
# ==============================================================================

# ------------------------------------------------------------------------------
# 1. Proxy Core Settings (Xray / future: sing-box)
# ------------------------------------------------------------------------------
core:
  kind: "xray"                                # Proxy core type
  binary_path: "/var/lib/proxy-pilot/bin/xray"
  config_path: "/usr/local/etc/xray/config.json"
  service_name: "xray"                        # systemd service name
  local_proxy: "socks5h://127.0.0.1:10808"    # Fixed local proxy used for probes

# ------------------------------------------------------------------------------
# 2. Routing Mode (No TUN - Only Whitelisted Domains Use Proxy)
# ------------------------------------------------------------------------------
routing:
  # ONLY matching domains/patterns use the proxy; everything else goes direct.
  # Supports Xray prefixes:
  #   - "domain:example.com"  -> matches example.com AND all subdomains (*.example.com)
  #   - "regexp:..."          -> regular expression match
  mode: "whitelist"
  whitelist_domains:
    - "domain:telegram.org"
    - "domain:t.me"
    - "domain:googleapis.com"      # Gemini API
    - "domain:youtube.com"
    - "domain:docker.io"           # All *.docker.io (registry-1, auth, etc.)
    - "domain:docker.com"          # All *.docker.com
    - "domain:ghcr.io"
    - "domain:gitlab.com"          # GitLab & all *.gitlab.com (registry, etc.)
    - "domain:pypi.org"            # Python pip / uv
    - "domain:pythonhosted.org"

# ------------------------------------------------------------------------------
# 3. Proxy Profiles (Failover Order: lower priority number = tried first)
# ------------------------------------------------------------------------------
profiles:
  - name: "germany-1"
    outbound_tag: "proxy-de-1"
    priority: 1

  - name: "finland-2"
    outbound_tag: "proxy-fi-2"
    priority: 2

# ------------------------------------------------------------------------------
# 3. Health Probe & Anti-Flapping Settings
# ------------------------------------------------------------------------------
probe:
  interval_secs: 5           # Check active proxy every 5 seconds
  timeout_secs: 4            # Max wait time per target request
  failure_threshold: 3       # Consecutive failures before switching profile (~15s)
  recovery_threshold: 2      # Consecutive successes before marking recovered
  max_latency_ms: 2500       # Switch profile if response is slower than 2500ms
  benchmark_interval_secs: 900 # Re-rank all profiles in background every 15m (0 = off)
  auto_prune_after_hours: 24   # Remove profiles dead for 24h straight (0 = off)
  # Optional direct (no-proxy) URL to verify host internet before auto-pruning
  # (e.g. "https://www.aparat.com" on Iran servers, or any local reachable URL)
  direct_check_url: "https://www.aparat.com"

  targets:
    - name: "gemini"
      url: "https://generativelanguage.googleapis.com/"
      expected_status: [200, 404]
      blocked_status: [403, 429]

    - name: "youtube"
      url: "https://www.youtube.com/generate_204"
      expected_status: [204, 200]
      blocked_status: [403, 429]

    - name: "telegram"
      url: "https://api.telegram.org/"
      expected_status: [200, 404]
      blocked_status: [403, 429]

# ------------------------------------------------------------------------------
# 4. Alerting Channels (VPN-Independent)
# ------------------------------------------------------------------------------
notify:
  cooldown_secs: 300         # Wait 5 minutes before repeating a critical alert

  bale:
    enabled: true
    # Tip: In production, set BALE_BOT_TOKEN env var instead of hardcoding here
    bot_token: "REPLACE_WITH_BALE_BOT_TOKEN"
    chat_id: "REPLACE_WITH_CHAT_ID"