Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] rule-provider without payload: #751

Open
3 tasks done
ChrAlpha opened this issue May 4, 2024 · 0 comments
Open
3 tasks done

[Feature] rule-provider without payload: #751

ChrAlpha opened this issue May 4, 2024 · 0 comments

Comments

@ChrAlpha
Copy link

ChrAlpha commented May 4, 2024

verify

  • 我已经仔细阅读项目文档,确认现有功能无法解决我的需求
  • 我已经检索过现有issue,确认与现有issue的内容并不重复
  • 我已经尝试自行解决,确认自己没有能力解决

功能描述

在 mihomo (Clash.Meta) 系应用中,rule-provider 可以处理的 domainset

prepend-rule-providers:
  reject_domainset:
    type: http
    behavior: domain
    format: text
    interval: 43200
    url: https://ruleset.skk.moe/Clash/domainset/reject.txt
    path: ./sukkaw_ruleset/reject_domainset.txt

在尝试 subconverter 转化的时候却无法通过 clash-domain: 展开到 rules 中,即便没有报错:

ruleset=🛑 广告拦截,clash-domain:https://ruleset.skk.moe/Clash/domainset/reject.txt

简单溯源发现 SukkaW/Surge 提供的 Clash Premium 版本 domainset 每条域名规则单独一行且开头没有 payload

this_ruleset_is_made_by_sukkaw.ruleset.skk.moe
+.a1.mzstatic.com
+.a2.mzstatic.com
# ...
payload:
  - '+.a1.mzstatic.com'
  - '+.a2.mzstatic.com'
  - '+.a3.mzstatic.com'
# ...

而在 src/generator/config/ruleconvert.cpp#L31 仅仅通过文件开头 payload 判断为 Clash。

可能的解决方案

src/generator/config/ruleconvert.cpp#L31 增加通过类似 type==RULESET_CLASH_DOMAIN 或者 type=RULESET_CLASH_IPCIDR 在判断 payload: 同级的位置,确保在没有 payload: 的情况下依然能够逐行作为 payload 元素处理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant