ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

silas_clash

Clash/Mihomo 代理管理。安装配置、查看状态、切换模式/节点、测速、外网失败时自动代理。

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/aohoyo/silas-clash
Or

Silas-Clash 代理管理

通过 Clash RESTful API 管理本地代理(Mihomo/Clash Meta)。

首次安装配置

1. 安装 Mihomo(Clash Meta 内核)

# 检查架构
uname -m

# 下载对应版本(以 amd64 为例)
curl -Lo /tmp/mihomo.gz https://github.com/MetaCubeX/mihomo/releases/download/v1.19.21/mihomo-linux-amd64-v1.19.21.gz
gunzip /tmp/mihomo.gz
chmod +x /tmp/mihomo
sudo mv /tmp/mihomo /usr/local/bin/mihomo

2. 获取配置

询问用户订阅地址,然后下载配置:

# 方式一:订阅链接直接下载
curl -Lo ~/.config/mihomo/config.yaml "用户提供的订阅地址"

# 方式二:Clash 仪表盘配置(推荐)
# 访问 https://yacd.haishan.me 或 https://metacubexd.github.io/metacubexd
# 在仪表盘中粘贴订阅地址,自动生成 config.yaml

3. 确保配置开启 API

检查 ~/.config/mihomo/config.yaml 中有:

external-controller: 127.0.0.1:9090
# secret: "你的密码"  # 可选,建议空

4. 启动

mihomo -d ~/.config/mihomo

5. 验证

curl -s http://127.0.0.1:9090/version
# 应返回 {"meta":true,"version":"v1.x.x"}

6. 写入本地配置

将连接信息保存到 memory/clash-config.json

{
  "api_url": "http://127.0.0.1:9090",
  "api_secret": "",
  "proxy_http": "http://127.0.0.1:7890",
  "proxy_socks5": "socks5://127.0.0.1:7891",
  "proxy_all": "socks5://127.0.0.1:7891",
  "install_path": "/usr/local/bin/mihomo",
  "config_path": "~/.config/mihomo/config.yaml"
}

⚠️ 代理端口(7890/7891)以实际 config.yaml 中的 mixed-port / port 为准。

常用操作

查看状态

curl -s http://127.0.0.1:9090/version
curl -s http://127.0.0.1:9090/configs | python3 -c "import json,sys;d=json.load(sys.stdin);print(f\"模式: {d.get('mode')}\")"

查看当前节点

curl -s http://127.0.0.1:9090/proxies/%F0%9F%9A%80%20%E8%8A%82%E7%82%B9%E9%80%89%E6%8B%A9 | python3 -c "
import json,sys
d=json.load(sys.stdin)
print(f\"当前节点: {d.get('now','?')}\")
"

切换模式

# rule(规则分流,推荐日常)
curl -X PATCH http://127.0.0.1:9090/configs -H "Content-Type: application/json" -d '{"mode":"rule"}'

# global(全局代理)
curl -X PATCH http://127.0.0.1:9090/configs -H "Content-Type: application/json" -d '{"mode":"global"}'

# direct(直连)
curl -X PATCH http://127.0.0.1:9090/configs -H "Content-Type: application/json" -d '{"mode":"direct"}'

切换节点

# 先列出节点名
curl -s http://127.0.0.1:9090/proxies/%F0%9F%9A%80%20%E8%8A%82%E7%82%B9%E9%80%89%E6%8B%A9 | python3 -c "
import json,sys
d=json.load(sys.stdin)
for n in d.get('all',[]): print(n)
"

# 切换到指定节点
curl -X PUT "http://127.0.0.1:9090/proxies/%F0%9F%9A%80%20%E8%8A%82%E7%82%B9%E9%80%89%E6%8B%A9" \
  -H "Content-Type: application/json" \
  -d '{"name":"节点名称"}'

测速

# 测所有节点
curl -X GET "http://127.0.0.1:9090/group/%F0%9F%9A%80%20%E8%8A%82%E7%82%B9%E9%80%89%E6%8B%A9/delay?timeout=5000&url=https://www.google.com/generate_204"

# 测当前节点
curl -X GET "http://127.0.0.1:9090/proxies/%F0%9F%9A%80%20%E8%8A%82%E7%82%B9%E9%80%89%E6%8B%A9/delay?timeout=5000&url=https://www.google.com/generate_204"

外网访问代理策略

当 web_search / web_fetch / Serper / Tavily 等外网工具失败时:

Metadata

Author@aohoyo
Stars4473
Views0
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-aohoyo-silas-clash": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.