|
|
|
- RULE-SET,Reject,AdBlock
|
|
|
|
- RULE-SET,Special,DIRECT
|
|
|
|
|
|
|
|
- RULE-SET,Netflix,Netflix
|
|
|
|
- RULE-SET,Spotify,Spotify
|
|
|
|
|
|
|
|
# - RULE-SET,YouTube Music,YouTube
|
|
|
|
- RULE-SET,YouTube,YouTube
|
|
|
|
|
|
|
|
- RULE-SET,Bilibili,AsianTV
|
|
|
|
- RULE-SET,iQiyi,AsianTV
|
|
|
|
- RULE-SET,Letv,AsianTV
|
|
|
|
# - RULE-SET,MOO,AsianTV
|
|
|
|
- RULE-SET,Netease Music,AsianTV
|
|
|
|
- RULE-SET,Tencent Video,AsianTV
|
|
|
|
- RULE-SET,Youku,AsianTV
|
|
|
|
|
|
|
|
- RULE-SET,ABC,GlobalTV
|
|
|
|
- RULE-SET,Abema TV,GlobalTV
|
|
|
|
- RULE-SET,Amazon,GlobalTV
|
|
|
|
- RULE-SET,Apple News,GlobalTV
|
|
|
|
- RULE-SET,Apple TV,GlobalTV
|
|
|
|
- RULE-SET,Bahamut,GlobalTV
|
|
|
|
- RULE-SET,BBC iPlayer,GlobalTV
|
|
|
|
- RULE-SET,DAZN,GlobalTV
|
|
|
|
- RULE-SET,Disney Plus,GlobalTV
|
|
|
|
- RULE-SET,encoreTVB,GlobalTV
|
|
|
|
- RULE-SET,Fox Now,GlobalTV
|
|
|
|
- RULE-SET,Fox+,GlobalTV
|
|
|
|
- RULE-SET,HBO,GlobalTV
|
|
|
|
- RULE-SET,Hulu Japan,GlobalTV
|
|
|
|
- RULE-SET,Hulu,GlobalTV
|
|
|
|
- RULE-SET,Japonx,GlobalTV
|
|
|
|
- RULE-SET,JOOX,GlobalTV
|
|
|
|
- RULE-SET,KKBOX,GlobalTV
|
|
|
|
- RULE-SET,KKTV,GlobalTV
|
|
|
|
- RULE-SET,Line TV,GlobalTV
|
|
|
|
- RULE-SET,myTV SUPER,GlobalTV
|
|
|
|
- RULE-SET,Pandora,GlobalTV
|
|
|
|
- RULE-SET,PBS,GlobalTV
|
|
|
|
- RULE-SET,Pornhub,GlobalTV
|
|
|
|
- RULE-SET,Soundcloud,GlobalTV
|
|
|
|
- RULE-SET,ViuTV,GlobalTV
|
|
|
|
|
|
|
|
- RULE-SET,Telegram,Telegram
|
|
|
|
- RULE-SET,Steam,Steam
|
|
|
|
- RULE-SET,Speedtest,Speedtest
|
|
|
|
- RULE-SET,PayPal,PayPal
|
|
|
|
- RULE-SET,Microsoft,Microsoft
|
|
|
|
|
|
|
|
- RULE-SET,PROXY,Proxy
|
|
|
|
|
|
|
|
- RULE-SET,Apple,Apple
|
|
|
|
|
|
|
|
- RULE-SET,Domestic,Domestic
|
|
|
|
- RULE-SET,Domestic IPs,Domestic
|
|
|
|
|
|
|
|
- GEOIP,CN,Domestic
|
|
|
|
- MATCH,Others
|
|
|
|
|
|
|
|
script:
|
|
|
|
code: |
|
|
|
|
def main(ctx, metadata):
|
|
|
|
port_list = [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
|
|
|
|
ruleset_action = {"Reject": "AdBlock",
|
|
|
|
"Special": "DIRECT",
|
|
|
|
"Netflix": "Netflix",
|
|
|
|
"Spotify": "Spotify",
|
|
|
|
"YouTube": "YouTube",
|
|
|
|
"Bilibili": "AsianTV",
|
|
|
|
"iQiyi": "AsianTV",
|
|
|
|
"Letv": "AsianTV",
|
|
|
|
"Netease Music": "AsianTV",
|
|
|
|
"Tencent Video": "AsianTV",
|
|
|
|
"Youku": "AsianTV",
|
|
|
|
"ABC": "GlobalTV",
|
|
|
|
"Abema TV": "GlobalTV",
|
|
|
|
"Amazon": "GlobalTV",
|
|
|
|
"Apple News": "GlobalTV",
|
|
|
|
"Apple TV": "GlobalTV",
|
|
|
|
"Bahamut": "GlobalTV",
|
|
|
|
"BBC iPlayer": "GlobalTV",
|
|
|
|
"DAZN": "GlobalTV",
|
|
|
|
"Disney Plus": "GlobalTV",
|
|
|
|
"encoreTVB": "GlobalTV",
|
|
|
|
"Fox Now": "GlobalTV",
|
|
|
|
"Fox+": "GlobalTV",
|
|
|
|
"HBO": "GlobalTV",
|
|
|
|
"Hulu Japan": "GlobalTV",
|
|
|
|
"Hulu": "GlobalTV",
|
|
|
|
"Japonx": "GlobalTV",
|
|
|
|
"JOOX": "GlobalTV",
|
|
|
|
"KKBOX": "GlobalTV",
|
|
|
|
"KKTV": "GlobalTV",
|
|
|
|
"Line TV": "GlobalTV",
|
|
|
|
"myTV SUPER": "GlobalTV",
|
|
|
|
"Pandora": "GlobalTV",
|
|
|
|
"PBS": "GlobalTV",
|
|
|
|
"Pornhub": "GlobalTV",
|
|
|
|
"Soundcloud": "GlobalTV",
|
|
|
|
"ViuTV": "GlobalTV",
|
|
|
|
"Telegram": "Telegram",
|
|
|
|
"Steam": "Steam",
|
|
|
|
"Speedtest": "Speedtest",
|
|
|
|
"PayPal": "PayPal",
|
|
|
|
"Microsoft": "Microsoft",
|
|
|
|
"PROXY": "Proxy",
|
|
|
|
"Apple": "Apple",
|
|
|
|
"Domestic": "Domestic",
|
|
|
|
"Domestic IPs": "Domestic"
|
|
|
|
}
|
|
|
|
port = int(metadata["dst_port"])
|
|
|
|
|
|
|
|
if port not in port_list:
|
|
|
|
return "DIRECT"
|
|
|
|
|
|
|
|
for rule_name in ctx.rule_providers.keys():
|
|
|
|
if ctx.rule_providers[rule_name].match(metadata):
|
|
|
|
return ruleset_action[rule_name]
|
|
|
|
|
|
|
|
ip = metadata["dst_ip"] or ctx.resolve_ip(metadata["host"])
|
|
|
|
|
|
|
|
if ip == "":
|
|
|
|
return "DIRECT"
|
|
|
|
|
|
|
|
code = ctx.geoip(ip)
|
|
|
|
if code == "LAN":
|
|
|
|
return "DIRECT"
|
|
|
|
|
|
|
|
if code == "CN":
|
|
|
|
return "Domestic"
|
|
|
|
|
|
|
|
return "Others"
|
|
|
|
|
|
|
|
rule-providers:
|
|
|
|
Reject:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Reject.yaml'
|
|
|
|
path: ./Rules/Reject
|
|
|
|
interval: 86400
|
|
|
|
Special:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Special.yaml'
|
|
|
|
path: ./Rules/Special
|
|
|
|
interval: 86400
|
|
|
|
Netflix:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Netflix.yaml'
|
|
|
|
path: ./Rules/Media/Netflix
|
|
|
|
interval: 86400
|
|
|
|
Spotify:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Spotify.yaml'
|
|
|
|
path: ./Rules/Media/Spotify
|
|
|
|
interval: 86400
|
|
|
|
# YouTube Music:
|
|
|
|
# type: http
|
|
|
|
# behavior: classical
|
|
|
|
# url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/YouTube%20Music.yaml'
|
|
|
|
# path: ./Rules/Media/YouTube_Music
|
|
|
|
# interval: 86400
|
|
|
|
YouTube:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/YouTube.yaml'
|
|
|
|
path: ./Rules/Media/YouTube
|
|
|
|
interval: 86400
|
|
|
|
Bilibili:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Bilibili.yaml'
|
|
|
|
path: ./Rules/Media/Bilibili
|
|
|
|
interval: 86400
|
|
|
|
iQiyi:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/iQiyi.yaml'
|
|
|
|
path: ./Rules/Media/iQiyi
|
|
|
|
interval: 86400
|
|
|
|
Letv:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Letv.yaml'
|
|
|
|
path: ./Rules/Media/Letv
|
|
|
|
interval: 86400
|
|
|
|
# MOO:
|
|
|
|
# type: http
|
|
|
|
# behavior: classical
|
|
|
|
# url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/MOO.yaml'
|
|
|
|
# path: ./Rules/Media/MOO
|
|
|
|
# interval: 86400
|
|
|
|
Netease Music:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Netease%20Music.yaml'
|
|
|
|
path: ./Rules/Media/Netease_Music
|
|
|
|
interval: 86400
|
|
|
|
Tencent Video:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Tencent%20Video.yaml'
|
|
|
|
path: ./Rules/Media/Tencent_Video
|
|
|
|
interval: 86400
|
|
|
|
Youku:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Youku.yaml'
|
|
|
|
path: ./Rules/Media/Youku
|
|
|
|
interval: 86400
|
|
|
|
ABC:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/ABC.yaml'
|
|
|
|
path: ./Rules/Media/ABC
|
|
|
|
interval: 86400
|
|
|
|
Abema TV:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Abema%20TV.yaml'
|
|
|
|
path: ./Rules/Media/Abema_TV
|
|
|
|
interval: 86400
|
|
|
|
Amazon:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Amazon.yaml'
|
|
|
|
path: ./Rules/Media/Amazon
|
|
|
|
interval: 86400
|
|
|
|
Apple News:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Apple%20News.yaml'
|
|
|
|
path: ./Rules/Media/Apple_News
|
|
|
|
interval: 86400
|
|
|
|
Apple TV:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Apple%20TV.yaml'
|
|
|
|
path: ./Rules/Media/Apple_TV
|
|
|
|
interval: 86400
|
|
|
|
Bahamut:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Bahamut.yaml'
|
|
|
|
path: ./Rules/Media/Bahamut
|
|
|
|
interval: 86400
|
|
|
|
BBC iPlayer:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/BBC%20iPlayer.yaml'
|
|
|
|
path: ./Rules/Media/BBC_iPlayer
|
|
|
|
interval: 86400
|
|
|
|
DAZN:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/DAZN.yaml'
|
|
|
|
path: ./Rules/Media/DAZN
|
|
|
|
interval: 86400
|
|
|
|
Disney Plus:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Disney%20Plus.yaml'
|
|
|
|
path: ./Rules/Media/Disney_Plus
|
|
|
|
interval: 86400
|
|
|
|
encoreTVB:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/encoreTVB.yaml'
|
|
|
|
path: ./Rules/Media/encoreTVB
|
|
|
|
interval: 86400
|
|
|
|
Fox Now:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Fox%20Now.yaml'
|
|
|
|
path: ./Rules/Media/Fox_Now
|
|
|
|
interval: 86400
|
|
|
|
Fox+:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Fox%2B.yaml'
|
|
|
|
path: ./Rules/Media/Fox+
|
|
|
|
interval: 86400
|
|
|
|
HBO:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/HBO.yaml'
|
|
|
|
path: ./Rules/Media/HBO
|
|
|
|
interval: 86400
|
|
|
|
Hulu Japan:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Hulu%20Japan.yaml'
|
|
|
|
path: ./Rules/Media/Hulu_Japan
|
|
|
|
interval: 86400
|
|
|
|
Hulu:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Hulu.yaml'
|
|
|
|
path: ./Rules/Media/Hulu
|
|
|
|
interval: 86400
|
|
|
|
Japonx:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Japonx.yaml'
|
|
|
|
path: ./Rules/Media/Japonx
|
|
|
|
interval: 86400
|
|
|
|
JOOX:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/JOOX.yaml'
|
|
|
|
path: ./Rules/Media/JOOX
|
|
|
|
interval: 86400
|
|
|
|
KKBOX:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/KKBOX.yaml'
|
|
|
|
path: ./Rules/Media/KKBOX
|
|
|
|
interval: 86400
|
|
|
|
KKTV:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/KKTV.yaml'
|
|
|
|
path: ./Rules/Media/KKTV
|
|
|
|
interval: 86400
|
|
|
|
Line TV:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Line%20TV.yaml'
|
|
|
|
path: ./Rules/Media/Line_TV
|
|
|
|
interval: 86400
|
|
|
|
myTV SUPER:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/myTV%20SUPER.yaml'
|
|
|
|
path: ./Rules/Media/myTV_SUPER
|
|
|
|
interval: 86400
|
|
|
|
Pandora:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Pandora.yaml'
|
|
|
|
path: ./Rules/Media/Pandora
|
|
|
|
interval: 86400
|
|
|
|
PBS:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/PBS.yaml'
|
|
|
|
path: ./Rules/Media/PBS
|
|
|
|
interval: 86400
|
|
|
|
Pornhub:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Pornhub.yaml'
|
|
|
|
path: ./Rules/Media/Pornhub
|
|
|
|
interval: 86400
|
|
|
|
Soundcloud:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Soundcloud.yaml'
|
|
|
|
path: ./Rules/Media/Soundcloud
|
|
|
|
interval: 86400
|
|
|
|
ViuTV:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/ViuTV.yaml'
|
|
|
|
path: ./Rules/Media/ViuTV
|
|
|
|
interval: 86400
|
|
|
|
Telegram:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Telegram.yaml'
|
|
|
|
path: ./Rules/Telegram
|
|
|
|
interval: 86400
|
|
|
|
Steam:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Steam.yaml'
|
|
|
|
path: ./Rules/Steam
|
|
|
|
interval: 86400
|
|
|
|
Speedtest:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Speedtest.yaml'
|
|
|
|
path: ./Rules/Speedtest
|
|
|
|
interval: 86400
|
|
|
|
PayPal:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/PayPal.yaml'
|
|
|
|
path: ./Rules/PayPal
|
|
|
|
interval: 86400
|
|
|
|
Microsoft:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Microsoft.yaml'
|
|
|
|
path: ./Rules/Microsoft
|
|
|
|
interval: 86400
|
|
|
|
PROXY:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Proxy.yaml'
|
|
|
|
path: ./Rules/Proxy
|
|
|
|
interval: 86400
|
|
|
|
Domestic:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Domestic.yaml'
|
|
|
|
path: ./Rules/Domestic
|
|
|
|
interval: 86400
|
|
|
|
Apple:
|
|
|
|
type: http
|
|
|
|
behavior: classical
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Apple.yaml'
|
|
|
|
path: ./Rules/Apple
|
|
|
|
interval: 86400
|
|
|
|
Domestic IPs:
|
|
|
|
type: http
|
|
|
|
behavior: ipcidr
|
|
|
|
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Domestic%20IPs.yaml'
|
|
|
|
path: ./Rules/Domestic_IPs
|
|
|
|
interval: 86400
|