You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rules/Clash/Rule.yaml

558 lines
17 KiB
YAML

- RULE-SET,AdBlock,AdBlock
- RULE-SET,HTTPDNS,HTTPDNS
- RULE-SET,Special,DIRECT
- RULE-SET,Netflix,Netflix
- RULE-SET,Disney Plus,Disney Plus
- RULE-SET,YouTube,YouTube
# - RULE-SET,YouTube Music,YouTube
- RULE-SET,Max,Max
- RULE-SET,Spotify,Spotify
- RULE-SET,Bilibili,CN Mainland TV
- RULE-SET,IQ,CN Mainland TV
- RULE-SET,IQIYI,CN Mainland TV
- RULE-SET,Letv,CN Mainland TV
- RULE-SET,Netease Music,CN Mainland TV
- RULE-SET,Tencent Video,CN Mainland TV
- RULE-SET,WeTV,CN Mainland TV
- RULE-SET,Youku,CN Mainland TV
- RULE-SET,Abema TV,Asian TV
- RULE-SET,Bahamut,Asian TV
- RULE-SET,Fox+,Asian TV
- RULE-SET,Hulu Japan,Asian TV
- RULE-SET,Japonx,Asian TV
- RULE-SET,JOOX,Asian TV
- RULE-SET,KKBOX,Asian TV
- RULE-SET,KKTV,Asian TV
- RULE-SET,Line TV,Asian TV
# - RULE-SET,MOO,Asian TV
- RULE-SET,myTV SUPER,Asian TV
- RULE-SET,Niconico,Asian TV
- RULE-SET,ViuTV,Asian TV
- RULE-SET,ABC,Global TV
- RULE-SET,Amazon,Global TV
- RULE-SET,BBC iPlayer,Global TV
- RULE-SET,DAZN,Global TV
- RULE-SET,Discovery Plus,Global TV
- RULE-SET,encoreTVB,Global TV
- RULE-SET,F1 TV,Global TV
- RULE-SET,Fox Now,Global TV
- RULE-SET,Hulu,Global TV
- RULE-SET,Pandora,Global TV
- RULE-SET,PBS,Global TV
- RULE-SET,Pornhub,Global TV
- RULE-SET,Soundcloud,Global TV
- RULE-SET,Telegram,Telegram
- RULE-SET,Crypto,Crypto
- RULE-SET,Discord,Discord
- RULE-SET,Google FCM,Google FCM
- RULE-SET,Microsoft,Microsoft
- RULE-SET,AI Suite,AI Suite
- RULE-SET,PayPal,PayPal
- RULE-SET,Scholar,Scholar
- RULE-SET,Speedtest,Speedtest
- RULE-SET,Steam,Steam
- RULE-SET,TikTok,TikTok
- RULE-SET,Apple Music,Apple TV
- RULE-SET,Apple News,Apple TV
- RULE-SET,Apple TV,Apple TV
- RULE-SET,Apple,Apple
- RULE-SET,miHoYo,miHoYo
- RULE-SET,PROXY,Proxy
- RULE-SET,Domestic,Domestic
- RULE-SET,Domestic IPs,Domestic
- RULE-SET,LAN,DIRECT
- GEOIP,CN,Domestic
- MATCH,Others
script:
code: |
def main(ctx,metadata):
ruleset_action = {
'AdBlock': 'AdBlock',
'HTTPDNS': 'HTTPDNS',
'Special': 'DIRECT',
'Netflix': 'Netflix',
'Disney Plus': 'Disney Plus',
'YouTube': 'YouTube',
'Max': 'Max',
'Spotify': 'Spotify',
'Bilibili': 'CN Mainland TV',
'IQ': 'CN Mainland TV',
'IQIYI': 'CN Mainland TV',
'Letv': 'CN Mainland TV',
'Netease Music': 'CN Mainland TV',
'Tencent Video': 'CN Mainland TV',
'Youku': 'CN Mainland TV',
'WeTV': 'CN Mainland TV',
'Abema TV': 'Asian TV',
'Bahamut': 'Asian TV',
'Fox+': 'Asian TV',
'Hulu Japan': 'Asian TV',
'Japonx': 'Asian TV',
'JOOX': 'Asian TV',
'KKBOX': 'Asian TV',
'KKTV': 'Asian TV',
'Line TV': 'Asian TV',
'myTV SUPER': 'Asian TV',
'Niconico': 'Asian TV',
'ViuTV': 'Asian TV',
'ABC': 'Global TV',
'Amazon': 'Global TV',
'BBC iPlayer': 'Global TV',
'DAZN': 'Global TV',
'Discovery Plus': 'Global TV',
'encoreTVB': 'Global TV',
'F1 TV': 'Global TV',
'Fox Now': 'Global TV',
'Hulu': 'Global TV',
'Pandora': 'Global TV',
'PBS': 'Global TV',
'Pornhub': 'Global TV',
'Soundcloud': 'Global TV',
'Apple Music': 'Apple TV',
'Apple News': 'Apple TV',
'Apple TV': 'Apple TV',
'Apple': 'Apple',
'Telegram': 'Telegram',
'Crypto': 'Crypto',
'Discord': 'Discord',
'Google FCM': 'Google FCM',
'Microsoft': 'Microsoft',
'AI Suite': 'AI Suite',
'PayPal': 'PayPal',
'Scholar': 'Scholar',
'Speedtest': 'Speedtest',
'Steam': 'Steam',
'TikTok': 'TikTok',
'miHoYo': 'miHoYo',
'PROXY': 'Proxy',
'Domestic': 'Domestic',
'Domestic IPs': 'Domestic',
'LAN': 'DIRECT'
}
port = int(metadata['dst_port'])
if metadata['network'] == 'UDP' and port == 443:
ctx.log('[Script] matched QUIC traffic use reject')
return 'REJECT'
port_list = [21,22,23,53,80,123,143,194,443,465,587,853,993,995,998,2052,2053,2082,2083,2086,2095,2096,3389,5222,5228,5229,5230,8080,8443,8880,8888,8889]
if port not in port_list:
ctx.log('[Script] not common port use direct')
return 'DIRECT'
if metadata['dst_ip'] == '':
metadata['dst_ip'] = ctx.resolve_ip(metadata['host'])
for ruleset in ruleset_action:
if ctx.rule_providers[ruleset].match(metadata):
return ruleset_action[ruleset]
if metadata['dst_ip'] != '':
code = ctx.geoip(metadata['dst_ip'])
if code == 'CN':
ctx.log('[Script] Geoip CN')
return 'Domestic'
ctx.log('[Script] FINAL')
return 'Others'
rule-providers:
AdBlock:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/AdBlock.yaml'
path: ./Rules/AdBlock
interval: 86400
HTTPDNS:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/HTTPDNS.yaml'
path: ./Rules/HTTPDNS
interval: 86400
Special:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Special.yaml'
path: ./Rules/Special
interval: 86400
PROXY:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Proxy.yaml'
path: ./Rules/Proxy
interval: 86400
Domestic:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Domestic.yaml'
path: ./Rules/Domestic
interval: 86400
Domestic IPs:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Domestic%20IPs.yaml'
path: ./Rules/Domestic_IPs
interval: 86400
LAN:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/LAN.yaml'
path: ./Rules/LAN
interval: 86400
Netflix:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Netflix.yaml'
path: ./Rules/Media/Netflix
interval: 86400
Spotify:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Spotify.yaml'
path: ./Rules/Media/Spotify
interval: 86400
# YouTube Music:
# type: http
# behavior: classical
# url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/YouTube%20Music.yaml'
# path: ./Rules/Media/YouTube_Music
# interval: 86400
YouTube:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/YouTube.yaml'
path: ./Rules/Media/YouTube
interval: 86400
Max:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Max.yaml'
path: ./Rules/Media/Max
interval: 86400
Bilibili:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Bilibili.yaml'
path: ./Rules/Media/Bilibili
interval: 86400
IQ:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/IQ.yaml'
path: ./Rules/Media/IQI
interval: 86400
IQIYI:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/IQIYI.yaml'
path: ./Rules/Media/IQYI
interval: 86400
Letv:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Letv.yaml'
path: ./Rules/Media/Letv
interval: 86400
# MOO:
# type: http
# behavior: classical
# url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/MOO.yaml'
# path: ./Rules/Media/MOO
# interval: 86400
Netease Music:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Netease%20Music.yaml'
path: ./Rules/Media/Netease_Music
interval: 86400
Tencent Video:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Tencent%20Video.yaml'
path: ./Rules/Media/Tencent_Video
interval: 86400
Youku:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Youku.yaml'
path: ./Rules/Media/Youku
interval: 86400
WeTV:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/WeTV.yaml'
path: ./Rules/Media/WeTV
interval: 86400
ABC:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/ABC.yaml'
path: ./Rules/Media/ABC
interval: 86400
Abema TV:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Abema%20TV.yaml'
path: ./Rules/Media/Abema_TV
interval: 86400
Amazon:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Amazon.yaml'
path: ./Rules/Media/Amazon
interval: 86400
Apple Music:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Apple%20Music.yaml'
path: ./Rules/Media/Apple_Music
interval: 86400
Apple News:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Apple%20News.yaml'
path: ./Rules/Media/Apple_News
interval: 86400
Apple TV:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Apple%20TV.yaml'
path: ./Rules/Media/Apple_TV
interval: 86400
Bahamut:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Bahamut.yaml'
path: ./Rules/Media/Bahamut
interval: 86400
BBC iPlayer:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/BBC%20iPlayer.yaml'
path: ./Rules/Media/BBC_iPlayer
interval: 86400
DAZN:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/DAZN.yaml'
path: ./Rules/Media/DAZN
interval: 86400
Discovery Plus:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Discovery%20Plus.yaml'
path: ./Rules/Media/Discovery_Plus
interval: 86400
Disney Plus:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Disney%20Plus.yaml'
path: ./Rules/Media/Disney_Plus
interval: 86400
DMM:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/DMM.yaml'
path: ./Rules/Media/DMM
interval: 86400
encoreTVB:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/encoreTVB.yaml'
path: ./Rules/Media/encoreTVB
interval: 86400
F1 TV:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/F1%20TV.yaml'
path: ./Rules/Media/F1_TV
interval: 86400
Fox Now:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Fox%20Now.yaml'
path: ./Rules/Media/Fox_Now
interval: 86400
Fox+:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Fox%2B.yaml'
path: ./Rules/Media/Fox+
interval: 86400
Hulu Japan:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Hulu%20Japan.yaml'
path: ./Rules/Media/Hulu_Japan
interval: 86400
Hulu:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Hulu.yaml'
path: ./Rules/Media/Hulu
interval: 86400
Japonx:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Japonx.yaml'
path: ./Rules/Media/Japonx
interval: 86400
JOOX:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/JOOX.yaml'
path: ./Rules/Media/JOOX
interval: 86400
KKBOX:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/KKBOX.yaml'
path: ./Rules/Media/KKBOX
interval: 86400
KKTV:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/KKTV.yaml'
path: ./Rules/Media/KKTV
interval: 86400
Line TV:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Line%20TV.yaml'
path: ./Rules/Media/Line_TV
interval: 86400
myTV SUPER:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/myTV%20SUPER.yaml'
path: ./Rules/Media/myTV_SUPER
interval: 86400
Niconico:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Niconico.yaml'
path: ./Rules/Media/Niconico
interval: 86400
Pandora:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Pandora.yaml'
path: ./Rules/Media/Pandora
interval: 86400
PBS:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/PBS.yaml'
path: ./Rules/Media/PBS
interval: 86400
Pornhub:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Pornhub.yaml'
path: ./Rules/Media/Pornhub
interval: 86400
Soundcloud:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Soundcloud.yaml'
path: ./Rules/Media/Soundcloud
interval: 86400
ViuTV:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/ViuTV.yaml'
path: ./Rules/Media/ViuTV
interval: 86400
Telegram:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Telegram.yaml'
path: ./Rules/Telegram
interval: 86400
Crypto:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Crypto.yaml'
path: ./Rules/Crypto
interval: 86400
Discord:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Discord.yaml'
path: ./Rules/Discord
interval: 86400
Steam:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Steam.yaml'
path: ./Rules/Steam
interval: 86400
TikTok:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/TikTok.yaml'
path: ./Rules/TikTok
interval: 86400
Speedtest:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Speedtest.yaml'
path: ./Rules/Speedtest
interval: 86400
PayPal:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/PayPal.yaml'
path: ./Rules/PayPal
interval: 86400
Microsoft:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Microsoft.yaml'
path: ./Rules/Microsoft
interval: 86400
AI Suite:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/AI%20Suite.yaml'
path: ./Rules/AI Suite
interval: 86400
Apple:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Apple.yaml'
path: ./Rules/Apple
interval: 86400
Google FCM:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Google%20FCM.yaml'
path: ./Rules/Google FCM
interval: 86400
Scholar:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Scholar.yaml'
path: ./Rules/Scholar
interval: 86400
miHoYo:
type: http
behavior: classical
url: 'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/miHoYo.yaml'
path: ./Rules/miHoYo
interval: 86400