root@testdebian:/etc/mihomo$ pwd
/etc/mihomo
root@testdebian:/etc/mihomo$ tree
.
├── config.yaml
├── Country.mmdb
├── pxy
├── rule
└── ui
3 directories, 2 files
root@testdebian:/etc/mihomo$ cat ./config.yaml
mode: rule
mixed-port: 17890
allow-lan: true
bind-address: '192.168.89.22'
external-controller: '0.0.0.0:9090'
# 手工强制指定规则(最高优先级)
rules:
- DOMAIN,dingyueURL.net,DIRECT # 订阅的 url 地址,这里要允许通行,不然机场的 clash yaml 也获取不了
- DOMAIN-SUFFIX,xxxx.com,jp-pxy # 指定匹配的网址,必须走日本代理
- DOMAIN-SUFFIX,123cha.com,jp-pxy # 测试用,用来在浏览中验证 url ,有没有匹配上走 jp-pxy,还是 usa-pxy
proxy-providers:
subscribe-total: # 机场的订阅
type: http
url: "https://zzzzz/api/v1/client/subscribe?token=888&flag=clash"
interval: 3600
path: ./pxy/subscribe-total.yaml
health-check:
enable: true
interval: 3600 # xx 分钟检查一次
url: http://www.gstatic.com/generate_204
subscribe-jp:
type: http
url: "https://zzzzz/api/v1/client/subscribe?token=888&flag=clash"
interval: 3600
filter: ".*日本.*"
path: ./pxy/subscribe-jp.yaml
health-check:
enable: true
interval: 3600 # xx 分钟检查一次
url: http://www.gstatic.com/generate_204
subscribe-usa:
type: http
url: "https://zzzzz/api/v1/client/subscribe?token=888&flag=clash"
interval: 3600
filter: ".*美国.*"
path: ./pxy/subscribe-usa.yaml
health-check:
enable: true
interval: 3600 # xx 分钟检查一次
url: http://www.gstatic.com/generate_204
proxy-groups:
- name: PROXY
type: url-test
url: http://www.gstatic.com/generate_204
interval: 600
use:
- subscribe-total
- name: jp-pxy
type: url-test
url: http://www.gstatic.com/generate_204
interval: 600
use:
- subscribe-jp
- name: usa-pxy
type: url-test
url: http://www.gstatic.com/generate_204
interval: 600
use:
- subscribe-usa
rule-providers:
subscribe-rule:
behavior: "domain"
type: http
url: "https://zzzzz/api/v1/client/subscribe?token=888&flag=clash"
interval: 3600
path: ./rule/subscribe-rule.yaml
root@testdebian:/etc/mihomo$
root@testdebian:/etc/mihomo$ systemctl start mihomo
root@testdebian:/etc/mihomo$ systemctl status mihomo
● mihomo.service - mihomo Daemon, Another Clash Kernel.
Loaded: loaded (/etc/systemd/system/mihomo.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2024-01-21 12:00:48 EST; 2min 33s ago
Process: 2975 ExecStartPre=/usr/bin/sleep 1s (code=exited, status=0/SUCCESS)
Main PID: 2976 (mihomo)
Tasks: 7 (limit: 4661)
Memory: 21.4M
CPU: 437ms
CGroup: /system.slice/mihomo.service
└─2976 /usr/local/bin/mihomo -d /etc/mihomo
Jan 21 12:00:48 testdebian mihomo[2976]: time="2024-01-21T12:00:48.664558859-05:00" level=info msg="Start initial provider subscribe-usa"
Jan 21 12:00:49 testdebian mihomo[2976]: time="2024-01-21T12:00:49.133823925-05:00" level=info msg="[TCP] mihomo --> xxxxxxx:443 doesn't match any rule using DIRECT"
Jan 21 12:00:49 testdebian mihomo[2976]: time="2024-01-21T12:00:49.141480682-05:00" level=info msg="[TCP] mihomo --> xxxxxxx:443 doesn't match any rule using DIRECT"
Jan 21 12:00:50 testdebian mihomo[2976]: time="2024-01-21T12:00:50.106086885-05:00" level=info msg="Start initial provider subscribe-rule"
Jan 21 12:00:50 testdebian mihomo[2976]: time="2024-01-21T12:00:50.294992318-05:00" level=info msg="[TCP] mihomo --> xxxxxxx:443 doesn't match any rule using DIRECT"
Jan 21 12:00:50 testdebian mihomo[2976]: time="2024-01-21T12:00:50.296520638-05:00" level=info msg="[TCP] mihomo --> xxxxxxx:443 doesn't match any rule using DIRECT"
Jan 21 12:00:50 testdebian mihomo[2976]: time="2024-01-21T12:00:50.31857074-05:00" level=info msg="[TCP] mihomo --> xxxxxxx:443 doesn't match any rule using DIRECT"
Jan 21 12:00:50 testdebian mihomo[2976]: time="2024-01-21T12:00:50.324857425-05:00" level=info msg="[TCP] mihomo --> xxxxxxx:443 doesn't match any rule using DIRECT"
Jan 21 12:00:50 testdebian mihomo[2976]: time="2024-01-21T12:00:50.328474182-05:00" level=info msg="[TCP] mihomo --> xxxxxxx:443 doesn't match any rule using DIRECT"
Jan 21 12:00:51 testdebian mihomo[2976]: time="2024-01-21T12:00:51.508445806-05:00" level=info msg="Start initial Compatible provider default"
root@testdebian:/etc/mihomo$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/haishanh/yacd master 973643e897a3 3 months ago 14.2MB
root@testdebian:/etc/mihomo$
root@testdebian:/etc/mihomo$
root@testdebian:/etc/mihomo$ docker run -p 1234:80 -d --name yacd --rm ghcr.io/haishanh/yacd:master
7eaf705039521a1361c57e6128892a94e14038d2ace8dbc082a42bbe769a275e
root@testdebian:/etc/mihomo$ netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:1234 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 192.168.89.22:17890 0.0.0.0:* LISTEN
tcp 0 0 192.168.89.22:9090 0.0.0.0:* LISTEN
tcp 0 180 192.168.89.22:22 192.168.89.162:54360 ESTABLISHED
tcp6 0 0 :::1234 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
root@testdebian:/etc/mihomo$
以上是环境配置和启动情况,17890 的端口工作很正常,proxy 能按手写的 url 正确的走 jp 线路或者 usa 线路
搞完之后,我用浏览器打开 http://192.168.89.22:1234 ,能看到 yacd 的页面,但是点击左侧的“代理”、“规则”,页面半天没反应,换了其他电脑也是如此。。。
刚开始着手写 config.yaml 的时候,yacd 打开还是正常的(当时用了机场的默认 config.ymal),点击代理,规则,能看到统计和列表的,
现在不知道自己测试时做了什么,删了什么,yacd 目前不正常了,换回机场的默认 config.ymal ,点击代理,规则,没有任何内容。
是不是 config.yaml 写得有问题? 期间二进制 core 文件没变化过。
1
Remember 310 天前
|
2
frankcu 310 天前
|
3
vvhy 310 天前
external-controller 的 ip 似乎必须和 bind-address 一致;不确定,再查查
|
4
vvhy 310 天前
浏览器打开 yacd 会有缓存,开无痕窗口看 devtools
|
5
kehuai 310 天前
@frankcu 哎 docker pull ghcr.io/metacubex/metacubexd:latest
latest: Pulling from metacubex/metacubexd manifest unknown |
7
pppguest3962 OP |
8
dbak 308 天前
你缺少一个 profile 配置:
profile: tracing: true |