├── .gitignore ├── mrs ├── test.txt └── proxy.mrs ├── sgmodule ├── ipv6.sgmodule ├── ad.sgmodule └── netease.sgmodule ├── node.txt ├── scripts ├── build-node.py └── build-adguardhome.py ├── .github └── workflows │ ├── auto-generate.yml │ └── convert.yml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /mrs/test.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mrs/proxy.mrs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiangsanliu/Rules/HEAD/mrs/proxy.mrs -------------------------------------------------------------------------------- /sgmodule/ipv6.sgmodule: -------------------------------------------------------------------------------- 1 | #!name=启用ipv6 2 | #!desc=启用ipv6 3 | 4 | [General] 5 | ipv6 = true 6 | prefer-ipv6 = true 7 | -------------------------------------------------------------------------------- /sgmodule/ad.sgmodule: -------------------------------------------------------------------------------- 1 | #!name=anti-AD 2 | #!desc=https://anti-ad.net/ 3 | 4 | [Rule] 5 | 6 | DOMAIN-SET,https://anti-ad.net/surge2.txt,REJECT -------------------------------------------------------------------------------- /node.txt: -------------------------------------------------------------------------------- 1 | c3M6Ly9ZV1Z6TFRFeU9DMW5ZMjA2WkdWemNHVnlZV1J2YWk1amIyMWZabkpsWlY5d2NtOTRlVjlsZEdjd0BtdXNpYy5kZXNwZXJhZG9qLmNvbTozMDAwMyMlRTclQkQlOTElRTYlOTglOTMlRTQlQkElOTElRTklOUYlQjMlRTQlQjklOTA= -------------------------------------------------------------------------------- /sgmodule/netease.sgmodule: -------------------------------------------------------------------------------- 1 | #!name=网易云解锁 2 | #!desc=网易云解锁 3 | 4 | [Proxy Group] 5 | NetEaseMusic = url-test, url=http://www.gstatic.com/generate_204, interval=600, timeout=5, select=0, policy-regex-filter=(music|NetEaseMusic|网易云) 6 | 7 | [Rule] 8 | RULE-SET,https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Shadowrocket/NetEaseMusic/NetEaseMusic.list,NETEASEMUSIC 9 | -------------------------------------------------------------------------------- /scripts/build-node.py: -------------------------------------------------------------------------------- 1 | import base64 2 | import requests 3 | import urllib 4 | import os 5 | 6 | # node file from https://github.com/DesperadoJ/Rules-for-UnblockNeteaseMusic 7 | 8 | def get_node(): 9 | res = requests.get("https://github.com/DesperadoJ/Rules-for-UnblockNeteaseMusic/raw/master/Shadowrocket/shadowrocket-server.txt") 10 | if res.status_code != 200: 11 | raise Exception('Connect error') 12 | return res.text 13 | 14 | if __name__ == '__main__': 15 | node = str(get_node()) + '==' 16 | node = base64.b64decode(node).decode('utf-8') 17 | node = node.split("\n")[0].split('#')[0] 18 | node = node + '#' + urllib.parse.quote('网易云音乐') 19 | node = base64.b64encode(node.encode()).decode('utf-8') 20 | node_file = ad_file = open(os.getcwd() + '/node.txt', mode='w', encoding='utf-8') 21 | node_file.write(node) 22 | node_file.close() 23 | print('Netease node converted!') 24 | -------------------------------------------------------------------------------- /.github/workflows/auto-generate.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions 3 | 4 | name: Auto Generate 5 | 6 | on: 7 | workflow_dispatch: 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up Python 3.8 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: 3.8 20 | - name: Generate 21 | run: | 22 | pip install requests 23 | python3 ./scripts/build-node.py 24 | - name: Commit 25 | run: | 26 | git config --global user.email actions@github.com 27 | git config --global user.name 'GitHub Actions' 28 | git diff-index --quiet HEAD -- && echo "No changes to commit" || (git add . && git commit -m "daily update" -a && git push) 29 | - name: Push changes 30 | uses: ad-m/github-push-action@master 31 | with: 32 | github_token: ${{ secrets.GITHUB_TOKEN }} 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rules 2 | 3 | ## 简介 4 | 5 | **广告过滤、代理规则和网易云解锁规则**,利用Github Actions定时自动合并,适用于Shadowrocket。网易云解锁请结合[nondanee/UnblockNeteaseMusic](https://github.com/nondanee/UnblockNeteaseMusic)食用。 6 | 7 | ## 食用方法 8 | 9 | ### 1. 首先在shadowrocket上添加好网易云的解锁节点 10 | 11 | #### 自建解锁节点 12 | 13 | 首先根据[nondanee/UnblockNeteaseMusic](https://github.com/nondanee/UnblockNeteaseMusic)里的教程设置好解锁节点,然后在Shadowrocket里添加。(仔细阅读原项目issue: [iOS配置经验分享](https://github.com/nondanee/UnblockNeteaseMusic/issues/368)) 14 | 15 | 16 | 17 | > ❗️注意节点名称需要和[UnblockNeteaseMusic.conf](UnblockNeteaseMusic.conf)里的名称相同。 18 | 19 | #### 使用DesperadoJ大佬的节点 20 | 21 | 大佬的仓库地址:[DesperadoJRules-for-UnblockNeteaseMusic](https://github.com/DesperadoJ/Rules-for-UnblockNeteaseMusic),在里面找`Shadowrocket/shadowrocket-server.txt` 22 | 。 23 | 24 | > ❗️注意节点名称需要和[UnblockNeteaseMusic.conf](UnblockNeteaseMusic.conf)里的名称相同。 25 | > 26 | > 也可以使用我从DesperadoJ大佬那转换好的节点:[node.txt](https://cdn.jsdelivr.net/gh/xiangsanliu/Rules/node.txt) 27 | 28 | ### 2. 安装解锁模块 29 | 30 | 模块地址:`https://cdn.jsdelivr.net/gh/xiangsanliu/Rules/sgmodule/netease.sgmodule` 31 | 32 | 安装步骤:`Shadowrocket -> 模块 -> 右上角+号`,在输入框中粘贴,再点击确定。 33 | 34 | > ❗️经过反复试验,似乎开启MITM后,解锁不生效。 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /scripts/build-adguardhome.py: -------------------------------------------------------------------------------- 1 | import base64 2 | import requests 3 | import urllib 4 | import os 5 | 6 | PROXY_DNS = 'https://1.0.0.1/dns-query' 7 | 8 | def get_list(): 9 | res = requests.get("https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/refs/heads/master/rule/Clash/Proxy/Proxy.list") 10 | if res.status_code != 200: 11 | raise Exception('Connect error') 12 | return res.text 13 | 14 | def write_cn_dns(file): 15 | file.write("https://doh.pub/dns-query\n") 16 | file.write("https://doh.360.cn/dns-query\n") 17 | 18 | def write_out_dns(file): 19 | list = str(get_list()) 20 | list = list.split("\n") 21 | for line in list: 22 | if line.startswith('#') or line.startswith('IP-CIDR') or line.startswith('DOMAIN-KEYWORD'): 23 | continue 24 | elif line.startswith('DOMAIN-SUFFIX'): 25 | line = line.replace('DOMAIN-SUFFIX,', '') 26 | 27 | elif line.startswith('DOMAIN'): 28 | line = line.replace('DOMAIN,', '') 29 | if len(line) > 1: 30 | write_line(adguard_file, line) 31 | 32 | 33 | def write_line(file, line): 34 | formatted_line = '[/%s/]%s\n' % (line, PROXY_DNS) 35 | file.write(formatted_line) 36 | 37 | if __name__ == '__main__': 38 | adguard_file = open('adguard.txt', mode='w', encoding='utf-8') 39 | write_out_dns(adguard_file) 40 | write_cn_dns(adguard_file) 41 | adguard_file.write('\n') 42 | adguard_file.close() 43 | 44 | -------------------------------------------------------------------------------- /.github/workflows/convert.yml: -------------------------------------------------------------------------------- 1 | name: Ruleset Auto Update 2 | 3 | on: 4 | schedule: 5 | - cron: '0 17 * * *' # 每天 UTC 17:00 (北京时间 01:00) 执行 6 | 7 | # 允许手动触发,方便测试 8 | workflow_dispatch: 9 | push: 10 | branches: 11 | - main 12 | 13 | jobs: 14 | update_ruleset: 15 | runs-on: ubuntu-latest 16 | 17 | # Git 配置,用于后续的 push 操作 18 | env: 19 | GIT_COMMITTER_NAME: GitHub Actions Bot 20 | GIT_COMMITTER_EMAIL: actions@github.com 21 | 22 | steps: 23 | # 0. Checkout code 24 | - name: 🚀 Checkout Repository 25 | uses: actions/checkout@v4 26 | with: 27 | # 必须配置 token 以允许后续的 push 28 | token: ${{ secrets.GITHUB_TOKEN }} 29 | 30 | # 1. 下载、解压、重命名并赋予执行权限 mihomo 31 | - name: 📥 Download and Setup Mihomo 32 | run: | 33 | # 下载压缩包 34 | MIHOMO_URL="https://github.com/MetaCubeX/mihomo/releases/download/v1.19.16/mihomo-linux-amd64-compatible-v1.19.16.gz" 35 | curl -L $MIHOMO_URL -o mihomo.gz 36 | 37 | # 解压 38 | gunzip mihomo.gz 39 | 40 | # 赋予执行权限 41 | chmod +x mihomo 42 | 43 | # 2. 下载 proxy.txt 文件 44 | - name: ⬇️ Download proxy.txt Rules 45 | run: | 46 | RULES_URL="https://github.com/Loyalsoldier/clash-rules/raw/refs/heads/release/proxy.txt" 47 | curl -L $RULES_URL -o proxy.txt 48 | 49 | # 3. 执行 mihomo convert-ruleset 命令 50 | - name: 🛠️ Convert Ruleset 51 | run: | 52 | ./mihomo convert-ruleset domain yaml proxy.txt mrs/proxy.mrs 53 | 54 | # 4. Push proxy.mrs 55 | - name: 📤 Commit and Push proxy.mrs 56 | run: | 57 | # 检查文件是否发生变化 58 | if git diff --exit-code mrs/proxy.mrs; then 59 | echo "proxy.mrs has no changes. Skipping commit." 60 | else 61 | # 配置 Git user 62 | git config user.name "${{ env.GIT_COMMITTER_NAME }}" 63 | git config user.email "${{ env.GIT_COMMITTER_EMAIL }}" 64 | 65 | # 添加文件 66 | git add mrs/proxy.mrs 67 | 68 | # 提交更改 69 | git commit -m "🤖 Auto update" 70 | 71 | # 推送更改到当前分支 72 | git push 73 | echo "Successfully committed and pushed." 74 | fi 75 | --------------------------------------------------------------------------------