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] 支持 Clash.Meta rule-anchor 配置方式 #769

Open
3 tasks done
steveqx opened this issue Sep 16, 2024 · 6 comments
Open
3 tasks done

[Feature] 支持 Clash.Meta rule-anchor 配置方式 #769

steveqx opened this issue Sep 16, 2024 · 6 comments

Comments

@steveqx
Copy link

steveqx commented Sep 16, 2024

Verify steps

  • 我已经在 Issue Tracker 中找过我要提出的问题 I have searched on the issue tracker for a related issue.
  • 我已经使用公测版本测试过,问题依旧存在 I have tested using the test mod, and the issue still exists.
  • 我已经仔细看过 常见问题 并无法自行解决问题

Description

Clash.meta 的 rule-anchor 可以方便简化重复性的配置

Config Example
rule-anchor:
ip: &ip {type: http, interval: 86400, behavior: ipcidr, format: mrs}
domain: &domain {type: http, interval: 86400, behavior: domain, format: mrs}
rule-providers:
private_domain:
<<: *domain
url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/private.mrs"
cn_domain:
<<: *domain
url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/cn.mrs"
biliintl_domain:

希望添加 rule-anchor
scripts/start.sh Line 441

yaml_char='proxies proxy-groups proxy-providers rules rule-providers'
改为
yaml_char='proxies proxy-groups proxy-providers rules rule-anchor rule-providers'

@steveqx steveqx changed the title [Feature] [Feature] 支持 Clash.Meta rule-anchor 配置方式 Sep 16, 2024
@juewuy
Copy link
Owner

juewuy commented Sep 22, 2024

下个版本适配meta内核mix模式时会考虑添加

@AquanJSW
Copy link

这个问题也困扰我很久了,是否可以考虑用yq进行anchor解析 (例如cat src.yaml | yq -o json | yq -o yaml -P > dst.yaml),并将yq设置为可选依赖?

毕竟anchor本身没有约束,例如我所使用的health-check,且可能出现在任何地方

这种情况下加入yaml_char的价值并不大

@juewuy

@juewuy
Copy link
Owner

juewuy commented Sep 27, 2024

大部分路由设备都没有预装jq或者yq,我拿什么预置这种命令

@AquanJSW
Copy link

我的意思是需要anchor的一般都是自己配置config的高级用户,这个时候让用户自己部署yq就行了
脚本里的这一行yq命令设为不抛出错误就行了

@juewuy
Copy link
Owner

juewuy commented Sep 27, 2024

@AquanJSW 所以为什么不加到user.yaml里?

@AquanJSW
Copy link

@juewuy 也是个方法,我只是觉得mihomo本身可以解析的配置,用ShellCrash却不能直接用,才有的这个workaround

确实,正如你所言,引入了额外的依赖不太优雅

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

3 participants