python3 -c "
import yaml

with open('/home/longshao/.config/mihomo/config.yaml', 'r') as f:
    config = yaml.safe_load(f)

# Remove info nodes (not real proxies)
info_keywords = ['剩余流量', '距离下次重置', '套餐到期', '官网地址', '联通移动', '保底用']
real_proxies = [p for p in config['proxies'] if not any(kw in p['name'] for kw in info_keywords)]

config['proxies'] = real_proxies
real_names = [p['name'] for p in real_proxies]

# Update proxy groups
for group in config['proxy-groups']:
    if group['name'] == 'Proxy':
        group['proxies'] = ['AUTO', 'DIRECT'] + real_names
    elif group['name'] == 'AUTO':
        group['proxies'] = real_names
    elif group['name'] == 'Streaming':
        group['proxies'] = real_names

with open('/home/longshao/.config/mihomo/config.yaml', 'w') as f:
    yaml.dump(config, f, allow_unicode=True, default_flow_style=False, sort_keys=False)

print(f'Cleaned: {len(real_proxies)} proxy nodes')
"

Clean info nodes from config


Cleaned: 58 proxy nodes


Now let me verify the config is valid by running mihomo in test mode.


Bash

~/.local/bin/mihomo -d ~/.config/mihomo -t 2>&1 | tail -5

Test mihomo config syntax


time="2026-05-02T06:18:22.912706907Z" level=info msg="Geodata Loader mode: memconservative"
time="2026-05-02T06:18:22.912723759Z" level=info msg="Geosite Matcher implementation: succinct"
time="2026-05-02T06:18:22.912823863Z" level=info msg="Can't find MMDB, start download"
time="2026-05-02T06:18:59.412961144Z" level=info msg="Initial configuration complete, total time: 36504ms"
configuration file /home/longshao/.config/mihomo/config.yaml test is successful


The config is valid. Now let me provide the user with clear instructions on how to use mihomo.


配置验证通过。以下是完整的使用说明：

---

## mihomo 安装配置完成

**58 个节点**已配置，包括：
- 香港、台湾、日本、韩国、新加坡
- 美国、英国、澳大利亚、法国、德国、荷兰等

### 启动 mihomo

```bash
# 前台运行（看日志）
mihomo -d ~/.config/mihomo

# 后台运行
nohup mihomo -d ~/.config/mihomo > ~/.config/mihomo/mihomo.log 2>&1 &
```

### 设置终端代理

```bash
# 临时设置（当前终端）
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7891

# 测试是否可用
curl -I https://www.google.com
```

### 端口说明

| 端口 | 协议 |
|------|------|
| 7890 | HTTP/HTTPS 混合代理 |
| 7891 | SOCKS5 代理 |
| 7892 | HTTP 代理 |
| 9090 | Web API 控制面板 |

### 代理组说明

- **Proxy** - 手动选择节点或自动选择
- **AUTO** - 自动测速选择最快节点（每 5 分钟测速）
- **Streaming** - 流媒体专用选择

### 停止 mihomo

```bash
pkill mihomo
```

### 订阅信息

- 剩余流量：170.72 GB
- 套餐到期：2026-05-17
- 距离重置：16 天

需要我帮你启动 mihomo 吗？


<command-name>/permissions</command-name>
            <command-message>permissions</command-message>
            <command-args></command-args>


<local-command-stdout>Permissions dialog dismissed</local-command-stdout>


启动,然后告诉我怎么测试哪些节点是连通的可以使用的,如何选择节点,如何开启代理


The user wants me to:
1. Start mihomo
2. Tell them how to test which nodes are working
3. How to select nodes
4. How to enable the proxy

Let me start mihomo first, then explain the usage.


pkill mihomo 2>/dev/null; nohup ~/.local/bin/mihomo -d ~/.config/mihomo > ~/.config/mihomo/mihomo.log 2>&1 & sleep 2 && cat ~/.config/mihomo/mihomo.log | tail -10

Start mihomo in background


time="2026-05-02T06:22:26.307776609Z" level=info msg="HTTP proxy listening at: 127.0.0.1:7892"
time="2026-05-02T06:22:26.307864163Z" level=info msg="SOCKS proxy listening at: 127.0.0.1:7891"
time="2026-05-02T06:22:26.307956848Z" level=info msg="Mixed(http+socks) proxy listening at: 127.0.0.1:7890"
time="2026-05-02T06:22:26.308076548Z" level=error msg="Start DNS server(UDP) error: listen udp 0.0.0.0:53: bind: permission denied"
time="2026-05-02T06:22:26.308113858Z" level=info msg="Start initial compatible provider default"
time="2026-05-02T06:22:26.308122886Z" level=error msg="Start DNS server(TCP) error: listen tcp 0.0.0.0:53: bind: permission denied"
time="2026-05-02T06:22:26.308136274Z" level=info msg="Start initial compatible provider Proxy"
time="2026-05-02T06:22:26.308146566Z" level=info msg="Start initial compatible provider AUTO"
time="2026-05-02T06:22:26.308172641Z" level=info msg="Start initial compatible provider Streaming"
time="2026-05-02T06:22:26.323706214Z" level=info msg="Load MMDB file: /home/longshao/.config/mihomo/geoip.metadb"


mihomo started successfully. DNS port 53 has permission issues (need root), but the proxy ports are working. Let me fix the DNS config to use a non-privileged port, then test the nodes and show the user how to use it.


mihomo 已启动。DNS 端口 53 需要 root 权限，让我修复一下。


1	mixed-port: 7890
2	socks-port: 7891
3	port: 7892
4	allow-lan: false
5	mode: rule
6	log-level: info
7	external-controller: 127.0.0.1:9090
8	dns:
9	  enable: true
10	  listen: 0.0.0.0:53
11	  enhanced-mode: fake-ip
12	  fake-ip-range: 198.18.0.1/16
13	  nameserver:
14	  - 223.5.5.5
15	  - 119.29.29.29
16	  fallback:
17	  - 8.8.8.8
18	  - 1.1.1.1
19	proxies:
20	- name: cf加速|香港动态家宽🇭🇰

mixed-port: 7890
socks-port: 7891
port: 7892
allow-lan: false
mode: rule
log-level: info
external-controller: 127.0.0.1:9090
dns:
  enable: true
  listen: 0.0.0.0:53
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  nameserver:
  - 223.5.5.5
  - 119.29.29.29
  fallback:
  - 8.8.8.8
  - 1.1.1.1
proxies:
- name: cf加速|香港动态家宽🇭🇰


Let me fix the DNS port and then test the proxy.


Edit

dns:
  enable: true
  listen: 0.0.0.0:53

dns:
  enable: true
  listen: 127.0.0.1:1053


The file /home/longshao/.config/mihomo/config.yaml has been updated successfully.

dns:
  enable: true
  listen: 0.0.0.0:53

dns:
  enable: true
  listen: 127.0.0.1:1053

external-controller: 127.0.0.1:9090
dns:
enable: true
-  listen: 0.0.0.0:53
+  listen: 127.0.0.1:1053
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:


Now let me restart mihomo and test the proxy.


Bash

pkill mihomo 2>/dev/null; sleep 1; nohup ~/.local/bin/mihomo -d ~/.config/mihomo > ~/.config/mihomo/mihomo.log 2>&1 & sleep 2 && tail -5 ~/.config/mihomo/mihomo.log

Restart mihomo with fixed DNS


time="2026-05-02T06:22:47.349818985Z" level=info msg="Start initial compatible provider Streaming"
time="2026-05-02T06:22:47.349836772Z" level=info msg="Start initial compatible provider Proxy"
time="2026-05-02T06:22:47.349854190Z" level=info msg="Start initial compatible provider default"
time="2026-05-02T06:22:47.349969579Z" level=info msg="Start initial compatible provider AUTO"
time="2026-05-02T06:22:47.364978418Z" level=info msg="Load MMDB file: /home/longshao/.config/mihomo/geoip.metadb"


Good, no errors now. Let me test the proxy and then show the user how to use it.


现在测试代理是否正常工作。


