SkyBlog

Clash Config

Clash 配置模板,供自购服务器搭建者使用

这篇文章发布于 2023年12月01日,星期五,01:53阅读 ? 次,0 条评论

详细设置说明自行查看文档 clash-verge-rev

mixed-port: 7890
allow-lan: true
bind-address: '*'
ipv6: true
mode: rule
log-level: info
external-controller: 0.0.0.0:9090
 
tun:
  enable: true
  stack: system
  auto-route: true
  auto-redirect: true
  auto-detect-interface: true
  dns-hijack:
    - any:53
    - tcp://any:53
 
sniffer:
  enable: true
  force-dns-mapping: true
  parse-pure-ip: true
  override-destination: true
  sniff:
    TLS:
      ports:
        - 443
    HTTP:
      ports:
        - 80
 
geo-auto-update: true
geo-update-interval: 24
geox-url:
  geoip: 'https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat'
  geosite: 'https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat'
  mmdb: 'https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb'
 
cn-dns: &cn-dns
  - 61.139.2.69
  - 119.6.6.6
  - 223.87.238.22
  - https://223.5.5.5/dns-query#h3=true
  - https://223.6.6.6/dns-query#h3=true
  - https://1.12.12.12/dns-query#h3=true
  - https://120.53.53.53/dns-query#h3=true
 
gfw-dns: &gfw-dns
  - https://8.8.8.8/dns-query#h3=true
  - https://1.1.1.1/dns-query#h3=true
  - https://[2001:4860:4860::64]/dns-query
  - https://[2001:4860:4860::6464]/dns-query
  - https://[2606:4700:4700::1001]/dns-query
  - https://[2606:4700:4700::1111]/dns-query
 
dns:
  enable: true
  ipv6: true
  prefer-h3: true
  listen: 0.0.0.0:1053
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  nameserver: *cn-dns
  nameserver-policy:
    '+.googleapis.cn': *cn-dns
    'geosite:onedrive,microsoft@cn,steam@cn,category-games@cn,cn': *cn-dns
    'rule-set:icloud,apple,google,direct': *cn-dns
    'rule-set:proxy': *gfw-dns
    'geosite:gfw,geolocation-!cn': *gfw-dns
 
proxies:
  - name: Trojan
    type: trojan
    server: <节点地址>
    port: <节点端口>
    password: <节点密码>
    udp: true
 
proxy-groups:
  - name: 手动选择
    type: select
    proxies:
      - Trojan
      - DIRECT
 
rule-providers:
  applications:
    type: http
    behavior: classical
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt'
    path: ./ruleset/applications.yaml
    interval: 86400
  private:
    type: http
    behavior: domain
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt'
    path: ./ruleset/private.yaml
    interval: 86400
  reject:
    type: http
    behavior: domain
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt'
    path: ./ruleset/reject.yaml
    interval: 86400
  icloud:
    type: http
    behavior: domain
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt'
    path: ./ruleset/icloud.yaml
    interval: 86400
  apple:
    type: http
    behavior: domain
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt'
    path: ./ruleset/apple.yaml
    interval: 86400
  google:
    type: http
    behavior: domain
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt'
    path: ./ruleset/google.yaml
    interval: 86400
  proxy:
    type: http
    behavior: domain
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt'
    path: ./ruleset/proxy.yaml
    interval: 86400
  direct:
    type: http
    behavior: domain
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt'
    path: ./ruleset/direct.yaml
    interval: 86400
  lancidr:
    type: http
    behavior: ipcidr
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt'
    path: ./ruleset/lancidr.yaml
    interval: 86400
  cncidr:
    type: http
    behavior: ipcidr
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt'
    path: ./ruleset/cncidr.yaml
    interval: 86400
  telegramcidr:
    type: http
    behavior: ipcidr
    url: 'https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt'
    path: ./ruleset/telegramcidr.yaml
    interval: 86400
 
rules:
  # Google Play Store
  - DOMAIN-SUFFIX,googleapis.cn,DIRECT
  - DOMAIN-SUFFIX,xn--ngstr-lra8j.com,DIRECT
  # qBittorrent Enhanced Edition
  - AND,((PROCESS-NAME,qbittorrent.exe),(IN-TYPE,SOCKS)),手动选择
  # https://github.com/MetaCubeX/meta-rules-dat
  - GEOSITE,category-ads-all,REJECT
  - GEOSITE,onedrive,DIRECT
  - GEOSITE,microsoft@cn,DIRECT
  - GEOSITE,steam@cn,DIRECT
  - GEOSITE,category-games@cn,DIRECT
  - GEOSITE,cn,DIRECT
  # https://github.com/Loyalsoldier/clash-rules
  - RULE-SET,applications,DIRECT
  - RULE-SET,private,DIRECT
  - RULE-SET,reject,REJECT
  - RULE-SET,icloud,DIRECT
  - RULE-SET,apple,DIRECT
  - RULE-SET,google,DIRECT
  - RULE-SET,proxy,手动选择
  - RULE-SET,direct,DIRECT
  - RULE-SET,lancidr,DIRECT
  - RULE-SET,cncidr,DIRECT
  - RULE-SET,telegramcidr,手动选择
  - GEOIP,LAN,DIRECT,no-resolve
  - GEOIP,CN,DIRECT,no-resolve
  - MATCH,手动选择