Closed X1A0CA1 closed 6 months ago
环境: @surgio/gateway: 2.0.1 surgio: 3.8.1 node: 22.0.0 npx: 10.5.1 npm: 10.5.1 yarn: 1.22.22 pnpm: 9.0.6
已经在 surgio.conf.js 启用了 clash.meta 支持。
surgio.conf.js
clashConfig: { clashCore: "clash.meta" },
测试模板如下:
rules: {% filter clash %} DOMAIN,test.com,REJECT DOMAIN-SUFFIX,test.com,REJECT DOMAIN-KEYWORD,test.com,REJECT DOMAIN-REGEX,test.com,REJECT GEOSITE,test.com,REJECT GEOIP,test.com,REJECT SRC-GEOIP,test.com,REJECT IP-ASN,test.com,REJECT SRC-IP-ASN,test.com,REJECT IP-CIDR,test.com,REJECT IP-CIDR6,test.com,REJECT SRC-IP-CIDR,test.com,REJECT IP-SUFFIX,test.com,REJECT SRC-IP-SUFFIX,test.com,REJECT SRC-PORT,test.com,REJECT DST-PORT,test.com,REJECT IN-PORT,test.com,REJECT DSCP,test.com,REJECT PROCESS-NAME,test.com,REJECT PROCESS-PATH,test.com,REJECT PROCESS-NAME-REGEX,test.com,REJECT PROCESS-PATH-REGEX,test.com,REJECT NETWORK,test.com,REJECT UID,test.com,REJECT IN-TYPE,test.com,REJECT IN-USER,test.com,REJECT IN-NAME,test.com,REJECT SUB-RULE,test.com,REJECT AND,test.com,REJECT OR,test.com,REJECT NOT,test.com,REJECT RULE-SET,test.com,REJECT MATCH,test.com,REJECT {% endfilter %}
当使用 npx surgio generate 时,输出是预期行为,包含了当前代码版本中 clash.meta 所支持的所有分流规则,如下:
npx surgio generate
rules: - DOMAIN,test.com,REJECT - DOMAIN-SUFFIX,test.com,REJECT - DOMAIN-KEYWORD,test.com,REJECT - GEOSITE,test.com,REJECT - GEOIP,test.com,REJECT - IP-CIDR,test.com,REJECT - IP-CIDR6,test.com,REJECT - SRC-IP-CIDR,test.com,REJECT - IP-SUFFIX,test.com,REJECT - SRC-IP-SUFFIX,test.com,REJECT - SRC-PORT,test.com,REJECT - DST-PORT,test.com,REJECT - IN-PORT,test.com,REJECT - DSCP,test.com,REJECT - PROCESS-NAME,test.com,REJECT - PROCESS-PATH,test.com,REJECT - NETWORK,test.com,REJECT - UID,test.com,REJECT - IN-TYPE,test.com,REJECT - IN-USER,test.com,REJECT - IN-NAME,test.com,REJECT - SUB-RULE,test.com,REJECT - AND,test.com,REJECT - OR,test.com,REJECT - NOT,test.com,REJECT - RULE-SET,test.com,REJECT - MATCH,test.com,REJECT
但当使用网关模式,也就是 node server.js 启动服务器,通过网页 (get-artifact/clash.yaml)下载/预览的文件只包含了:
node server.js
rules: - DOMAIN,test.com,REJECT - DOMAIN-SUFFIX,test.com,REJECT - DOMAIN-KEYWORD,test.com,REJECT - GEOIP,test.com,REJECT - IP-CIDR,test.com,REJECT - IP-CIDR6,test.com,REJECT - SRC-IP-CIDR,test.com,REJECT - SRC-PORT,test.com,REJECT - DST-PORT,test.com,REJECT - PROCESS-NAME,test.com,REJECT - MATCH,test.com,REJECT
猜测: 仅从网关模式的输出结果来看,仅包含了 clash 支持的分流规则,并没有包含 clash.meta 的任何一条分流规则,可能是在网关模式下并没有成功读取到 clashConfig.clashCore 所导致的问题? js 很菜,不会看代码,只能靠猜,见谅
请检查一下你的 gateway 版本,2.2.0 已经支持读取这个配置了,不过 gateway 仅支持从 surgio.conf.js 中读取,节点一层会被忽略。
环境: @surgio/gateway: 2.0.1 surgio: 3.8.1 node: 22.0.0 npx: 10.5.1 npm: 10.5.1 yarn: 1.22.22 pnpm: 9.0.6
已经在
surgio.conf.js
启用了 clash.meta 支持。测试模板如下:
当使用
npx surgio generate
时,输出是预期行为,包含了当前代码版本中 clash.meta 所支持的所有分流规则,如下:但当使用网关模式,也就是
node server.js
启动服务器,通过网页 (get-artifact/clash.yaml)下载/预览的文件只包含了:猜测: 仅从网关模式的输出结果来看,仅包含了 clash 支持的分流规则,并没有包含 clash.meta 的任何一条分流规则,可能是在网关模式下并没有成功读取到 clashConfig.clashCore 所导致的问题?
js 很菜,不会看代码,只能靠猜,见谅