curl -s --proxy http://127.0.0.1:7890 -o /dev/null -w "%{http_code}" https://www.google.com --connect-timeout 10

Test proxy connection to Google


The proxy is working. Now let me show the user how to test nodes and use the proxy.


代理已正常工作。以下是使用方法：

---

## 1. 测试哪些节点可用

**方法一：使用 API 测速**

```bash
# 测速所有节点（AUTO 组）
curl -s http://127.0.0.1:9090/proxies/AUTO/delay?timeout=5000&url=https://www.gstatic.com/generate_204
```

**方法二：手动测试单个节点**

```bash
# 切换到指定节点后测试
curl -s --proxy http://127.0.0.1:7890 https://www.google.com -o /dev/null -w "状态: %{http_code}, 耗时: %{time_total}s\n"
```

**方法三：查看所有节点列表**

```bash
curl -s http://127.0.0.1:9090/proxies | python3 -m json.tool | head -50
```

## 2. 选择节点

**通过 API 切换节点：**

```bash
# 切换 Proxy 组到指定节点
curl -s -X PUT http://127.0.0.1:9090/proxies/Proxy \
  -H "Content-Type: application/json" \
  -d '{"name": "cf加速|香港动态家宽🇭🇰"}'

# 切换为自动选择
curl -s -X PUT http://127.0.0.1:9090/proxies/Proxy \
  -H "Content-Type: application/json" \
  -d '{"name": "AUTO"}'
```

## 3. 开启代理（当前终端生效）

```bash
# 设置代理环境变量
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7891

# 验证
curl https://www.google.com -I

# 取消代理
unset http_proxy https_proxy all_proxy
```

## 4. 永久设置代理（可选）

```bash
# 写入 bashrc，每次打开终端自动生效
cat >> ~/.bashrc << 'EOF'
# Proxy
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=socks5://127.0.0.1:7891
export no_proxy=localhost,127.0.0.1,::1
EOF
```

## 5. 停止 mihomo

```bash
pkill mihomo
```

---

需要我帮你测速所有节点，找出可用的吗？


帮我弄成UI把,我可以在其他地方访问UI控制,测试,开启节点


The user wants a web UI to manage mihomo. I should install a Clash web UI like Yacd or Metacubexd. Let me set up the external controller to listen on all interfaces so it can be accessed remotely, and install a web UI.


好的，我来配置 Web UI，让你可以通过浏览器远程管理。


1	mixed-port: 7890
2	socks-port: 7891
3	port: 7892
4	allow-lan: false
5	mode: rule
6	log-level: info
7	external-controller: 127.0.0.1:9090
8	dns:

mixed-port: 7890
socks-port: 7891
port: 7892
allow-lan: false
mode: rule
log-level: info
external-controller: 127.0.0.1:9090
dns:


I need to:
1. Change external-controller to listen on all interfaces (0.0.0.0:9090) so it can be accessed remotely
2. Set allow-lan to true
3. Download a web UI (metacubexd is the modern one for mihomo)
4. Set up the external-ui to serve the dashboard


Edit

allow-lan: false
mode: rule
log-level: info
external-controller: 127.0.0.1:9090

allow-lan: true
mode: rule
log-level: info
external-controller: 0.0.0.0:9090
external-ui: ui
external-ui-url: "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip"


allow-lan: false
mode: rule
log-level: info
external-controller: 127.0.0.1:9090

allow-lan: true
mode: rule
log-level: info
external-controller: 0.0.0.0:9090
external-ui: ui
external-ui-url: "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip"


Now I need to download the web UI and set it up. Let me download metacubexd.


Bash

