Tham chiếu Lệnh FreeGuard CLI
FreeGuard CLI cung cấp một bộ lệnh đầy đủ để quản lý kết nối VPN, gói đăng ký và cấu hình của bạn từ terminal. Mỗi lệnh đều hỗ trợ đầu ra `--json` để phục vụ scripting và tích hợp với tác nhân AI.

Tham chiếu Lệnh FreeGuard CLI

FreeGuard CLI cung cấp một bộ lệnh đầy đủ để quản lý kết nối VPN, gói đăng ký và cấu hình của bạn từ terminal. Mỗi lệnh đều hỗ trợ đầu ra --json để phục vụ scripting và tích hợp với tác nhân AI.

Cờ Toàn cục

Các cờ này hoạt động với bất kỳ lệnh nào:

Flag Description
--json Xuất theo định dạng JSON (thân thiện với agent)
--quiet, -q Chế độ im lặng, chỉ xuất kết quả
--verbose, -v Đầu ra chi tiết với thông tin gỡ lỗi
--no-color Tắt đầu ra màu
--lang <code> Ngôn ngữ giao diện (auto, en, zh, ja, etc.)
--config <path> Sử dụng tệp cấu hình cụ thể

Kết nối

freeguard connect

Kết nối đến một máy chủ VPN. Không có tham số, nó sẽ tự động chọn nút nhanh nhất hiện có.

# 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

Đầu ra dễ đọc cho người dùng:

✓ Connected to United States - New York (us-new-01)
  Protocol: anytls | Latency: 42ms
  Proxy: 127.0.0.1:7890 (HTTP/SOCKS5)

Đầu ra JSON:

freeguard connect --json
{"status": "connected", "node": "us-new-01", "protocol": "anytls", "latency_ms": 42}

Cờ:

Flag Description
--country <code> Kết nối tới nút tốt nhất trong quốc gia này (ISO 3166-1 alpha-2)
--protocol <name> Giao thức ưu tiên (anytls, hysteria2, vless, etc.)
--tun Sử dụng TUN mode cho VPN toàn hệ thống (cần quyền nâng cao)

freeguard disconnect

Ngắt kết nối khỏi máy chủ VPN hiện tại.

freeguard disconnect
✓ Disconnected
freeguard disconnect --json
{"status": "disconnected"}

freeguard status

Hiển thị trạng thái kết nối hiện tại và thống kê lưu lượng.

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}
}

Xác thực

freeguard login

Xác thực với FreeGuard. Hỗ trợ xác minh email (không cần tài khoản) hoặc đăng nhập bằng tài khoản FreeGuard.

Đăng nhập bằng email (khuyến nghị):

# 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)

Đăng nhập tài khoản (mở trình duyệt):

freeguard login --account

Cờ:

Flag Description
--email <address> Đăng nhập bằng xác minh email
--send-code Gửi mã xác minh đến email
--code <digits> Gửi mã xác minh 6 chữ số
--account Đăng nhập bằng tài khoản FreeGuard qua OAuth trình duyệt

freeguard logout

Xóa thông tin xác thực đã lưu và ngắt kết nối nếu hiện đang kết nối.

freeguard logout
✓ Logged out. Credentials cleared.

Gói đăng ký

freeguard subscribe list

Xem các gói đăng ký khả dụng và trạng thái đăng ký hiện tại của bạn.

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

Tạo một gói đăng ký mới. Mở trình duyệt của bạn để hoàn tất thanh toán qua Stripe hoặc tiền mã hóa.

# Interactive plan selection
freeguard subscribe create

# Specify plan directly
freeguard subscribe create --plan pro --email [email protected]

Cờ:

Flag Description
--plan <name> Gói đăng ký (basic, pro)
--email <address> Email để nhận đăng ký

Cấu hình

freeguard config get

Đọc một giá trị cấu hình.

freeguard config get proxy.port
7890
freeguard config get proxy.port --json
{"key": "proxy.port", "value": 7890}

freeguard config set

Thay đổi một giá trị cấu hình.

freeguard config set proxy.port 8080
✓ proxy.port set to 8080

Các khóa cấu hình phổ biến:

Key Default Description
proxy.port 7890 Cổng Proxy HTTP/SOCKS5
proxy.mode rule Chế độ Proxy: rule, global, direct
core.api_port 9090 Cổng API của Mihomo
core.pinned_version (empty) Khóa mihomo vào một phiên bản cụ thể
dns.provider auto Nhà cung cấp DNS
update.auto_check true Kiểm tra cập nhật khi khởi động

freeguard config edit

Mở tệp cấu hình trong trình soạn thảo mặc định của bạn.

freeguard config edit

Chẩn đoán

freeguard doctor

Chạy kiểm tra toàn diện môi trường để chẩn đoán sự cố.

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

Hiển thị thông tin phiên bản cho CLI và 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"}

Nâng cao (Phase 2+)

Các lệnh sau đang được lên kế hoạch cho các bản phát hành tương lai.

freeguard node list

Liệt kê các nút VPN khả dụng với khả năng lọc và sắp xếp.

freeguard node list
freeguard node list --country US --sort latency

Cờ:

Flag Description
--country <code> Lọc theo mã quốc gia
--protocol <name> Lọc theo giao thức
--sort <field> Sắp xếp theo speed, latency, hoặc load

freeguard node test

Kiểm tra độ trễ và tốc độ của các nút.

freeguard node test us-new-01
freeguard node test --all

freeguard monitor

Hiển thị giám sát lưu lượng thời gian thực trong terminal của bạn.

freeguard monitor
↑ 0.8 MB/s  ↓ 12.3 MB/s  Connections: 47

freeguard core

Quản lý engine mihomo nền tảng.

# Check core status
freeguard core status

# Update to latest core version
freeguard core update

# Restart the core engine
freeguard core restart

freeguard shell

Vào chế độ REPL tương tác để chạy nhiều lệnh trong một phiên.

freeguard shell

freeguard dashboard

Mở bảng điều khiển TUI với biểu đồ lưu lượng theo thời gian thực, danh sách nút và chi tiết kết nối.

freeguard dashboard

Cập nhật lần cuối: March 2026