vernesong / OpenClash

A Clash Client For OpenWrt
MIT License
16.62k stars 3.07k forks source link

启用第三方规则集后Clash启动失败 #693

Closed ghost closed 4 years ago

ghost commented 4 years ago

之前没用过第三方规则,后来在“规则集与策略组管理---第三方规则集与策略组管理”页面,尝试添加了一个Disneyplus规则集合后,发现clash启动失败,运行记录如下:

time="2020-08-28T05:59:15Z" level=fatal msg="Parse config error: yaml: line 131: did not find expected key"
2020-08-28 13:59:10 OpenClash Can Not Start, Please Check The Error Info And Try Again

发现最终的配置文件添加了下面这段,第131行就是那个rule-providers下面的" DisneyPlus"那行,没用过rules provider,但感觉这个生成的就不太对,好像不符合clash配置语法吧。

从路由器下载Advertising.yaml 文件看内容应该是完整的,删除第三方规则后是正常运行的。

#===================== Clash-Rule-Settings =====================#
rule-providers:
#===================== OpenClash-Rule-Providers-Set =====================#
  DisneyPlus
:
    type: http
    behavior: classical
ipcidr
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
ipcidr
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
classical
    path: /etc/openclash/rule_provider/
    url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/Guard/Hijacking.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/ChinaIP.yaml
DivineEngine/Profiles/master/Clash/RuleSet/China.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/StreamingCN.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/StreamingSE.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Global.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Streaming.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Scholar.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Guard/Advertising.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Guard/Privacy.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/AbemaTV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/All-4.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/AppStore.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/AppStoreConnect.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/FindMy.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/Music.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/News.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/SoftwareUpdate.list
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/TV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/TestFlight.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/iCloud.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/Apple.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/BBC-iPlayer.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/Bahamut.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/DAZN.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/Deezer.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/DisneyPlus.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/FOX.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/IP-Blackhole.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Google/GoogleDrive.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Google/GoogleSearch.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/HBO.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/HBO-GO-HKG.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/HWTV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Podcast/Himalaya.list
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/Hulu.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/Hulu-JPN.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/ITV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/Instagram.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/JOOX.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/KKBOX.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/KKTV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/LINE-TV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/LiTV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/My5.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/Netflix.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/Now-E.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Microsoft/OneDrive.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/PBS.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/Pandora.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/PayPal.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/Pornhub.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/Prime-Video.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/Siri.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/SoundCloud.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/Spotify.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/TIDAL.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/TaiwanGood.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/Telegram.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/TelegramNL.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/TelegramSG.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/TelegramUS.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/TikTok.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Live/Twitch.list
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/ViuTV.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/YouTube.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/encoreTVB.yaml
DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/Mail.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/myTV-SUPER.yaml
DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/niconico.yaml
    interval: 86400
#===================== OpenClash-Rule-Providers-Set-End =====================#
OpenClash 调试日志

生成时间: 2020-08-28 14:02:14
插件版本: v0.39.8-beta

#===================== 系统信息 =====================#
主机型号: Default string Default string
固件版本: OpenWrt 19.07.3 r11063-85e04e9f46
LuCI版本: git-20.136.49537-fb2f363-1
内核版本: 4.14.180
处理器架构: x86_64

#此项在使用Tun模式时应为ACCEPT
防火墙转发: ACCEPT

#此项有值时建议到网络-接口-lan的设置中禁用IPV6的DHCP
IPV6-DHCP: 

#此项结果应仅有配置文件的DNS监听地址
Dnsmasq转发设置: 

#===================== 依赖检查 =====================#
dnsmasq-full: 已安装
coreutils: 已安装
coreutils-nohup: 已安装
bash: 已安装
curl: 已安装
jsonfilter: 已安装
ca-certificates: 已安装
ipset: 已安装
ip-full: 已安装
iptables-mod-tproxy: 已安装
kmod-tun(TUN模式): 已安装
luci-compat(Luci-19.07): 已安装

#===================== 内核检查 =====================#
运行状态: 未运行
已选择的架构: linux-amd64

#下方无法显示内核版本号时请确认您的内核版本是否正确或者有无权限
Tun内核版本: 2020.08.21.g0e83591
Tun内核文件: 存在
Tun内核运行权限: 正常

Game内核版本: v0.17.0-175-g7f77c72
Game内核文件: 存在
Game内核运行权限: 正常

Dev内核版本: v1.0.0-33-g8b7c731
Dev内核文件: 存在
Dev内核运行权限: 正常

#===================== 插件设置 =====================#
当前配置文件: /etc/openclash/config/config.yaml
运行模式: fake-ip-mix
默认代理模式: rule
UDP流量转发: 停用
DNS劫持: 启用
自定义DNS: 停用
IPV6-DNS解析: 停用
禁用Dnsmasq缓存: 启用
自定义规则: 停用
仅允许内网: 停用
仅代理命中规则流量: 停用

#启动异常时建议关闭此项后重试
保留配置: 停用
第三方规则: 停用

