port: 7890 socks-port: 7891 redir-port: 7892 mixed-port: 7893 allow-lan: false mode: rule log-level: info ipv6: true external-controller: 0.0.0.0:9090 clash-for-android: append-system-dns: false profile: tracing: true experimental: sniff-tls-sni: true dns: enable: true listen: 127.0.0.1:8853 default-nameserver: - 223.5.5.5 - 8.8.4.4 ipv6: false enhanced-mode: fake-ip nameserver: - 119.29.29.29 - 223.5.5.5 - tls://223.5.5.5:853 - tls://223.6.6.6:853 - tls://120.53.53.53 - tls://1.12.12.12 fallback: - https://1.0.0.1/dns-query - https://public.dns.iij.jp/dns-query - tls://8.8.4.4:853 fallback-filter: geoip: false ipcidr: - 240.0.0.0/4 - 0.0.0.0/32 - 127.0.0.1/32 fake-ip-filter: - "*.lan" - "*.localdomain" - "*.example" - "*.invalid" - "*.localhost" - "*.test" - "*.local" - "*.dev" - "+.heiyu.space" - "+.lazycat.cloud" always-real-ip: # Clash Meta 专用 - "+.heiyu.space" - "+.lazycat.cloud" tun: enable: true stack: system auto-route: true auto-detect-interface: true route-exclude-address: - 6.6.6.6/32 - 2000::6666/128 proxy-providers: substore: type: http path: ./profiles/substore.yaml url: https://ss.xllsy.com/download/collection/Self-Subscribe?includeUnsupportedProxy=true&noCache=true interval: 300 health-check: enable: false url: http://www.gstatic.com/generate_204 interval: 300 proxy-groups: - name: Proxy type: select use: - substore proxies: - DIRECT - { name: i4store, type: select, proxies: [DIRECT, Proxy], use: ['substore'] } - { name: Domestic, type: select, proxies: [DIRECT, Proxy] } - { name: Others, type: select, proxies: [DIRECT, Proxy] } - { name: AdBlock, type: select, proxies: [REJECT, DIRECT, Proxy] } - { name: HTTPDNS, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Netflix, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Disney, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: YouTube, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Max, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Spotify, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: 'CN Mainland TV', type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: 'Asian TV', type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: 'Global TV', type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Apple, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: 'Apple TV', type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Telegram, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: 'Google FCM', type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Crypto, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Discord, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Microsoft, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: 'AI Suite', type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: PayPal, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Scholar, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Speedtest, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: Steam, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: TikTok, type: select, proxies: [DIRECT, REJECT, Proxy] } - { name: miHoYo, type: select, proxies: [DIRECT, REJECT, Proxy] } rules: - 'IP-CIDR6,fc03:1136:3800::/40,DIRECT' - 'DOMAIN-SUFFIX,heiyu.space,DIRECT' - 'DOMAIN-SUFFIX,lazycat.cloud,DIRECT' - 'RULE-SET,i4store,i4store' - 'RULE-SET,AdBlock,AdBlock' - 'RULE-SET,HTTPDNS,HTTPDNS' - 'RULE-SET,Special,DIRECT' - 'RULE-SET,Netflix,Netflix' - 'RULE-SET,Disney Plus,Disney' - 'RULE-SET,YouTube,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,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,Apple Music,Apple TV' - 'RULE-SET,Apple News,Apple TV' - 'RULE-SET,Apple TV,Apple TV' - 'RULE-SET,Apple,Apple' - '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,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):\n ruleset_action = {\n 'AdBlock': 'AdBlock',\n 'HTTPDNS': 'HTTPDNS',\n 'Special': 'DIRECT',\n 'Netflix': 'Netflix',\n 'Disney Plus': 'Disney',\n 'YouTube': 'YouTube',\n 'Max': 'Max',\n 'Spotify': 'Spotify',\n 'Bilibili': 'CN Mainland TV',\n 'IQ': 'CN Mainland TV',\n 'IQIYI': 'CN Mainland TV',\n 'Letv': 'CN Mainland TV',\n 'Netease Music': 'CN Mainland TV',\n 'Tencent Video': 'CN Mainland TV',\n 'Youku': 'CN Mainland TV',\n 'WeTV': 'CN Mainland TV',\n 'Abema TV': 'Asian TV',\n 'Bahamut': 'Asian TV',\n 'Fox+': 'Asian TV',\n 'Hulu Japan': 'Asian TV',\n 'Japonx': 'Asian TV',\n 'JOOX': 'Asian TV',\n 'KKBOX': 'Asian TV',\n 'KKTV': 'Asian TV',\n 'Line TV': 'Asian TV',\n 'myTV SUPER': 'Asian TV',\n 'Niconico': 'Asian TV',\n 'ViuTV': 'Asian TV',\n 'ABC': 'Global TV',\n 'Amazon': 'Global TV',\n 'BBC iPlayer': 'Global TV',\n 'DAZN': 'Global TV',\n 'Discovery Plus': 'Global TV',\n 'encoreTVB': 'Global TV',\n 'F1 TV': 'Global TV',\n 'Fox Now': 'Global TV',\n 'Hulu': 'Global TV',\n 'Pandora': 'Global TV',\n 'PBS': 'Global TV',\n 'Pornhub': 'Global TV',\n 'Soundcloud': 'Global TV',\n 'Apple Music': 'Apple TV',\n 'Apple News': 'Apple TV',\n 'Apple TV': 'Apple TV',\n 'Apple': 'Apple',\n 'Telegram': 'Telegram',\n 'Crypto': 'Crypto',\n 'Discord': 'Discord',\n 'Google FCM': 'Google FCM',\n 'Microsoft': 'Microsoft',\n 'AI Suite': 'AI Suite',\n 'PayPal': 'PayPal',\n 'Scholar': 'Scholar',\n 'Speedtest': 'Speedtest',\n 'Steam': 'Steam',\n 'TikTok': 'TikTok',\n 'miHoYo': 'miHoYo',\n 'PROXY': 'Proxy',\n 'Domestic': 'Domestic',\n 'Domestic IPs': 'Domestic',\n 'LAN': 'DIRECT'\n }\n\n port = int(metadata['dst_port'])\n\n if metadata['network'] == 'UDP' and port == 443:\n ctx.log('[Script] matched QUIC traffic use reject')\n return 'REJECT'\n\n 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]\n if port not in port_list:\n ctx.log('[Script] not common port use direct')\n return 'DIRECT'\n\n if metadata['dst_ip'] == '':\n metadata['dst_ip'] = ctx.resolve_ip(metadata['host'])\n\n for ruleset in ruleset_action:\n if ctx.rule_providers[ruleset].match(metadata):\n return ruleset_action[ruleset]\n\n if metadata['dst_ip'] != '':\n code = ctx.geoip(metadata['dst_ip'])\n if code == 'CN':\n ctx.log('[Script] Geoip CN')\n return 'Domestic'\n\n ctx.log('[Script] FINAL')\n return 'Others'\n" rule-providers: i4store: { type: http, behavior: classical, url: 'https://raw.githubusercontent.com/xuewlcn/gfw-rule/refs/heads/main/rule/customize.yaml', path: ./Rules/Customize, interval: 86400 } AdBlock: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/AdBlock.yaml', path: ./Rules/AdBlock, interval: 86400 } HTTPDNS: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/HTTPDNS.yaml', path: ./Rules/HTTPDNS, interval: 86400 } Special: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Special.yaml', path: ./Rules/Special, interval: 86400 } PROXY: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Proxy.yaml', path: ./Rules/Proxy, interval: 86400 } Domestic: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Domestic.yaml', path: ./Rules/Domestic, interval: 86400 } 'Domestic IPs': { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Domestic%20IPs.yaml', path: ./Rules/Domestic_IPs, interval: 86400 } LAN: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/LAN.yaml', path: ./Rules/LAN, interval: 86400 } Netflix: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Netflix.yaml', path: ./Rules/Media/Netflix, interval: 86400 } Spotify: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Spotify.yaml', path: ./Rules/Media/Spotify, interval: 86400 } YouTube: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/YouTube.yaml', path: ./Rules/Media/YouTube, interval: 86400 } Max: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Max.yaml', path: ./Rules/Media/Max, interval: 86400 } Bilibili: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Bilibili.yaml', path: ./Rules/Media/Bilibili, interval: 86400 } IQ: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/IQ.yaml', path: ./Rules/Media/IQI, interval: 86400 } IQIYI: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/IQIYI.yaml', path: ./Rules/Media/IQYI, interval: 86400 } Letv: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Letv.yaml', path: ./Rules/Media/Letv, interval: 86400 } 'Netease Music': { type: http, behavior: classical, url: 'https://raw.dler.io/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://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Tencent%20Video.yaml', path: ./Rules/Media/Tencent_Video, interval: 86400 } Youku: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Youku.yaml', path: ./Rules/Media/Youku, interval: 86400 } WeTV: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/WeTV.yaml', path: ./Rules/Media/WeTV, interval: 86400 } ABC: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/ABC.yaml', path: ./Rules/Media/ABC, interval: 86400 } 'Abema TV': { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Abema%20TV.yaml', path: ./Rules/Media/Abema_TV, interval: 86400 } Amazon: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Amazon.yaml', path: ./Rules/Media/Amazon, interval: 86400 } 'Apple Music': { type: http, behavior: classical, url: 'https://raw.dler.io/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://raw.dler.io/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://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Apple%20TV.yaml', path: ./Rules/Media/Apple_TV, interval: 86400 } Bahamut: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Bahamut.yaml', path: ./Rules/Media/Bahamut, interval: 86400 } 'BBC iPlayer': { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/BBC%20iPlayer.yaml', path: ./Rules/Media/BBC_iPlayer, interval: 86400 } DAZN: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/DAZN.yaml', path: ./Rules/Media/DAZN, interval: 86400 } 'Discovery Plus': { type: http, behavior: classical, url: 'https://raw.dler.io/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://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Disney%20Plus.yaml', path: ./Rules/Media/Disney_Plus, interval: 86400 } encoreTVB: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/encoreTVB.yaml', path: ./Rules/Media/encoreTVB, interval: 86400 } 'F1 TV': { type: http, behavior: classical, url: 'https://raw.dler.io/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://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Fox%20Now.yaml', path: ./Rules/Media/Fox_Now, interval: 86400 } Fox+: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Fox%2B.yaml', path: ./Rules/Media/Fox+, interval: 86400 } 'Hulu Japan': { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Hulu%20Japan.yaml', path: ./Rules/Media/Hulu_Japan, interval: 86400 } Hulu: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Hulu.yaml', path: ./Rules/Media/Hulu, interval: 86400 } Japonx: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Japonx.yaml', path: ./Rules/Media/Japonx, interval: 86400 } JOOX: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/JOOX.yaml', path: ./Rules/Media/JOOX, interval: 86400 } KKBOX: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/KKBOX.yaml', path: ./Rules/Media/KKBOX, interval: 86400 } KKTV: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/KKTV.yaml', path: ./Rules/Media/KKTV, interval: 86400 } 'Line TV': { type: http, behavior: classical, url: 'https://raw.dler.io/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://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/myTV%20SUPER.yaml', path: ./Rules/Media/myTV_SUPER, interval: 86400 } Niconico: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Niconico.yaml', path: ./Rules/Media/Niconico, interval: 86400 } Pandora: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Pandora.yaml', path: ./Rules/Media/Pandora, interval: 86400 } PBS: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/PBS.yaml', path: ./Rules/Media/PBS, interval: 86400 } Pornhub: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Pornhub.yaml', path: ./Rules/Media/Pornhub, interval: 86400 } Soundcloud: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/Soundcloud.yaml', path: ./Rules/Media/Soundcloud, interval: 86400 } ViuTV: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Media/ViuTV.yaml', path: ./Rules/Media/ViuTV, interval: 86400 } Telegram: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Telegram.yaml', path: ./Rules/Telegram, interval: 86400 } Crypto: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Crypto.yaml', path: ./Rules/Crypto, interval: 86400 } Discord: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Discord.yaml', path: ./Rules/Discord, interval: 86400 } Steam: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Steam.yaml', path: ./Rules/Steam, interval: 86400 } Speedtest: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Speedtest.yaml', path: ./Rules/Speedtest, interval: 86400 } PayPal: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/PayPal.yaml', path: ./Rules/PayPal, interval: 86400 } Microsoft: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Microsoft.yaml', path: ./Rules/Microsoft, interval: 86400 } 'AI Suite': { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/AI%20Suite.yaml', path: './Rules/AI Suite', interval: 86400 } Apple: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Apple.yaml', path: ./Rules/Apple, interval: 86400 } 'Google FCM': { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Google%20FCM.yaml', path: './Rules/Google FCM', interval: 86400 } Scholar: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/Scholar.yaml', path: ./Rules/Scholar, interval: 86400 } miHoYo: { type: http, behavior: classical, url: 'https://raw.dler.io/dler-io/Rules/main/Clash/Provider/miHoYo.yaml', path: ./Rules/miHoYo, interval: 86400 }