mihari

module
v0.9.2-dev.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: GPL-3.0

README

Disclaimer: This project is for learning and exchanging ideas about Go TUI tools. It is a non-profit open-source project and does not accept sponsorships or donations, now or in the future.

This application is currently in informal development; bugs are common.

Mihari — Mihomo / Clash CLI & TUI Manager

English · 简体中文

license ci go version release

Website · Releases

Mihari is a cross-platform mihomo (Clash Meta) manager for Windows, Linux, and macOS. It provides a CLI, terminal UI (TUI), subscription management, system proxy, TUN mode, mihomo core management, and web panels.

An open-source terminal alternative to graphical Mihomo / Clash clients such as Clash Party and Sparkle. CLI, TUI, and browser panels share one daemon-owned control plane.

Overview

What is this?

TLDR: Mihari is a terminal manager for mihomo — the same family of tools as mihomo GUIs like Clash Party and Sparkle, but it runs in the terminal and is hosted by a daemon in the background, so the CLI, TUI, and browser panels share one control plane.

Specifically:

  • Subscription management: add, refresh, and switch subscription profiles, with offline switching, independent refresh intervals, and per-profile fetch proxy
  • Core management: install, update, and restart the mihomo core
  • Service supervision: run in the background as an OS service, with crash auto-restart
  • System proxy / TUN: enable system proxy or TUN; a foreign proxy or another TUN/mihomo instance requires confirmation or --force
  • Web panels: one-click install and open of the zashboard / MetaCubeXD panels
  • Connections & rules: live view of connections, proxy groups, and rules, with local GeoIP resolution

Features

  • One daemon, three surfaces: CLI, TUI, and browser panels talk to the same daemon-owned control plane over a local named pipe / Unix domain socket. The control API never binds a TCP port.
  • OS service supervision: install as a Windows service / systemd unit / launchd agent, with crash backoff restart.
  • Subscription profiles: per-subscription independent caches, offline switching, per-profile refresh intervals, per-profile fetch proxy (direct / proxy / auto; auto falls back to direct), and validated atomic config generation with rollback.
  • Web panels: one-click install / update / activate / rollback for zashboard and MetaCubeXD, served behind a loopback Web gateway with its own access credential.
  • System proxy & TUN: cross-platform system proxy control and managed TUN, both daemon-owned and persisted. Enable refuses a foreign system proxy (system_proxy_conflict) or another TUN / mihomo instance (tun_conflict) unless --force (TUI asks for confirmation).
  • Ports Config: the System page can change Mixed / Controller / Web ports; occupancy shows Owned or Occupied by name (pid). Applying a change typically requires a daemon restart.
  • In-TUI Mihari updates: the System page checks GitHub Releases on entry, shows current · latest available or current · Up to date, and—when Mihari was started with administrator/root privileges—replaces the binary, synchronizes and restarts an installed OS-service copy, verifies its daemon version, and automatically enters the updated TUI.
  • Core channel: the System page can switch the mihomo core between stable and alpha.

A single CGO-free static binary (< 15 MB) contains everything, with built-in GitHub Releases self-update and local GeoIP resolution.

Quick start

Install

main release channel (GitHub)

# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/mihari-proxy/mihari/main/scripts/install/install.sh | bash
# Windows (PowerShell)
irm https://raw.githubusercontent.com/mihari-proxy/mihari/main/scripts/install/install.ps1 | iex

dev release channel (GitHub)

# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/mihari-proxy/mihari/dev/scripts/install/install.sh | bash -s -- --channel dev
# Windows (PowerShell)
$env:MIHARI_CHANNEL = 'dev'
irm https://raw.githubusercontent.com/mihari-proxy/mihari/dev/scripts/install/install.ps1 | iex

Or download the binary for your platform from the Releases page.

China / no GitHub access (offline)

An all-in-one bundle (mihari binary + mihomo core + GeoIP, sha256-verified) is mirrored on a self-hosted AList drive, so installs never touch GitHub. The downloader is always taken from the stable AList root.

main release channel (AList / offline)

