Skip to content

Instantly share code, notes, and snippets.

@Chenx221
Last active September 1, 2024 04:06
Show Gist options
  • Save Chenx221/e9a93162cd2c83f845e3cf5769f94768 to your computer and use it in GitHub Desktop.
Save Chenx221/e9a93162cd2c83f845e3cf5769f94768 to your computer and use it in GitHub Desktop.
Self-use Clash configuration file
mixed-port: 7890 # HTTP(S) 和 SOCKS 代理混合端口
allow-lan: true # 允许局域网连接
external-controller: 0.0.0.0:9090
geodata-mode: true
geo-auto-update: true # 是否自动更新 geodata
geo-update-interval: 24 # 更新间隔,单位:小时
geox-url:
geoip: "https://git.chenx221.cyou/chenx221/v2ray-rules-dat/raw/branch/release/geoip.dat"
geosite: "https://git.chenx221.cyou/chenx221/v2ray-rules-dat/raw/branch/release/geosite.dat"
mmdb: "https://git.chenx221.cyou/chenx221/meta-rules-dat/raw/branch/release/geoip.metadb"
global-client-fingerprint: chrome # 全局 TLS 指纹
log-level: info # 日志等级 silent/error/warning/info/debug
profile:
store-selected: true # 存储 select 选择记录
store-fake-ip: true # 持久化 fake-ip
sniffer:
enable: false
force-dns-mapping: true
parse-pure-ip: true
override-destination: true
sniff:
TLS:
ports: [443, 8443]
HTTP:
ports: [80, 8080-8880]
override-destination: true
force-domain:
- +.v2ex.com
skip-domain:
- Mijia Cloud
tun: # Tun 配置
enable: true
stack: system # gvisor/mixed
dns-hijack:
- "any:53" # 需要劫持的 DNS
auto-detect-interface: true # 自动识别出口网卡
auto-route: true # 配置路由表
dns: # DNS 配置
cache-algorithm: arc
enable: true
listen: 0.0.0.0:1053 # 开启 DNS 服务器监听
ipv6: true
default-nameserver: # 用于解析 nameserver,fallback 以及其他 DNS 服务器配置的,DNS 服务域名
- 223.5.5.5
- 223.6.6.6
enhanced-mode: fake-ip # or redir-host
fake-ip-range: 28.0.0.1/8 # fake-ip 池设置
fake-ip-filter: # 配置不使用 fake-ip 的域名
- "+.lan"
- '*.msftconnecttest.com'
- localhost.ptlogin2.qq.com
- time.*.com
- time.*.gov
- +.pool.ntp.org
nameserver: # DNS 主要域名配置
- "tls://8.8.4.4#PROXY"
- "tls://1.0.0.1#PROXY"
proxy-server-nameserver: # 专用于节点域名解析的 DNS 服务器
- https://dns.alidns.com/dns-query#h3=true
nameserver-policy: # 配置查询域名使用的 DNS 服务器
"geosite:cn,private,apple":
- 223.5.5.5
- 223.6.6.6
- https://dns.alidns.com/dns-query#h3=true
"geosite:category-ads-all": rcode://success
"www.baidu.com,+.google.cn": [223.5.5.5, https://dns.alidns.com/dns-query]
proxy-providers:
x221:
type: http
path: ./x221.yaml
url: <REMOVED>
proxy-groups:
- name: PROXY
type: select
proxies:
- X221
- name: X221
type: select
use:
- x221
rule-providers-config: &rule-providers-config
type: http
interval: 86400
rule-providers:
reject: # AD Block # REJECT
<<: *rule-providers-config
behavior: domain
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/reject.txt"
path: ./profiles/ruleset/reject.txt
icloud: # iCloud # DIRECT
<<: *rule-providers-config
behavior: domain
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/icloud.txt"
path: ./profiles/ruleset/icloud.txt
apple: # Apple CN # DIRECT
<<: *rule-providers-config
behavior: domain
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/apple.txt"
path: ./profiles/ruleset/apple.txt
google: # Google CN # PROXY
<<: *rule-providers-config
behavior: domain
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/google.txt"
path: ./profiles/ruleset/google.txt
proxy: # Proxy List # PROXY
<<: *rule-providers-config
behavior: domain
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/proxy.txt"
path: ./profiles/ruleset/proxy.txt
direct: # Direct List # DIRECT
<<: *rule-providers-config
behavior: domain
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/direct.txt"
path: ./profiles/ruleset/direct.txt
private: # Private Network # DIRECT
<<: *rule-providers-config
behavior: domain
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/private.txt"
path: ./profiles/ruleset/private.txt
# gfw: # GFW List # Proxy
# <<: *rule-providers-config
# behavior: domain
# url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/gfw.txt"
# path: ./profiles/ruleset/gfw.txt
# greatfire: # Uesless greatfire.org
# <<: *rule-providers-config
# behavior: domain
# url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/greatfire.txt"
# path: ./profiles/ruleset/greatfire.txt
# tld-not-cn: # Domain tld !cn
# <<: *rule-providers-config
# behavior: domain
# url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/tld-not-cn.txt"
# path: ./profiles/ruleset/tld-not-cn.txt
telegramcidr: # Telegram Server IP # PROXY
<<: *rule-providers-config
behavior: ipcidr
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/telegramcidr.txt"
path: ./profiles/ruleset/telegramcidr.txt
cncidr: # CN IP # DIRECT
<<: *rule-providers-config
behavior: ipcidr
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/cncidr.txt"
path: ./profiles/ruleset/cncidr.txt
lancidr: # LAN IP # DIRECT
<<: *rule-providers-config
behavior: ipcidr
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/lancidr.txt"
path: ./profiles/ruleset/lancidr.txt
applications: # Application without proxy(torrent, proxy) # DIRECT
<<: *rule-providers-config
behavior: classical
url: "https://git.chenx221.cyou/chenx221/clash-rules/raw/branch/release/applications.txt"
path: ./profiles/ruleset/applications.txt
# 白名单模式
rules:
- AND,(AND,(DST-PORT,443),(NETWORK,UDP)),(NOT,((GEOSITE,cn))),REJECT # QUIC Disable
- RULE-SET,applications,DIRECT
- RULE-SET,lancidr,DIRECT,no-resolve
- RULE-SET,cncidr,DIRECT,no-resolve
- DOMAIN,clash.razord.top,DIRECT
- DOMAIN,g3.letv.com,DIRECT
- DOMAIN,gstatic.cn,PROXY
- DOMAIN,googleapis.cn,PROXY
- DOMAIN,analytics.google.com,PROXY
- DOMAIN,yacd.haishan.me,DIRECT
- RULE-SET,private,DIRECT
- RULE-SET,reject,REJECT
- GEOSITE,category-ads-all,REJECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,google,PROXY
- GEOSITE,google-cn,PROXY
- RULE-SET,proxy,PROXY
- GEOSITE,onedrive,DIRECT
- GEOSITE,microsoft@cn,DIRECT
- GEOSITE,apple-cn,DIRECT
- GEOSITE,steam@cn,DIRECT
- GEOSITE,category-games@cn,DIRECT
- RULE-SET,direct,DIRECT
- AND,(AND,(DST-PORT,443),(NETWORK,UDP)),(NOT,((GEOIP,CN))),REJECT # QUIC Disable
- RULE-SET,telegramcidr,PROXY,no-resolve
- GEOIP,LAN,DIRECT
- GEOIP,CN,DIRECT
- MATCH,PROXY
@Chenx221
Copy link
Author

Chenx221 commented Sep 1, 2024

If you are using Clash Meta on an AOSP-based system, to resolve Telegram connection issues, you may need to follow these steps:

  • Go to (Android) Settings > Network & Internet > VPN > Clash Meta for Android > ⚙ (Settings)
  • Enable the switches for "Always-on VPN" and "Block connections without VPN".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment