🍒 自定义代理规则,精简匹配规则(代理匹配速度明显提升),适合学生和开发者使用。
https://cdn.jsdelivr.net/gh/zhanyeye/clash-rules-lite@release/rules.txt
- 拷贝一份订阅脚本到
local file
。
- 在
local file
脚本中,修改配置如下,保留你的proxies
和proxy-groups
mixed-port: 7890
allow-lan: true
bind-address: '*'
mode: rule
log-level: silent
external-controller: '127.0.0.1:9090'
proxies:
- { name: '1-香港', type: *, server: **, port: *, cipher: **, password: **, udp: true }
- { name: '2-香港', type: *, server: **, port: *, cipher: **, password: **, udp: true }
proxy-groups:
- { name: 'PROXY', type: select, proxies: ['1-香港', '2-香港'] }
rules:
- DOMAIN-KEYWORD,github,PROXY
- DOMAIN-KEYWORD,google,PROXY
- RULE-SET,pac,PROXY
rule-providers:
pac:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/zhanyeye/clash-rules-lite@release/rules.txt"
path: ./rules/pac.yaml
interval: 86400
script:
code: |
def main(ctx, metadata):
keywords = ["google", "github"]
for key in keywords:
if key in metadata["host"]:
return "PROXY"
if ctx.rule_providers["pac"].match(metadata):
return "PROXY"
else:
return "DIRECT"
- 运行修改后的
local file
,再切换成Rule
或Script
模式。
fork 该仓库,修改rules.txt
,github actions 会自动生成,记得将url中的用户名替换成自己的。