# Linux / macOS
curl -fsSL https://cloud.xn--30q18ry71c.com/p/public/mihari-release/mihari/install-aio-remote.sh | bash
# Windows (PowerShell)
& ([scriptblock]::Create((irm https://cloud.xn--30q18ry71c.com/p/public/mihari-release/mihari/install-aio-remote.ps1)))

dev release channel (AList / offline)

# Linux / macOS
curl -fsSL https://cloud.xn--30q18ry71c.com/p/public/mihari-release/mihari/install-aio-remote.sh | bash -s -- --channel dev
# Windows (PowerShell)
& ([scriptblock]::Create((irm https://cloud.xn--30q18ry71c.com/p/public/mihari-release/mihari/install-aio-remote.ps1))) -Channel dev

See docs/distribution.md for the offline distribution design.

First run

mihari

The interactive setup installs the mihomo core, guides you through adding your first subscription, and prepares local GeoIP data. It pre-checks the managed ports up front (with one-key auto-fix on conflict), reuses any local core/GeoIP already present, and the final review summarizes ports, core, subscription, GeoIP and service registration.

Add a subscription and enable the system proxy

mihari sub add my-sub https://example.com/subscribe
mihari sub list
mihari sub use <ID>
mihari sysproxy enable

Common commands

Scenario Command
View status mihari status
Core management mihari core status · mihari core restart
Proxy groups mihari proxy groups · mihari proxy select <GROUP> <PROXY>
Subscription management mihari sub add <NAME> <URL> · mihari sub set <ID> --proxy auto · mihari sub use <ID>
System proxy / TUN mihari sysproxy enable · mihari sysproxy enable --force · mihari tun enable · mihari tun enable --force
Web panels mihari panel list · mihari panel open
Service control mihari service status · mihari service stop
Update mihari System page Update Mihari · mihari self update

See docs/commands.md for the full command reference, and docs/architecture.md for the architecture and security model.

Platform targets

  • Windows amd64 and arm64
  • Linux amd64 and arm64
  • macOS amd64 and arm64

All release binaries are CGO-free.

Data paths

Platform Data root (MIHARI_DATA overrides) Default control endpoint
Windows %USERPROFILE%\.mihari \\.\pipe\mihari-control (named pipe; no file)
Linux $HOME/.mihari $XDG_RUNTIME_DIR/mihari/control.sock, else $DATA/control.sock
macOS $HOME/.mihari $DATA/control.sock

Settings, control token, runtime config, core binary, subscriptions, GeoIP, panel assets, logs, and staging all live under the data root.

File logs

Mihari writes newline-delimited JSON (JSONL) to three files under the data root:

Source Path
Mihari daemon logs/mihari-daemon.log
TUI (shared by all TUI instances) logs/mihari-tui.log
Captured mihomo output logs/mihomo.log

Daemon and captured-mihomo file logs use the default info level, rotate each active file at 10 MiB, and retain three files (the active file plus up to two archives). The TUI starts with its bootstrap configuration—debug, 100 MiB, and 10 files—so it can log before daemon settings are available; it remains on this bootstrap configuration until a later control-plane synchronization. Captured mihomo stdout is recorded as INFO and stderr as WARN; these capture levels do not infer the severity encoded in mihomo's own message text.

Redaction is best effort only. Treat all log files as sensitive material and share them only after reviewing their contents. This release does not yet provide a logging configuration UI or log export.

Development

go test ./...
go test -race ./...
go vet ./...

Build a local binary:

CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o bin/mihari ./cmd/mihari

The architecture invariants, package boundaries, and contribution guidance are recorded in AGENTS.md and CONTRIBUTING.md. See docs/RELEASE.md for the release process.

Community

Mihari is fully open source. This project recognizes LINUX DO and thanks the community for supporting open-source software.

License

GPL-3.0 © 2026 Mihar1

Mihari is an independent project and is not affiliated with or endorsed by the mihomo project or MetaCubeX.

Directories

Path Synopsis
cmd
mihari command
internal
app
cli
elevate
Package elevate reports process privilege.
Package elevate reports process privilege.
panel/archive
Package archive provides safe extraction helpers for panel distribution zips.
Package archive provides safe extraction helpers for panel distribution zips.
panel/metacubexd
Package metacubexd implements the MetaCubeXD panel adapter.
Package metacubexd implements the MetaCubeXD panel adapter.
panel/release
Package release provides small GitHub API helpers for panel distribution discovery.
Package release provides small GitHub API helpers for panel distribution discovery.
panel/zashboard
Package zashboard implements the Zashboard panel adapter.
Package zashboard implements the Zashboard panel adapter.
service
Package service installs and controls Mihari as a native OS service.
Package service installs and controls Mihari as a native OS service.
sysproxy
Package sysproxy provides OS system HTTP(S) proxy control and ownership helpers.
Package sysproxy provides OS system HTTP(S) proxy control and ownership helpers.
tui
tundetect
Package tundetect observes the system for other TUN-capable actors that could conflict with this daemon's managed mihomo TUN: other TUN network adapters (signal A) and other mihomo processes (signal B).
Package tundetect observes the system for other TUN-capable actors that could conflict with this daemon's managed mihomo TUN: other TUN network adapters (signal A) and other mihomo processes (signal B).
update
Package update downloads and replaces the Mihari binary (self-update).
Package update downloads and replaces the Mihari binary (self-update).
web
scripts
tools/build-all-in-one command
Command build-all-in-one packs mihari + mihomo core + GeoIP×2 + the local install-aio installer into per-platform all-in-one bundles for offline distribution.
Command build-all-in-one packs mihari + mihomo core + GeoIP×2 + the local install-aio installer into per-platform all-in-one bundles for offline distribution.
tools/coverage-gate command
Command coverage-gate reports and compares Go coverprofiles for Mihari CI.
Command coverage-gate reports and compares Go coverprofiles for Mihari CI.
tools/internal/releaseinputs
Package releaseinputs defines the reviewed, immutable inputs used to build Mihari all-in-one release bundles.
Package releaseinputs defines the reviewed, immutable inputs used to build Mihari all-in-one release bundles.
tools/resolve-release-inputs command
Command resolve-release-inputs resolves and verifies immutable upstream inputs for Mihari all-in-one release bundles.
Command resolve-release-inputs resolves and verifies immutable upstream inputs for Mihari all-in-one release bundles.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL