agent-proxy
Domain-based selective proxy CLI. Route AI services, developer tools, and search engines through your overseas server — everything else stays direct.
60+ domains pre-configured. One command to set up. SSH-encrypted tunnel. Zero runtime dependencies.
📖 Full documentation: chiga0.github.io/agent-proxy
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Your Machine │
│ │
│ Browser / Electron ──PAC──▶ 127.0.0.1:18080 (PAC server) │
│ │ │
│ CLI / SDK ──env vars──▶ 127.0.0.1:18443 (SSH tunnel) │
│ │ │
└────────────────────────────────────┼────────────────────────────┘
│ SSH (encrypted)
▼
┌────────────────────────────────────────────────────────────────┐
│ Your ECS (Tokyo / Singapore) ││ 127.0.0.1:18443 ──▶ Squid (loopback only) ──▶ Target Site │ │ │ │ • Deny-first ACL (no public data port) │ │ • Blocks localhost / RFC1918 / cloud metadata │ └────────────────────────────────────────────────────────────────┘
**Two routing paths, one proxy:**
| Path | Mechanism | Scope |
|------|-----------|-------|
| Browser / Desktop | System PAC → `127.0.0.1:18080` | Only whitelisted domains |
| CLI / SDK | `https_proxy` + `no_proxy` env vars | All HTTP(S) except `no_proxy` |
## ECS Requirements
Before setting up, ensure your overseas server meets these requirements:
|------|------------|-------| | OS | Ubuntu 18.04+, Debian 10+, CentOS 7+, Alpine 3.12+ | Needs apt, yum, or apk | | Init system | systemd, OpenRC, or SysVinit | Auto-detected during deploy | | CPU / RAM | 1 vCPU / 512 MB minimum | Squid is lightweight; SSH tunnel is the main overhead | | Disk | 1 GB free | Squid package + logs | | Network | Public IP (EIP) or NAT gateway with outbound internet | Required for package install and proxying | | SSH | Port 22 accessible from your machine | Key-based auth recommended | | Security group | Inbound: TCP 22 (SSH). Tunnel mode needs nothing else | Direct mode also needs TCP 18443 from your IP | | DNS | ECS can resolve public domains | Uses ECS's /etc/resolv.conf nameservers |
Recommended regions: Tokyo (preferred), Singapore — low latency to both China and major AI/dev services.
Tunnel mode (recommended): Only SSH port 22 needs to be open. Squid listens on 127.0.0.1 only — zero public data ports.
Setup
Install agent-proxy
# Auto-detect OS/arch, pick fastest mirror, verify SHA-256
curl -fsSL https://raw.githubusercontent.com/chiga0/agent-proxy/main/install.sh | bash<details <summaryOther install methods</summary
# China mirror (faster for CN users)
curl -fsSL https://agent-proxy.oss-cn-hangzhou.aliyuncs.com/install.sh | bash
# Specific version
curl -fsSL ... | bash -s -- --version v0.7.3
# Go install
GONOSUMDB=github.com/chiga0/agent-proxy go install github.com/chiga0/agent-proxy/cmd/agent-proxy@latest
# Build from source
git clone https://github.com/chiga0/agent-proxy.git
cd agent-proxy && make build</details