mkdir -p ~/.config/mihomo/ui && cd ~/.config/mihomo/ui && curl -sL "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip" -o metacubexd.zip && unzip -o metacubexd.zip -d . > /dev/null 2>&1 && mv metacubexd-gh-pages/* . && rm -rf metacubexd-gh-pages metacubexd.zip && ls -la

Download metacubexd web UI


Exit code 127


unzip might not be installed. Let me try a different approach.


which unzip || sudo apt-get install -y unzip 2>/dev/null || echo "no sudo"

Check for unzip


no sudo


unzip is not available and no sudo. Let me use Python to extract the zip file.


cd ~/.config/mihomo && curl -sL "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip" -o metacubexd.zip && python3 -c "
import zipfile
import os

with zipfile.ZipFile('metacubexd.zip', 'r') as z:
    z.extractall('.')

# Move files from subfolder to ui folder
os.makedirs('ui', exist_ok=True)
src = 'metacubexd-gh-pages'
for f in os.listdir(src):
    os.rename(os.path.join(src, f), os.path.join('ui', f))
os.rmdir(src)
os.remove('metacubexd.zip')
print('UI installed successfully')
" && ls ~/.config/mihomo/ui/

Download and extract web UI with Python


UI installed successfully
200.html
404.html
apple-touch-icon-180x180.png
CNAME
config.js
favicon.ico
favicon.svg
_fonts
index.html
maskable-icon-512x512.png
metacubexd.zip
_nuxt
pwa-192x192.png
pwa-512x512.png
pwa-64x64.png


The UI is installed. Now I need to restart mihomo to apply the changes. Let me also get the machine's IP address so the user knows how to access the UI.


UI 安装完成。重启 mihomo 并获取访问地址。


pkill mihomo 2>/dev/null; sleep 1; nohup ~/.local/bin/mihomo -d ~/.config/mihomo > ~/.config/mihomo/mihomo.log 2>&1 & sleep 2 && tail -5 ~/.config/mihomo/mihomo.log

Restart mihomo with UI


time="2026-05-02T06:24:47.874573293Z" level=info msg="Start initial compatible provider Streaming"
time="2026-05-02T06:24:47.874600764Z" level=info msg="DNS server(TCP) listening at: 127.0.0.1:1053"
time="2026-05-02T06:24:47.874756007Z" level=info msg="Start initial compatible provider AUTO"
time="2026-05-02T06:24:47.877356211Z" level=info msg="UI already exists, skip downloading"
time="2026-05-02T06:24:47.894045055Z" level=info msg="Load MMDB file: /home/longshao/.config/mihomo/geoip.metadb"


Good, mihomo restarted and the UI is loaded. Let me get the IP address of the machine.


Get machine IP address


The machine's IP is 192.168.1.137. Now let me test if the UI is accessible.


Test UI accessibility


The UI is accessible. Let me provide the user with the access information.


Web UI 已配置完成。

---

## 访问控制面板

**本机访问：**
```
http://127.0.0.1:9090/ui/
```

**局域网其他设备访问：**
```
http://192.168.1.137:9090/ui/
```

---

## 首次打开设置

1. 打开浏览器访问上面的地址
2. 首次进入会要求填写 API 地址，填入：
   ```
   http://192.168.1.137:9090
   ```
3. 点击保存即可进入面板

---

## 面板功能

| 功能 | 说明 |
|------|------|
| **Proxies** | 查看/切换所有节点，测试节点延迟 |
| **Connections** | 查看当前活动连接 |
| **Rules** | 查看分流规则 |
| **Logs** | 查看运行日志 |
| **Config** | 切换代理模式（规则/全局/直连） |

---

## 测试节点延迟

在面板的 **Proxies** 页面：
1. 选择 **Proxy** 或 **AUTO** 组
2. 点击组名旁边的 **测速按钮**（闪电图标）
3. 等待测速完成，会显示每个节点的延迟
4. 延迟越低越好，超时的节点不可用

---

现在可以在浏览器打开 `http://192.168.1.137:9090/ui/` 试试。


如何查看是否开启了代理,我选了规则的台湾,你看下开启没用


The user wants to check if the proxy is working and if they selected a Taiwan node. Let me check the current proxy status and test the connection.


curl -s http://127.0.0.1:9090/proxies/Proxy | python3 -m json.tool

Check current proxy selection


Proxy

AUTO DIRECT cf加速|香港动态家宽🇭🇰 cf加速|香港动态家宽二🇭🇰 cf加速|美国一 cf加速|台湾🇹🇼 cf加速|美国二 cf加速|美国圣何塞 cf加速|中转新加坡🇸🇬 cf加速|英国 cf加速|澳大利亚 cf加速|日本樱花 cf加速|日本NTT cf加速|台湾动态家宽🇹🇼 cf加速|日本动态家宽🇯🇵 cf加速|韩国动态家宽🇰🇷 cf加速|美国备用家宽一🇺🇸 cf加速|美国备用动态家宽三🇺🇸 【5x】中转|美国一🇺🇸 【5x】中转|美国二🇺🇸 【5x】中转|新加坡🇸🇬 【5x】中转|台湾🇹🇼 【5x】中转|日本樱花🇯🇵 【5x】中转|香港BGP🇭🇰 【5x】中转|香港动态家宽🇭🇰 【5x】中转|台湾hinet动态家宽🇹🇼 【5x】中转|英国 【5x】中转|美国备用家宽🇺🇸 【5x】中转|美国AT&T备用家宽 【5x】中转|台湾seednet动态家宽🇹🇼 【5x】中转|英国家宽 【5x】中转|美国备用家宽三🇺🇸 【1】新香港直连🇭🇰 【1】香港高速节点🇭🇰 【2】香港高速节点🇭🇰 【3】香港高速节点🇭🇰 美国加州🇺🇸vless 【备用】美国洛杉矶备用家宽vless🇺🇸 【备用-2】美国AT&T备用家宽vless🇺🇸 台湾hinet动态家宽🇨🇳vless 台湾hinet动态家宽🇹🇼vless 新英国家宽🇬🇧vless 专线|尼日利亚家宽🇳🇬 【十四】美国Windstream家宽vless 比利时家宽 【一】法国家宽 【二】法国家宽 【三】法国家宽 【四】法国家宽 【五】法国家宽 荷兰家宽 西班牙家宽 意大利家宽 美国旧金山高速机房IP节点🇺🇸 美国洛杉矶vless🇺🇸 日本樱花🇯🇵vless 英国机房IP高速节点🇬🇧 德国机房IP高速节点🇩🇪 新加坡🇸🇬 香港爱琴海🇭🇰

【5x】中转|台湾seednet动态家宽🇹🇼

【5x】中转|台湾seednet动态家宽🇹🇼


The current selected node is "【5x】中转|台湾seednet动态家宽🇹🇼". Let me test if the proxy is working with this node by checking the external IP.


当前已选择 **【5x】中转|台湾seednet动态家宽🇹🇼**。让我测试下是否生效。


Bash

curl -s --proxy http://127.0.0.1:7890 https://api.ipify.org?format=json && echo "" && curl -s --proxy http://127.0.0.1:7890 https://ipinfo.io/json 2>/dev/null | python3 -m json.tool

Check external IP through proxy


{"ip":"123.204.19.96"}
{
    "ip": "123.204.19.96",
    "hostname": "123-204-19-96.dynamic.seed.net.tw",
    "city": "Taichung",
    "region": "Taiwan",
    "country": "TW",
    "loc": "24.1469,120.6839",
    "org": "AS4780 Digital United Inc.",
    "timezone": "Asia/Taipei",
    "readme": "https://ipinfo.io/missingauth"
}


The proxy is working. The external IP is from Taiwan (seednet), which matches the selected node. Let me provide the user with this information.


代理已生效，当前状态：

**已选节点**: 【5x】中转|台湾seednet动态家宽🇹🇼

**出口 IP**: `123.204.19.96`
**位置**: 台湾 台中
**运营商**: Digital United Inc. (seednet)

---

## 如何查看代理是否开启

**方法 1：命令行检查**
```bash
# 查看出口 IP（通过代理）
curl -s --proxy http://127.0.0.1:7890 https://api.ipify.org

# 查看出口 IP（不通过代理，对比）
curl -s https://api.ipify.org
```

**方法 2：浏览器检查**

确保终端设置了代理环境变量后：
```bash
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
```

然后在浏览器打开 `https://ipinfo.io` 查看 IP 归属地。

**方法 3：Web UI 面板**

在 `http://192.168.1.137:9090/ui/` 的 **Connections** 页面可以看到当前所有通过代理的连接。

---

代理正常工作，台湾节点可用。