pr:
  &pr {
    type: select,
    proxies:
      [
        节点选择,
        香港,
        台湾,
        日本,
        新加坡,
        美国,
        其它地区,
        全部节点,
        自动选择,
        DIRECT,
      ],
  }
p: &p
  type: http
  interval: 3600
  health-check:
    enable: true
    url: https://cp.cloudflare.com
    interval: 300
    timeout: 1000
    tolerance: 100

use: &use
  # 如果不希望自动切换请将下面两行注释对调
  # type: select
  type: url-test
  use:
    - ✨
proxy-providers:
  ✨:
    <<: *p
    # path: ./proxy_provider/✨.yaml
    url: "https://url.v1.mk/sub?target=clash&url=https%3A%2F%2Fwvsvlees.sosorg.nyc.mn%2Fsub%3Fhost%3Da.arises.dynv6.net%26uuid%3Dba55ef37-c33c-4a8f-aafa-2abc85312863%26path%3D%2F%3Fed%3D2560&insert=false&config=https%3A%2F%2Fraw.githubusercontent.com%2FACL4SSR%2FACL4SSR%2Frefs%2Fheads%2Fmaster%2FClash%2Fconfig%2FACL4SSR_Online_Full.ini&emoji=true&list=false&xudp=false&udp=false&tfo=false&expand=true&scv=false&fdn=false&new_name=true
"
rule-providers:
  AWAvenue-Ads:
    type: http
    behavior: domain
    format: yaml
    path: ./rule_provider/AWAvenue-Ads.yaml
    url: "https://ghp.ci/https://raw.githubusercontent.com/TG-Twilight/AWAvenue-Ads-Rule/refs/heads/main/Filters/AWAvenue-Ads-Rule-Clash.yaml"
    interval: 600

mode: rule
# ipv6 支持
ipv6: true
log-level: info
# 允许局域网连接
allow-lan: true
# socks5/http 端口
mixed-port: 7890
# Meta 内核特性 https://wiki.metacubex.one/config/general
# 统一延迟
# 更换延迟计算方式,去除握手等额外延迟
unified-delay: true
# TCP 并发
# 同时对所有ip进行连接，返回延迟最低的地址
tcp-concurrent: true
# 外部控制端口
external-controller: :9090

geodata-mode: true

geox-url:
  geoip: "https://ghp.ci/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat"
  geosite: "https://ghp.ci/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat"
  mmdb: "https://ghp.ci/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb"

keep-alive-interval: 1800

# 全局客户端指纹
global-client-fingerprint: random # 随机指纹

# 缓存
profile:
  store-selected: true
  store-fake-ip: true

# 自动同步时间以防止时间不准导致无法正常联网
ntp:
  enable: true
  # 是否同步至系统时间，需要 root/管理员权限
  write-to-system: false
  server: time.apple.com
  port: 123
  interval: 30

# 域名嗅探
sniffer:
  enable: true
  sniff:
    TLS:
      ports: [443, 8443]
    HTTP:
      ports: [80, 8080-8880]
      override-destination: true

# tun 模式
tun:
  enable: false  # enable 'true'
  stack: system  # or 'gvisor'
  dns-hijack:
    - "any:53"
    - "tcp://any:53"
  auto-route: true
  auto-detect-interface: true

# dns 设置
# 已配置 ipv6
dns:
  enable: true
  listen: :1053
  ipv6: true
  # 路由器个人建议使用 redir-host 以最佳兼容性
  # 其他设备可以使用 fake-ip
  enhanced-mode: redir-host
  fake-ip-range: 28.0.0.1/8
  fake-ip-filter:
    - '*'
    - '+.lan'
    - '+.local'
  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
    - 114.114.114.114
    - '[2402:4e00::]'
    - '[2400:3200::1]'
  nameserver:
    - 'tls://8.8.4.4#dns'
    - 'tls://1.0.0.1#dns'
    - 'tls://[2001:4860:4860::8844]#dns'
    - 'tls://[2606:4700:4700::1001]#dns'
  proxy-server-nameserver:
    - https://doh.pub/dns-query
  nameserver-policy:
    "geosite:cn,private":
      - https://doh.pub/dns-query
      - https://dns.alidns.com/dns-query
    "geosite:!cn,!private": 
      - "tls://dns.google"
      - "tls://cloudflare-dns.com"


proxies:

