proxy-pilot 0.7.1

Core-agnostic proxy health monitor, automatic failover daemon, and multi-channel alerting tool for Linux servers.
Documentation
# proxy-pilot

[![Crates.io](https://img.shields.io/crates/v/proxy-pilot.svg)](https://crates.io/crates/proxy-pilot)
[![Release](https://img.shields.io/github/v/release/amirhosein2004/proxy-pilot)](https://github.com/amirhosein2004/proxy-pilot/releases)
[![CI](https://github.com/amirhosein2004/proxy-pilot/actions/workflows/ci.yml/badge.svg)](https://github.com/amirhosein2004/proxy-pilot/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

Core-agnostic proxy health monitor, automatic failover daemon, and multi-channel alerting tool written in Rust for Linux servers — battle-tested on Iran server deployments and designed to work on any restricted or geo-blocked network worldwide.

## Features

- **Real End-to-End Health Probes:** Tests actual access to sanctioned/filtered targets (e.g. Gemini, YouTube, Telegram) through the active proxy, distinguishing tunnel outages from IP geo-blocks (`403` / `429`).
- **Automatic Failover & Anti-Flapping:** Switches to the next healthy proxy profile only after consecutive failures (`failure_threshold`), and automatically recovers previously failed profiles.
- **Non-Disruptive Periodic Background Benchmarking:** Every `15` minutes (`benchmark_interval_secs: 900`), probes all profiles in parallel using an isolated temporary core session without interrupting active traffic, updating `priority` order automatically.
- **Safe Auto-Prune with Direct Connectivity Check:** Automatically removes profiles that stay continuously dead for `24` hours (`auto_prune_after_hours`), guarded by a configurable direct (non-proxied) `direct_check_url` (e.g., a domestic site in Iran or any local reachable URL in other regions) so a host internet outage never deletes valid profiles.
- **VPN-Independent Alerting:**
  - **Bale Bot API** (default Iranian messenger channel)
  - Planned: **Heartbeat / Dead Man's Switch**, **SMS**, **Email**, **Webhook**
- **Core-Agnostic Architecture:** Starts with **Xray** (including automatic installation and profile management), designed to support **sing-box** and other cores without changing the engine.
- **Single Static Binary:** Distributed via GitHub Releases (`musl` static Linux binaries) with zero runtime dependencies on the target server.

## Quick Install

### Linux (recommended for servers)
Downloads the static binary, verifies `SHA-256`, installs Xray if needed, sets up `/etc/proxy-pilot/config.yaml`, and enables `systemd`:

```bash
curl -fsSL https://raw.githubusercontent.com/amirhosein2004/proxy-pilot/main/scripts/install.sh | sudo bash
```

### macOS (Intel & Apple Silicon)
```bash
curl -fsSL https://raw.githubusercontent.com/amirhosein2004/proxy-pilot/main/scripts/install-macos.sh | bash
```

### Windows (PowerShell)
```powershell
irm https://raw.githubusercontent.com/amirhosein2004/proxy-pilot/main/scripts/install.ps1 | iex
```

### Cargo (crates.io)
If you have Rust/Cargo installed:
```bash
cargo install proxy-pilot --locked
```

> **Note:** `cargo install` only installs the `proxy-pilot` binary into `~/.cargo/bin` (it does not create `config.yaml`, install Xray, or set up `systemd`). After installing with Cargo:
> - Download [`config.example.yaml`]config.example.yaml as `config.yaml`, then run `proxy-pilot import --config config.yaml` and `proxy-pilot run --config config.yaml`.
> - Or, on a Linux server where you want automatic Xray + `systemd` setup, run the Linux installer script (`scripts/install.sh`) instead.

### Manual install (Linux, without script)
```bash
# 1. Download binary + checksum (replace amd64 with arm64 on ARM servers)
curl -fsSL -o proxy-pilot-linux-amd64 https://github.com/amirhosein2004/proxy-pilot/releases/latest/download/proxy-pilot-linux-amd64
curl -fsSL -o proxy-pilot-linux-amd64.sha256 https://github.com/amirhosein2004/proxy-pilot/releases/latest/download/proxy-pilot-linux-amd64.sha256
sha256sum -c proxy-pilot-linux-amd64.sha256
sudo install -m 0755 proxy-pilot-linux-amd64 /usr/local/bin/proxy-pilot

# 2. Config & systemd service
sudo mkdir -p /etc/proxy-pilot
sudo curl -fsSL -o /etc/proxy-pilot/config.yaml https://raw.githubusercontent.com/amirhosein2004/proxy-pilot/main/config.example.yaml
sudo chmod 600 /etc/proxy-pilot/config.yaml
sudo curl -fsSL -o /etc/systemd/system/proxy-pilot.service https://raw.githubusercontent.com/amirhosein2004/proxy-pilot/main/deploy/proxy-pilot.service
sudo systemctl daemon-reload
sudo systemctl enable --now proxy-pilot

# 3. Import your vless:// links
sudo proxy-pilot import
```

## Quick Usage

```bash
# Import vless:// profiles interactively
proxy-pilot import

# Benchmark all profiles in parallel and reorder by latency
proxy-pilot benchmark

# Remove all dead/unhealthy profiles
proxy-pilot prune

# Check active core and profile status
proxy-pilot status

# Run the watchdog daemon in the foreground
proxy-pilot run
```

## Documentation

See [`docs/README.md`](docs/README.md) for the full technical documentation index, architecture overview, coding standards, and extension guides.

## License

MIT