#===================== 配置文件 =====================#
#===================== Clash-DNS-Settings =====================#
redir-port: 7892
port: 7890
socks-port: 7891
ipv6: false
mode: rule
log-level: silent
external-controller: 0.0.0.0:9090
allow-lan: true
bind-address: "*"
external-ui: "/usr/share/openclash/dashboard"
tun:
  enable: true
  stack: system
  dns-hijack:
  - tcp://8.8.8.8:53
  - tcp://8.8.4.4:53
dns:

  enable: true
  ipv6: false
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  listen: 127.0.0.1:7874
  fake-ip-filter:
##Custom fake-ip-filter##
  - '*.lan'
  - 'time.windows.com'
  - 'time.nist.gov'
  - 'time.apple.com'
  - 'time.asia.apple.com'
  - '*.ntp.org.cn'
  - '*.openwrt.pool.ntp.org'
  - 'time1.cloud.tencent.com'
  - 'time.ustc.edu.cn'
  - 'pool.ntp.org'
  - 'ntp.ubuntu.com'
  - 'ntp.aliyun.com'
  - 'ntp1.aliyun.com'
  - 'ntp2.aliyun.com'
  - 'ntp3.aliyun.com'
  - 'ntp4.aliyun.com'
  - 'ntp5.aliyun.com'
  - 'ntp6.aliyun.com'
  - 'ntp7.aliyun.com'
  - 'time1.aliyun.com'
  - 'time2.aliyun.com'
  - 'time3.aliyun.com'
  - 'time4.aliyun.com'
  - 'time5.aliyun.com'
  - 'time6.aliyun.com'
  - 'time7.aliyun.com'
  - '*.time.edu.cn'
  - 'time1.apple.com'
  - 'time2.apple.com'
  - 'time3.apple.com'
  - 'time4.apple.com'
  - 'time5.apple.com'
  - 'time6.apple.com'
  - 'time7.apple.com'
  - 'time1.google.com'
  - 'time2.google.com'
  - 'time3.google.com'
  - 'time4.google.com'
  - 'music.163.com'
  - '*.music.163.com'
  - '*.126.net'
  - 'musicapi.taihe.com'
  - 'music.taihe.com'
  - 'songsearch.kugou.com'
  - 'trackercdn.kugou.com'
  - '*.kuwo.cn'
  - 'api-jooxtt.sanook.com'
  - 'api.joox.com'
  - 'joox.com'
  - 'y.qq.com'
  - '*.y.qq.com'
  - 'streamoc.music.tc.qq.com'
  - 'mobileoc.music.tc.qq.com'
  - 'isure.stream.qqmusic.qq.com'
  - 'dl.stream.qqmusic.qq.com'
  - 'aqqmusic.tc.qq.com'
  - 'amobile.music.tc.qq.com'
  - '*.xiami.com'
  - '*.music.migu.cn'
  - 'music.migu.cn'
  - '*.msftconnecttest.com'
  - '*.msftncsi.com'
  - 'localhost.ptlogin2.qq.com'
  - '*.*.*.srv.nintendo.net'
  - '*.*.stun.playstation.net'
  - 'xbox.*.*.microsoft.com'
##Custom fake-ip-filter END##
  nameserver:
  - 119.29.29.29
  - 1.2.4.8

#===================== 防火墙设置 =====================#

#NAT chain

Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         
1    prerouting_rule  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3: Custom prerouting rule chain */
2    zone_lan_prerouting  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
3    zone_wan_prerouting  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

#Mangle chain

Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

#===================== 路由表状态 =====================#
#route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
10.242.0.0      0.0.0.0         255.255.0.0     U     0      0        0 ztzlgmpcam
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.55.0    10.242.100.110  255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.66.0    10.242.100.119  255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.77.0    0.0.0.0         255.255.255.0   U     0      0        0 br-lan
192.168.88.0    10.242.100.216  255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.99.0    10.242.100.121  255.255.255.0   UG    0      0        0 ztzlgmpcam
#ip route list
default via 192.168.1.1 dev eth0 proto static src 192.168.1.2 
10.242.0.0/16 dev ztzlgmpcam proto kernel scope link src 10.242.100.179 
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.2 
192.168.55.0/24 via 10.242.100.110 dev ztzlgmpcam 
192.168.66.0/24 via 10.242.100.119 dev ztzlgmpcam 
192.168.77.0/24 dev br-lan proto kernel scope link src 192.168.77.1 
192.168.88.0/24 via 10.242.100.216 dev ztzlgmpcam 
192.168.99.0/24 via 10.242.100.121 dev ztzlgmpcam 
#ip rule show
0:  from all lookup local 
32766:  from all lookup main 
32767:  from all lookup default 

#===================== Tun设备状态 =====================#
ztzlgmpcam: tap

#===================== 端口占用状态 =====================#

#===================== 测试本机DNS查询 =====================#
Server:     127.0.0.1
Address:    127.0.0.1#53

Name:      www.baidu.com
www.baidu.com   canonical name = www.a.shifen.com
Name:      www.a.shifen.com
Address 1: 112.80.248.76
Address 2: 112.80.248.75
www.baidu.com   canonical name = www.a.shifen.com

#===================== resolv.conf.auto =====================#
# Interface wan
nameserver 1.2.4.8
nameserver 119.29.29.29

