Last active
June 19, 2024 08:00
-
-
Save test482/3572dbd15b4838a7f999a749104a77ee to your computer and use it in GitHub Desktop.
Clash For Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/FDUZS/fd75c1d08baf2f7985cf34f58371cda5 | |
parsers: | |
# - url: https://example.com/profile.yaml # 指定订阅 | |
- reg: ^.*$ # 匹配所有订阅 | |
# - reg: ^https://sub\.example\.com/.+$ # 正则匹配域名 | |
# 删除服务商提供的策略组和规则 | |
code: | | |
module.exports.parse = (raw, { yaml }) => { | |
const rawObj = yaml.parse(raw) | |
const groups = [] | |
const rules = [] | |
return yaml.stringify({ ...rawObj, 'proxy-groups': groups, rules }) | |
} | |
# 建立自己的配置 | |
yaml: | |
# 建立策略组 | |
prepend-proxy-groups: | |
- { name: 代理节点, type: select, proxies: [Fallback, 香港节点, 台湾节点, 新加坡节点, 日本节点, 美国节点, 自动选择, 手动选择] } | |
- { name: 自动选择, type: url-test, url: 'http://www.gstatic.com/generate_204', interval: 600, tolerance: 50, lazy: true } | |
- { name: 手动选择, type: select } | |
- { name: Telegram, type: select, proxies: [代理节点, 低倍率节点, 香港节点, 台湾节点, 新加坡节点, 日本节点, 美国节点, 自动选择, 手动选择, DIRECT] } | |
- { name: TikTok, type: select, proxies: [代理节点, 低倍率节点, 香港节点, 台湾节点, 新加坡节点, 日本节点, 美国节点, 自动选择, 手动选择, DIRECT] } | |
- { name: Twitch, type: select, proxies: [代理节点, 低倍率节点, 香港节点, 台湾节点, 新加坡节点, 日本节点, 美国节点, 自动选择, 手动选择, DIRECT] } | |
- { name: Youtube, type: select, proxies: [代理节点, 低倍率节点, 香港节点, 台湾节点, 新加坡节点, 日本节点, 美国节点, 自动选择, 手动选择, DIRECT] } | |
- { name: Netflix, type: select, proxies: [流媒体解锁, DIRECT] } | |
- { name: iCloud, type: select, proxies: [DIRECT, 代理节点] } | |
- { name: Apple, type: select, proxies: [DIRECT, 代理节点] } | |
- { name: Final, type: select, proxies: [DIRECT, 代理节点, 自动选择, 手动选择 ] } | |
- { name: 流媒体解锁, type: select } | |
- { name: 低倍率节点, type: select } | |
- { name: Fallback, type: fallback, url: 'http://www.gstatic.com/generate_204', interval: 600, proxies: [香港节点, 台湾节点, 新加坡节点, 日本节点, 美国节点] } | |
- { name: 香港节点, type: url-test, url: 'http://www.gstatic.com/generate_204', interval: 600, tolerance: 50, lazy: true } | |
- { name: 台湾节点, type: url-test, url: 'http://www.gstatic.com/generate_204', interval: 600, tolerance: 50, lazy: true } | |
- { name: 新加坡节点, type: url-test, url: 'http://www.gstatic.com/generate_204', interval: 600, tolerance: 50, lazy: true } | |
- { name: 日本节点, type: url-test, url: 'http://www.gstatic.com/generate_204', interval: 600, tolerance: 50, lazy: true } | |
- { name: 美国节点, type: url-test, url: 'http://www.gstatic.com/generate_204', interval: 600, tolerance: 50, lazy: true } | |
- { name: 广告域名, type: select, proxies: [REJECT, DIRECT] } | |
# 策略组示例 | |
# - name: 分组名 | |
# type: select # 手动选点 | |
# url-test # 自动选择延迟最低的节点 | |
# fallback # 节点故障时自动切换下一个 | |
# laod-balance # 均衡使用分组内的节点 | |
# url: http://www.gstatic.com/generate_204 # 测试地址 非 select 类型分组必要 | |
# interval: 600 # 自动测试间隔时间,单位秒 非 select 类型分组必要 | |
# tolerance: 50 # 允许的偏差,节点之间延迟差小于该值不切换 非必要 | |
# proxies: | |
# - 节点名称或其他分组套娃 | |
commands: | |
- proxy-groups.自动选择.proxies=[]proxyNames | |
- proxy-groups.手动选择.proxies=[]proxyNames | |
- proxy-groups.香港节点.proxies=[]proxyNames|^(.*)(HK|香港|港|Hong Kong)+(.*)$ # 向指定策略组添加订阅中的节点名,可使用正则过滤 | |
- proxy-groups.台湾节点.proxies=[]proxyNames|^(.*)(TW|台湾|台|Taiwan)+(.*)$ | |
- proxy-groups.新加坡节点.proxies=[]proxyNames|^(.*)(SG|新加坡|坡|Singapore)+(.*)$ | |
- proxy-groups.日本节点.proxies=[]proxyNames|^(.*)(JP|日本|日|Japan)+(.*)$ | |
- proxy-groups.美国节点.proxies=[]proxyNames|^(.*)(US|美国|美|United States)+(.*)$ | |
- proxy-groups.流媒体解锁.proxies=[]proxyNames|\[M\] | |
- proxy-groups.低倍率节点.proxies=[]proxyNames|^((?!倍率\:2\.5).)*(HK|香港|港|Hong Kong)((?!倍率\:2\.5).)*$ | |
# 一些可能用到的正则过滤节点示例,使分组更细致 | |
# []proxyNames|a # 包含 a | |
# []proxyNames|^(.*)(a|b)+(.*)$ # 包含 a 或 b | |
# []proxyNames|^(?=.*a)(?=.*b).*$ # 包含 a 和 b | |
# []proxyNames|^((?!b).)*a((?!b).)*$ # 包含 a 且不包含 b | |
# []proxyNames|^((?!b|c).)*a((?!b|c).)*$ # 包含 a 且不包含 b 或 c | |
# 添加规则 | |
prepend-rules: # 规则由上往下遍历,如上面规则已经命中,则不再往下处理 | |
- RULE-SET,applications,DIRECT # 需要直连的常见软件列表 | |
- DOMAIN,clash.razord.top,DIRECT # Clash 面板 | |
- DOMAIN,yacd.haishan.me,DIRECT # Clash 面板 | |
- RULE-SET,private,DIRECT # 私有网络专用域名列表 | |
- RULE-SET,reject,广告域名 # 广告域名列表 | |
- RULE-SET,icloud,iCloud # iCloud 域名列表 | |
- RULE-SET,apple,Apple # Apple 在中国大陆可直连的域名列表 | |
- RULE-SET,jingdong,DIRECT | |
- RULE-SET,tiktok,TikTok | |
- RULE-SET,twitch,Twitch | |
- RULE-SET,youtube,Youtube | |
- RULE-SET,netflix,Netflix | |
- RULE-SET,proxy,代理节点 # 代理域名列表 | |
- RULE-SET,telegramcidr,Telegram # Telegram 使用的 IP 地址列表 | |
- RULE-SET,direct,DIRECT # 直连域名列表 | |
- RULE-SET,lancidr,DIRECT # 局域网 IP 及保留 IP 地址列表 | |
- RULE-SET,cncidr,DIRECT # 中国大陆 IP 地址列表 | |
- RULE-SET,tld-not-cn,代理节点 # 非中国大陆使用的顶级域名列表 | |
- RULE-SET,gfw,代理节点 # GFWList 域名列表 | |
- GEOIP,LAN,DIRECT | |
- GEOIP,CN,DIRECT | |
- MATCH,Final | |
# 添加规则集 | |
mix-rule-providers: | |
apple: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt', path: ./ruleset/apple.yaml, interval: 86400 } | |
applications: { type: http, behavior: classical, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt', path: ./ruleset/applications.yaml, interval: 86400 } | |
cncidr: { type: http, behavior: ipcidr, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt', path: ./ruleset/cncidr.yaml, interval: 86400 } | |
direct: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt', path: ./ruleset/direct.yaml, interval: 86400 } | |
gfw: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt', path: ./ruleset/gfw.yaml, interval: 86400 } | |
icloud: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt', path: ./ruleset/icloud.yaml, interval: 86400 } | |
lancidr: { type: http, behavior: ipcidr, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt', path: ./ruleset/lancidr.yaml, interval: 86400 } | |
private: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt', path: ./ruleset/private.yaml, interval: 86400 } | |
proxy: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt', path: ./ruleset/proxy.yaml, interval: 86400 } | |
reject: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt', path: ./ruleset/reject.yaml, interval: 86400 } | |
telegramcidr: { type: http, behavior: ipcidr, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt', path: ./ruleset/telegramcidr.yaml, interval: 86400 } | |
tld-not-cn: { type: http, behavior: domain, url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt', path: ./ruleset/tld-not-cn.yaml, interval: 86400 } | |
tiktok: { type: http, behavior: classical, url: 'https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/TikTok/TikTok.yaml', path: ./ruleset/tiktok.yaml, interval: 86400 } | |
twitch: { type: http, behavior: classical, url: 'https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Twitch/Twitch.yaml', path: ./ruleset/twitch.yaml, interval: 86400 } | |
youtube: { type: http, behavior: classical, url: 'https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.yaml', path: ./ruleset/youtube.yaml, interval: 86400 } | |
netflix: { type: http, behavior: classical, url: 'https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix_Classical.yaml', path: ./ruleset/netflix.yaml, interval: 86400 } | |
jingdong: { type: http, behavior: classical, url: 'https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/JingDong/JingDong.yaml', path: ./ruleset/jingdong.yaml, interval: 86400 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment