mihomo-rs
English | 简体中文
Rust SDK and CLI for mihomo: version install/switch, config profiles, service lifecycle, proxy operations, and real-time connection/traffic monitoring.
What It Does
- Manage mihomo versions from GitHub releases (
stable,beta,nightlyor explicit tag likev1.19.17). - Manage local config profiles under
~/.config/mihomo-rs(or$MIHOMO_HOME). - Start/stop/restart mihomo with PID tracking.
- Query/switch proxies and run delay tests.
- Query/filter/close active connections.
- Stream logs, traffic, and connection snapshots via WebSocket APIs.
Install
Library usage:
[]
= "*"
Quick Start (CLI)
# 1) Install and select a kernel version
# 2) Start service (auto-creates default config when missing)
# 3) Proxy operations
# 4) Observability
Run mihomo-rs --help for full command list.
Quick Start (SDK)
use ;
async
Progressive Examples
Examples are organized as an incremental path:
01_bootstrap.rs- isolated home + manager bootstrap02_config_profiles.rs- save/list/switch config profiles03_version_inventory.rs- local version inventory/default lookup04_service_lifecycle_dry_run.rs- service manager dry-run checks05_proxy_queries.rs- proxy/group queries (online)06_connection_queries.rs- connection queries/filters (online)07_streaming.rs- logs/traffic streaming (online)08_complete_workflow.rs- full orchestration template
See examples/README.md for details.
CLI Command Map
- Version:
install,update,default,list,list-remote,uninstall - Config:
config list|use|show|delete - Service:
start,stop,restart,status - Proxy:
proxy list|groups|switch|test|current - Telemetry:
logs,traffic,memory - Connections:
connection list|stats|stream|close|close-all|filter-host|filter-process|close-by-host|close-by-process
Data Directory
By default, data is stored under ~/.config/mihomo-rs/.
~/.config/mihomo-rs/
├── versions/ # Installed kernels
├── configs/ # Profile yaml files
├── config.toml # Default version/profile
└── mihomo.pid # PID record
Override with:
Development
Security
See SECURITY.md.
Contributing
See CONTRIBUTING.md.
License
MIT. See LICENSE.