npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mihomo-check

v1.0.1

Published

Command line tool for managing Mihomo proxy nodes

Downloads

17

Readme

Mihomo 节点管理工具需求文档

项目概述

基于 Node.js 开发的命令行工具,用于管理 Mihomo(Clash Meta)代理节点,提供节点分组获取、连接性检测和节点切换功能。

技术栈

  • 运行环境: Node.js
  • 开发语言: JavaScript/TypeScript
  • API 接口: Mihomo RESTful API (http://127.0.0.1:9090)
  • 命令行框架: Commander.js 或 Yargs
  • HTTP 客户端: Axios 或 Node.js 内置 fetch

功能需求

1. 获取节点分组

功能描述: 从 Mihomo API 获取所有可用的代理节点及其分组信息

API 接口:

GET http://127.0.0.1:9090/proxies

功能要求:

  • 解析 proxies["🔰 节点选择"].all[] 获取所有节点列表
  • 按地区/类型对节点进行分组显示(如:香港、新加坡、日本)
  • 支持输出格式化的节点列表

命令示例:

mihomo-check list
mihomo-check list --group 香港
mihomo-check list --format json

2. 连接性检测能力

功能描述: 批量检测节点的连接延迟和可用性

API 接口:

GET http://127.0.0.1:9090/proxies/{节点名}/delay?timeout=5000&url=http://www.gstatic.com/generate_204

功能要求:

  • 支持单个节点延迟检测
  • 支持批量节点延迟检测
  • 支持按分组进行检测
  • 可配置超时时间(默认 5000ms)
  • 可配置测试 URL(默认 Google 204)
  • 输出延迟结果,标识不可用节点

命令示例:

mihomo-check test
mihomo-check test --node "香港g1a-付费节点"
mihomo-check test --group 香港
mihomo-check test --timeout 3000
mihomo-check test --url "http://www.google.com/generate_204"

3. 支持切换节点

功能描述: 将指定节点设置为当前使用的代理节点

API 接口:

PUT http://127.0.0.1:9090/proxies/🔰%20节点选择
Content-Type: application/json
{"name": "节点名称"}

功能要求:

  • 支持按节点名称切换
  • 支持智能切换(选择延迟最低的节点)
  • 支持按地区切换(选择指定地区延迟最低的节点)
  • 切换后验证是否成功

命令示例:

mihomo-check switch "香港g2a-付费节点"
mihomo-check switch --auto
mihomo-check switch --region 香港
mihomo-check switch --best-ping

非功能需求

性能要求

  • 并发检测多个节点时,支持异步处理
  • 命令响应时间不超过 30 秒
  • 支持进度条显示长时间操作

可用性要求

  • 提供清晰的错误信息和使用帮助
  • 支持彩色输出增强可读性
  • 支持静默模式和详细模式

扩展性要求

  • 支持配置文件自定义 API 地址和端口
  • 支持插件机制扩展功能
  • 支持多种输出格式(JSON、表格、简洁模式)

项目结构建议

mihomo-check/
├── bin/
│   └── mihomo-check.js          # 命令行入口
├── src/
│   ├── commands/                # 命令处理器
│   │   ├── list.js
│   │   ├── test.js
│   │   └── switch.js
│   ├── api/
│   │   └── mihomo.js           # API 客户端
│   ├── utils/
│   │   ├── formatter.js        # 输出格式化
│   │   └── config.js           # 配置管理
│   └── index.js                # 主程序
├── config/
│   └── default.json            # 默认配置
├── package.json
└── README.md

配置选项

{
  "api": {
    "host": "127.0.0.1",
    "port": 9090,
    "timeout": 5000
  },
  "test": {
    "url": "http://www.gstatic.com/generate_204",
    "concurrent": 10
  },
  "output": {
    "format": "table",
    "color": true
  }
}