🔧 Managing Large-Scale XrayR Nodes / 管理大规模 XrayR 节点

If you run a VPN service or a large private network using XrayR, managing config.yml across dozens of servers is a headache.
如果你经营 VPN 服务或管理使用 XrayR 的大型私有网络,在数十台服务器上维护 config.yml 是一件头疼的事。

XrayR_config_modif is a Python utility to patch, validate, and inject dynamic rules into XrayR configurations programmatically.
XrayR_config_modif 是一个 Python 工具,用于以编程方式修补、验证和向 XrayR 配置注入动态规则。


⚡ Features / 功能

  • Rule Injection: Automatically append new rulelist entries without breaking YAML structure.
    规则注入:自动追加新的 rulelist 条目,而不会破坏 YAML 结构。
  • Batch Update: Apply changes to multiple config files at once.
    批量更新:一次应用更改到多个配置文件。
  • Validation: Ensures the YAML is compliant before XrayR restarts.

📝 Example / 示例

from config_modif import ConfigModifier

# Initialize
modifier = ConfigModifier("config.yml")

# Add a block rule
modifier.add_rule(
type="field",
domain=["geosite:category-ads-all"],
outboundTag="block"
)

# Save
modifier.save()

Stop editing YAML by hand. Use code.
停止手动编辑 YAML。请使用代码。