#===================== 测试本机网络连接 =====================#
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: keep-alive
Content-Length: 277
Content-Type: text/html
Date: Fri, 28 Aug 2020 06:02:15 GMT
Etag: "575e1f7c-115"
Last-Modified: Mon, 13 Jun 2016 02:50:36 GMT
Pragma: no-cache
Server: bfe/1.0.8.18

#===================== 测试本机网络下载 =====================#

#===================== 最近运行日志 =====================#
2020-08-28 13:44:20 OpenClash Reload After Firewall Restart
2020-08-28 13:44:23 OpenClash Reload After Firewall Restart
time="2020-08-28T05:44:26Z" level=fatal msg="Parse config error: yaml: line 131: did not find expected key"
2020-08-28 13:44:22 OpenClash Can Not Start, Please Check The Error Info And Try Again
time="2020-08-28T05:45:53Z" level=fatal msg="Parse config error: yaml: line 131: did not find expected key"
2020-08-28 13:45:49 OpenClash Can Not Start, Please Check The Error Info And Try Again
time="2020-08-28T05:49:49Z" level=info msg="Start initial compatible provider TW"
time="2020-08-28T05:49:49Z" level=info msg="Start initial compatible provider FAST"
time="2020-08-28T05:49:49Z" level=info msg="DNS server listening at: 127.0.0.1:7874"
2020-08-28 13:49:44 OpenClash Start Successful
2020-08-28 13:52:54 OpenClash Reload After Firewall Restart
2020-08-28 13:52:55 OpenClash Reload After Firewall Restart
time="2020-08-28T05:52:59Z" level=fatal msg="Parse config error: yaml: line 131: did not find expected key"
2020-08-28 13:52:54 OpenClash Can Not Start, Please Check The Error Info And Try Again
time="2020-08-28T05:55:55Z" level=info msg="Start initial compatible provider FAST"
time="2020-08-28T05:55:55Z" level=info msg="Start initial compatible provider TW"
time="2020-08-28T05:55:55Z" level=info msg="DNS server listening at: 127.0.0.1:7874"
2020-08-28 13:55:51 OpenClash Start Successful
2020-08-28 13:59:09 OpenClash Reload After Firewall Restart
2020-08-28 13:59:11 OpenClash Reload After Firewall Restart
time="2020-08-28T05:59:15Z" level=fatal msg="Parse config error: yaml: line 131: did not find expected key"
2020-08-28 13:59:10 OpenClash Can Not Start, Please Check The Error Info And Try Again
time="2020-08-28T06:00:54Z" level=info msg="Start initial compatible provider TW"
time="2020-08-28T06:00:54Z" level=info msg="Start initial compatible provider FAST"
time="2020-08-28T06:00:54Z" level=info msg="DNS server listening at: 127.0.0.1:7874"
2020-08-28 14:00:49 OpenClash Start Successful
2020-08-28 14:01:57 OpenClash Reload After Firewall Restart
2020-08-28 14:01:58 OpenClash Reload After Firewall Restart
time="2020-08-28T06:02:02Z" level=fatal msg="Parse config error: yaml: line 131: did not find expected key"
2020-08-28 14:01:57 OpenClash Can Not Start, Please Check The Error Info And Try Again
ghost commented 4 years ago

另外,在“第三方规则集列表”管理页面,某些规则下载失败后,我点击删除,直接跳转到“游戏规则”管理页面了?

ghost commented 4 years ago

这个443e1eb commit应该是修了我二楼说的跳转管理页面的bug吧,主楼反映的插入第三方规则集导致clash启动失败也是这个造成的?

vernesong commented 4 years ago

这边测试规则插入没有问题

ghost commented 4 years ago

请问我主楼贴的那个配置文件里,生成的规则集是正确的格式吗?为什么clash会报错呢?我试了一下午都是这样,还是使用规则集有什么前置条件? 谢谢。

-- Sent from Canary (https://canarymail.io)

On 星期五, 8月 28, 2020 at 4:06 下午, vernesong <notifications@github.com (mailto:notifications@github.com)> wrote:

这边测试规则插入没有问题

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub (https://github.com/vernesong/OpenClash/issues/693#issuecomment-682389728), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAI56YXSWX34H7AKDIDPZTTSC5QPLANCNFSM4QNYNWFQ).

vernesong commented 4 years ago

你贴一下/etc/config/openclash里面这一段的内容

config rule_provider_config
    option enabled '1'
    option interval '86400'
    option config 'config.yaml'
    list rule_name 'DisneyPlus'
    option group 'GlobalTV'
    option position '0'
ghost commented 4 years ago
config rule_provider_config
        option enabled '1'
        option interval '86400'
        option config 'all'
        list rule_name 'DisneyPlus^M
'
        option group 'DIRECT'
        option position '0'

https://imgur.com/VqfZkDp

Disneyplus后的这个空格符^M好像有点问题?

ghost commented 4 years ago

手工编辑去掉这个^M后,再手工启动openclash是正常的,规则插入也对,但不知道为什么在设置页面保存config文件的时候会出现这个符号。