Skip to content

About

定时合并 mihomo、sing-box 规则,构建自用规则集

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

Rule Merger

Python Version Build Status

定时合并 mihomo、sing-box 规则,构建自用规则集

  • 支持 yaml、mrs、text、json、srs 文件格式 1
  • 支持 domain、ipcidr、classical、sing-box 规则格式
  • 支持规则格式互转

如何使用

Tip

亦可 Fork 本仓库后使用 Actions 进行自动化构建

  1. 安装 python 以及必要依赖

    python -m pip install --upgrade pip
    pip install -r requirements.txt
  2. 编辑 config.yaml 以列表形式定义需要生成的文件以及其上游规则,基本格式与 Mihomo rule-providers 一致

    - path: output/reject.yml
      format: yaml         # options: yaml, mrs, text, json, srs
      behavior: classical  # options: domain, ipcidr, classical, sing-box
      upstream:
    
        local_reject:
          type: http
          path: "local/reject.txt"
          format: text
          behavior: classical
    
        xndeye_reject:
          type: http
          url: "https://raw.githubusercontent.com/xndeye/adblock_list/refs/heads/release/clash.yaml"
          format: yaml
          behavior: domain
  3. 配置 Mihomo 路径 (使用 mrs 格式必要条件)

    • 修改 rule_merger.py 的 MIHOMO_PATH 字段
    • 或将 mihomo 可执行文件加入 /usr/local/bin/ 或 $PATH 环境变量中
  4. 配置 sing-box 路径 (使用 srs 格式必要条件)

    • 修改 rule_merger.py 的 SING_BOX_PATH 字段
    • 或将 sing-box 可执行文件加入 /usr/local/bin/ 或 $PATH 环境变量中
    • GitHub Actions 固定使用 sing-box v1.13.13,默认生成 rule-set version 4
  5. 执行脚本

    python rule_merger.py

规则列表

文件 介绍 github ghproxy jsdelivr
reject 广告域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
reject@ip 广告IP mrs yaml json srs mrs yaml json srs mrs yaml json srs
direct 推荐直连域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
direct@ip 推荐直连IP mrs yaml json srs mrs yaml json srs mrs yaml json srs
microsoft@cn 微软中国域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
apple@cn 苹果中国域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
game@cn 游戏相关中国域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
ai AI相关域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
proxy 推荐代理域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
proxy@ip 推荐代理IP mrs yaml json srs mrs yaml json srs mrs yaml json srs
lan@ip 局域网IP mrs yaml json srs mrs yaml json srs mrs yaml json srs
lan 局域网域名 mrs yaml json srs mrs yaml json srs mrs yaml json srs
fakeip-filter fakeIP过滤 mrs yaml json srs mrs yaml json srs mrs yaml json srs

引用来源


Footnotes

  1. mihomo 可用格式:yaml、mrs、text,sing-box 可用格式:json、srs ↩

About

定时合并 mihomo、sing-box 规则,构建自用规则集

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages