#---------------------------------------------------#
## https://wiki.metacubex.one/config/proxies/transport/#h2-opts
#---------------------------------------------------#

# (HTTP and SOCKS5 in one port)
mixed-port: 7777
# 是否允许局域网中其他机器访问
allow-lan: true
keep-alive-interval: 15
keep-alive-idle: 15

# RESTful API for clash
external-controller: 127.0.0.1:9090
mode: rule

proxies:
  - name: "n-hk"
    icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Hong_Kong.png
    type: "ss"
    server: "n-hk.haku.hk"
    port: 8443
    cipher: "aes-256-cfb"
    password: "zxcasdqwe!"
  - name: "n-hk-temp"
    icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Hong_Kong.png
    type: "ss"
    server: "149.104.8.74"
    port: 443
    cipher: "aes-256-cfb"
    password: "zxcasdqwe!"
  - name: "n-jp"
    icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Japan.png
    type: "ss"
    server: "n-jp.haku.hk"
    port: 8443
    cipher: "aes-256-cfb"
    password: "zxcasdqwe!"
  - name: vmess-hk
    icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Hong_Kong.png
    type: vmess
    server: 103.244.91.47
    port: 5443
    cipher: auto
    uuid: 8f9c422d-ba80-4fd5-a35b-397dd75468aa
    alterId: 0
    network: ws
    tls: true
    servername: n-hk.haku.hk
    skip-cert-verify: true
    ws-opts:
      path: "/test"
      headers:
        Host: n-hk.haku.hk
  - name: vmess-jp
    icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Japan.png
    type: vmess
    server: 103.56.55.76
    port: 5443
    cipher: auto
    uuid: a254cddd-a381-4cb1-bf0e-0a3a35550c8e
    alterId: 0
    network: ws
    tls: true
    servername: n-jp.haku.hk
    skip-cert-verify: true
    ws-opts:
      path: "/test"
      headers:
        Host: n-jp.haku.hk

proxy-groups:
- type: url-test
  name: FAST-ALL
  interval: 60
  timeout: 5000
  max-failed-times: 5
  lazy: true
  proxies:
  - n-jp
  - n-hk
  - n-hk-temp
- type: url-test
  name: FAST-JP
  interval: 60
  timeout: 5000
  max-failed-times: 5
  lazy: true
  proxies:
  - n-jp
- type: url-test
  name: FAST-HK
  interval: 60
  timeout: 5000
  max-failed-times: 5
  lazy: true
  proxies:
  - n-hk
  - n-hk-temp

rule-providers:
  global:
    type: http
    behavior: domain
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt
    path: "./rule_provider/global.yaml"
    interval: 86400
  AppleCN:
    type: http
    behavior: classical
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt
    path: "./rule_provider/AppleCN.yaml"
    interval: 86400
  TELE:
    type: http
    behavior: ipcidr
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt
    path: "./rule_provider/telegram.yaml"
    interval: 86400
  LAN:
    type: http
    behavior: ipcidr
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt
    path: "./rule_provider/lan.yaml"
    interval: 86400
    
rules:
  - DOMAIN-KEYWORD,google,FAST-JP
  - DOMAIN-KEYWORD,gstatic,FAST-JP
  - DOMAIN-KEYWORD,appspot.com,FAST-JP
  - DOMAIN-KEYWORD,cursor,FAST-JP
  - DOMAIN-KEYWORD,nvidia,FAST-JP # TV download
  - DOMAIN-KEYWORD,gvt,FAST-JP # TV play download
  - DOMAIN-KEYWORD,azure.com,FAST-JP
  - DOMAIN-KEYWORD,nintendo,FAST-JP
  - DOMAIN-KEYWORD,openai.com,FAST-JP
  - DOMAIN-KEYWORD,claude.ai,FAST-JP
  - DOMAIN-KEYWORD,github,FAST-HK
  - DOMAIN-KEYWORD,.apache.org,FAST-HK
  - DOMAIN-KEYWORD,docker.com,FAST-HK
  - DOMAIN-KEYWORD,telegram,FAST-HK
  - RULE-SET,TELE,FAST-HK
  - RULE-SET,AppleCN,DIRECT
  - RULE-SET,LAN,DIRECT
  - IP-CIDR,127.0.0.0/8,DIRECT
  - RULE-SET,global,FAST-ALL
  - GEOIP,USA,FAST-JP
  - GEOIP,JP,FAST-JP
  - GEOIP,CN,DIRECT
  - MATCH,DIRECT

listeners:
- name: auto-port
  type: mixed
  port: 7777
  listen: 0.0.0.0
- name: HK
  type: mixed
  port: 7071
  listen: 0.0.0.0
  proxy: FAST-HK
- name: JP
  type: mixed
  port: 7072
  listen: 0.0.0.0
  proxy: FAST-JP