# Clash Verge Operations Guide
*Last updated: 2026‑03‑12*

## Basics

**Application**: `/Applications/Clash Verge.app`  
**Config directory**: `~/Library/Application Support/io.github.clash-verge-rev.clash-verge-rev/`  
**Unix socket**: `/tmp/verge/verge‑mihomo.sock`  
**Secret**: `set‑your‑secret` (default; change in `config.yaml`)

## Proxy Groups & Latency Testing

### List all proxies
```bash
curl -s --unix-socket /tmp/verge/verge-mihomo.sock \
  -H "$1[REDACTED_BEARER_TOKEN]" \
  [REDACTED_INTERNAL_URL] | jq .
```

### Test latency of a specific proxy
```bash
curl -s --unix-socket /tmp/verge/verge-mihomo.sock \
  -H "$1[REDACTED_BEARER_TOKEN]" \
  "[REDACTED_INTERNAL_URL](https)/delay?timeout=5000&url=https://cp.cloudflare.com/generate_204"
```

### Python script for batch testing
See `~/.openclaw/workspace/temp/clash_speed_test.py`

## System Proxy Control

### Enable via config file
1. Edit `verge.yaml`:
   ```yaml
   enable_system_proxy: true
   system_proxy_bypass: null   # or [] for empty bypass list
   use_default_bypass: true    # bypass localhost, [REDACTED_PHONE], etc.
   proxy_host: [REDACTED_PHONE]
   verge_mixed_port: 7897      # HTTP/SOCKS proxy port
   ```
2. **Restart Clash Verge** (kill `verge‑mihomo` process and relaunch app).

### Verify system proxy settings (macOS)
```bash
networksetup -getwebproxy Wi-Fi
networksetup -getsocksfirewallproxy Wi-Fi
```

### Enable via macOS CLI (fallback)
```bash
# HTTP proxy
networksetup -setwebproxy Wi-Fi [REDACTED_PHONE]
networksetup -setwebproxystate Wi-Fi on

# SOCKS proxy
networksetup -setsocksfirewallproxy Wi-Fi [REDACTED_PHONE]
networksetup -setsocksfirewallproxystate Wi-Fi on
```

**Bypass domains** (optional):
```bash
networksetup -setproxybypassdomains Wi-Fi "localhost" "[REDACTED_PHONE]" "*.local"
```

## Current Configuration (2026‑03‑12)

### Active profile
- **Remote**: `JetStream20251123` (`RgZwNAPzWx5C.yaml`)
- **Selected group**: `🌏 当前选择` → `🇺🇸 美国自动` → `TG‑US‑1(hysteria)`
- **Mixed port**: `7897`

### Proxy groups
| Group | Type | Current selection | Latency (ms) |
|-------|------|-------------------|--------------|
| 🌏 当前选择 | Selector | 🇺🇸 美国自动 | – |
| 🇭🇰 香港自动 | Fallback | XG‑HK‑1(https) | 183 |
| 🇨🇳 台湾自动 | Fallback | TG‑TW‑1(https) | 195 |
| 🇸🇬 新加坡自动 | Fallback | TG‑SG‑1(https) | 222 |
| 🇯🇵 日本自动 | Fallback | TG‑JP‑1(https) | 224 |
| 🇺🇸 美国自动 | Fallback | TG‑US‑1(hysteria) | 452 |

### Fastest proxies (per region)
- **Hong Kong**: XG‑HK‑1(https) – 177 ms
- **Taiwan**: TG‑TW‑1(https) – 195 ms
- **Singapore**: TG‑SG‑1(https) – 222 ms
- **Japan**: TG‑JP‑1(https) – 224 ms
- **USA**: TG‑US‑1(hysteria) – 452 ms

## Troubleshooting

### Socket not found
- Ensure Clash Verge is running (`ps aux | grep verge‑mihomo`).
- Socket path may change after restart.

### “Failed to connect” errors
- Check secret token in `config.yaml` matches the one used in requests.
- Verify the `verge‑mihomo` process is listening (`lsof -U | grep verge`).

### System proxy not applying
- Restart Clash Verge after config change.
- Check `sysproxy_tray_icon` setting (should be `false` unless you want tray indicator).
- Manually enable via macOS System Preferences → Network → Advanced → Proxies.

## Automation Ideas

1. **Periodic latency tests** – cron job that logs fastest proxy per region.
2. **Auto‑switch on high latency** – script that changes group selection when current proxy exceeds threshold.
3. **System proxy toggle** – keyboard shortcut to enable/disable via CLI.

## Notes

- The `enable_proxy_guard` setting (when `true`) will automatically disable system proxy after `proxy_guard_duration` seconds (default 30).
- `verge_http_enabled` and `verge_socks_enabled` control separate HTTP/SOCKS ports; `mixed‑port` handles both.