FreeGuard CLI Commands Reference
FreeGuard CLI provides a complete set of commands to manage your VPN connection, subscription, and configuration from the terminal. Every command supports --json output for scripting and AI agent integration.
Global Flags
These flags work with any command:
| Flag | Description |
|---|---|
--json |
Output in JSON format (agent-friendly) |
--quiet, -q |
Silent mode, only output results |
--verbose, -v |
Detailed output with debug information |
--no-color |
Disable colored output |
--lang <code> |
Interface language (auto, en, zh, ja, etc.) |
--config <path> |
Use a specific configuration file |
Connection
freeguard connect
Connect to a VPN server. Without arguments, automatically selects the fastest available node.
# Auto-connect to the best server
freeguard connect
# Connect to a specific node by ID
freeguard connect us-new-01
# Connect to the best server in a country
freeguard connect --country JP
# Use a specific protocol
freeguard connect --protocol anytls
# Enable TUN mode (requires sudo/admin)
freeguard connect --tun
Human-readable output:
✓ Connected to United States - New York (us-new-01)
Protocol: anytls | Latency: 42ms
Proxy: 127.0.0.1:7890 (HTTP/SOCKS5)
JSON output:
freeguard connect --json
{"status": "connected", "node": "us-new-01", "protocol": "anytls", "latency_ms": 42}
Flags:
| Flag | Description |
|---|---|
--country <code> |
Connect to best node in this country (ISO 3166-1 alpha-2) |
--protocol <name> |
Preferred protocol (anytls, hysteria2, vless, etc.) |
--tun |
Use TUN mode for system-wide VPN (requires elevated privileges) |
freeguard disconnect
Disconnect from the current VPN server.
freeguard disconnect
✓ Disconnected
freeguard disconnect --json
{"status": "disconnected"}
freeguard status
Show the current connection status and traffic statistics.
freeguard status
FreeGuard VPN Status
────────────────────
Status: ● Connected
Node: United States - New York (us-new-01)
Protocol: anytls
Latency: 42ms
Upload: 1.2 MB/s
Download: 15.8 MB/s
Duration: 2h 15m
Mode: System Proxy (HTTP/SOCKS5)
freeguard status --json
{
"connected": true,
"node": {"id": "us-new-01", "name": "United States - New York", "country": "US"},
"protocol": "anytls",
"latency_ms": 42,
"traffic": {"upload_bps": 1258291, "download_bps": 16569754},
"duration_seconds": 8100,
"mode": "system_proxy",
"proxy_port": {"mixed": 7890}
}
Authentication
freeguard login
Authenticate with FreeGuard. Supports email verification (no account needed) or FreeGuard account login.
Email login (recommended):
# Step 1: Request verification code
freeguard login --email [email protected] --send-code
# Step 2: Enter the code
freeguard login --email [email protected] --code 123456
✓ Logged in successfully!
✓ Found 1 active subscription (Pro Plan, expires 2026-12-01)
Account login (opens browser):
freeguard login --account
Flags:
| Flag | Description |
|---|---|
--email <address> |
Login with email verification |
--send-code |
Send verification code to email |
--code <digits> |
Submit the 6-digit verification code |
--account |
Login with FreeGuard account via browser OAuth |
freeguard logout
Clear stored credentials and disconnect if currently connected.
freeguard logout
✓ Logged out. Credentials cleared.
Subscription
freeguard subscribe list
View available subscription plans and your current subscription status.
freeguard subscribe list
Your Subscription
─────────────────
Plan: Pro
Status: Active
Expires: 2026-12-01
Traffic: 450 GB / Unlimited
Available Plans
───────────────
Plan Monthly Quarterly Annual
Basic $4.99 $12.99 $39.99
Pro $9.99 $24.99 $79.99
freeguard subscribe list --json
{
"current": {"plan": "pro", "status": "active", "expires": "2026-12-01"},
"plans": [
{"name": "basic", "prices": {"monthly": 4.99, "quarterly": 12.99, "annual": 39.99}},
{"name": "pro", "prices": {"monthly": 9.99, "quarterly": 24.99, "annual": 79.99}}
]
}
freeguard subscribe create
Create a new subscription. Opens your browser to complete payment via Stripe or cryptocurrency.
# Interactive plan selection
freeguard subscribe create
# Specify plan directly
freeguard subscribe create --plan pro --email [email protected]
Flags:
| Flag | Description |
|---|---|
--plan <name> |
Subscription plan (basic, pro) |
--email <address> |
Email for subscription delivery |
Configuration
freeguard config get
Read a configuration value.
freeguard config get proxy.port
7890
freeguard config get proxy.port --json
{"key": "proxy.port", "value": 7890}
freeguard config set
Change a configuration value.
freeguard config set proxy.port 8080
✓ proxy.port set to 8080
Common configuration keys:
| Key | Default | Description |
|---|---|---|
proxy.port |
7890 |
HTTP/SOCKS5 proxy port |
proxy.mode |
rule |
Proxy mode: rule, global, direct |
core.api_port |
9090 |
Mihomo API port |
core.pinned_version |
(empty) | Pin mihomo to a specific version |
dns.provider |
auto |
DNS provider |
update.auto_check |
true |
Check for updates on startup |
freeguard config edit
Open the configuration file in your default editor.
freeguard config edit
Diagnostics
freeguard doctor
Run a comprehensive environment check to diagnose issues.
freeguard doctor
FreeGuard Environment Check
───────────────────────────
✓ OS: macOS 15.2 (arm64)
✓ CLI version: v1.0.0
✓ Core version: mihomo v1.19.21
✓ Config dir: ~/.freeguard/
✓ Credentials: Logged in (email: u***@example.com)
✓ Subscription: Active (expires 2026-12-01)
✓ Network: Internet reachable
✓ DNS: Working (8.8.8.8)
✗ TUN permission: Not available (run with sudo for TUN mode)
✓ Port 7890: Available
✓ GeoIP database: Up to date (2026-03-15)
Result: 10/11 checks passed. TUN mode requires elevated privileges.
freeguard doctor --json
{
"checks": [
{"name": "os", "status": "pass", "detail": "macOS 15.2 (arm64)"},
{"name": "cli_version", "status": "pass", "detail": "v1.0.0"},
{"name": "tun_permission", "status": "fail", "detail": "Not available (run with sudo)"}
],
"passed": 10,
"total": 11
}
freeguard version
Display version information for the CLI and core engine.
freeguard version
FreeGuard CLI v1.0.0
Core: mihomo v1.19.21
OS: darwin/arm64
freeguard version --json
{"cli": "1.0.0", "core": "1.19.21", "os": "darwin", "arch": "arm64"}
Advanced (Phase 2+)
The following commands are planned for future releases.
freeguard node list
List available VPN nodes with filtering and sorting.
freeguard node list
freeguard node list --country US --sort latency
Flags:
| Flag | Description |
|---|---|
--country <code> |
Filter by country code |
--protocol <name> |
Filter by protocol |
--sort <field> |
Sort by speed, latency, or load |
freeguard node test
Test latency and speed of nodes.
freeguard node test us-new-01
freeguard node test --all
freeguard monitor
Display real-time traffic monitoring in your terminal.
freeguard monitor
↑ 0.8 MB/s ↓ 12.3 MB/s Connections: 47
freeguard core
Manage the underlying mihomo engine.
# Check core status
freeguard core status
# Update to latest core version
freeguard core update
# Restart the core engine
freeguard core restart
freeguard shell
Enter interactive REPL mode for running multiple commands in a session.
freeguard shell
freeguard dashboard
Open the TUI dashboard with real-time traffic graphs, node list, and connection details.
freeguard dashboard
Last updated: March 2026