proxy-groups:
  - {
      name: 节点选择,
      type: select,
      proxies:
        [全部节点, 自动选择, 香港, 台湾, 日本, 新加坡, 美国, 其它地区, DIRECT],
    }
  - { name: dns, <<: *pr }
  - { name: 广告拦截, type: select, proxies: [REJECT, DIRECT, 节点选择] }
  - { name: 境外AI, <<: *pr }
  # Apple 推荐走全局直连
  - { name: Apple, <<: *pr }
  - { name: Google, <<: *pr }
  - { name: Telegram, <<: *pr }
  - { name: Twitter, <<: *pr }
  - { name: Pixiv, <<: *pr }
  - { name: ehentai, <<: *pr }
# - {name: 哔哩哔哩, <<: *pr}
# - {name: 哔哩东南亚, <<: *pr}
  - { name: 巴哈姆特, <<: *pr }
  - { name: YouTube, <<: *pr }
  - { name: NETFLIX, <<: *pr }
  - { name: TikTok, <<: *pr }
  - { name: Spotify, <<: *pr }
  - { name: Github, <<: *pr }
  - { name: Steam, <<: *pr }
  - { name: OneDrive, <<: *pr }
  - { name: 微软服务, <<: *pr }
  - {
      name: 国内,
      type: select,
      proxies:
        [
          DIRECT,
          节点选择,
          香港,
          台湾,
          日本,
          新加坡,
          美国,
          其它地区,
          全部节点,
          自动选择,
        ],
    }
  - { name: 其他, <<: *pr }

  # 分隔,下面是地区分组
  - { name: 香港, <<: *use, filter: "(?i)港|hk|hongkong|hong kong" }
  - { name: 台湾, <<: *use, filter: "(?i)台|tw|taiwan" }
  - { name: 日本, <<: *use, filter: "(?i)日本|jp|japan" }
  - { name: 美国, <<: *use, filter: "(?i)美|us|unitedstates|united states" }
  - { name: 新加坡, <<: *use, filter: "(?i)(新|sg|singapore)" }
  - {
      name: 其它地区,
      <<: *use,
      filter: "(?i)^(?!.*(?:🇭🇰|🇯🇵|🇺🇸|🇸🇬|🇨🇳|港|hk|hongkong|台|tw|taiwan|日|jp|japan|新|sg|singapore|美|us|unitedstates)).*",
    }
  - { name: 全部节点, <<: *use }
  - { name: 自动选择, <<: *use, tolerance: 2, type: url-test }

rules:
  - RULE-SET,AWAvenue-Ads,广告拦截
# - GEOSITE,biliintl,哔哩东南亚
# - GEOSITE,bilibili,哔哩哔哩

  - GEOSITE,CATEGORY-AI-CHAT-!CN,境外AI
  - GEOSITE,apple,Apple
  - GEOSITE,apple-cn,Apple
  - GEOSITE,ehentai,ehentai
  - GEOSITE,github,Github
  - GEOSITE,twitter,Twitter
  - GEOSITE,youtube,YouTube
  - GEOSITE,google,Google
  - GEOSITE,google-cn,Google # Google CN 不走代理会导致香港等地区节点 Play Store 异常
  - GEOSITE,telegram,Telegram
  - GEOSITE,netflix,NETFLIX
  - GEOSITE,tiktok,TikTok
  - GEOSITE,bahamut,巴哈姆特
  - GEOSITE,spotify,Spotify
  - GEOSITE,pixiv,Pixiv
  - GEOSITE,steam@cn,DIRECT
  - GEOSITE,steam,Steam
  - GEOSITE,onedrive,OneDrive
  - GEOSITE,microsoft,微软服务
  - GEOSITE,geolocation-!cn,其他
# - AND,(AND,(DST-PORT,443),(NETWORK,UDP)),(NOT,((GEOIP,CN))),REJECT # quic
  - GEOIP,google,Google
  - GEOIP,netflix,NETFLIX
  - GEOIP,telegram,Telegram
  - GEOIP,twitter,Twitter
  - GEOSITE,CN,国内
  - GEOIP,CN,国内
  # 绕过局域网地址
  - IP-CIDR,10.0.0.0/8,DIRECT
  - IP-CIDR,172.16.0.0/12,DIRECT
  - IP-CIDR,192.168.0.0/16,DIRECT
  - IP-CIDR,100.64.0.0/10,DIRECT
  - IP-CIDR,127.0.0.0/8,DIRECT
  - MATCH,其他
