Clash配置简单介绍
Easul Lv6

配置详解

以下为 clash 编辑时的 yaml 文件常用配置
中文配置说明可以参考
流量走向为根据 rules 选择走哪一个 proxy-groups。默认会走每个 proxy-groups 中的 proxies 的第一个。

YAML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# 混合使用端口
mixed-port: 7890

# 是否允许局域网链接
allow-lan: false

# 仅适用于设置 allow-lan 为 true 时
# "*": 绑定所有 IP 地址
# 192.168.122.11: 绑定单个 IPv4 地址
# "[aaaa::a8aa:ff:fe09:57d8]": 绑定单个 IPv6 地址
# bind-address: "*"

# rule / global / Direct (默认为 Rule 模式)
mode: Rule

# 设置输出日志的等级 (默认为 info)
# info / warning / error / debug / silent
log-level: info

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

# you can put the static web resource (such as clash-dashboard) to a directory, and clash would serve in `${API}/ui`
# input is a relative path to the configuration directory or an absolute path
# external-ui: folder

# Secret for RESTful API (Optional)
# secret: ""

# 实验性功能
experimental:
ignore-resolve-fail: true # 忽略 DNS 解析失败,默认值为true
# interface-name: en0 # 出站接口名称

# 本地 SOCKS5/HTTP(S) 服务器认证
# authentication:
# - "user1:pass1"
# - "user2:pass2"

# # 实验性 hosts, 支持通配符(如 *.clash.dev 甚至 *.foo.*.examplex.com )
# # 静态域的优先级高于通配符域(foo.example.com > *.example.com)
hosts:
'mtalk.google.com': 108.177.125.188
# '*.clash.dev': 127.0.0.1
# 'alpha.clash.dev': '::1'

# dns:
# enable: true # set true to enable dns (default is false)
# ipv6: false # default is false
# listen: 0.0.0.0:53
# # default-nameserver: # resolve dns nameserver host, should fill pure IP
# # - 114.114.114.114
# # - 8.8.8.8
# enhanced-mode: redir-host # or fake-ip
# # fake-ip-range: 198.18.0.1/16 # if you don't know what it is, don't change it
# fake-ip-filter: # fake ip white domain list
# - '*.lan'
# - localhost.ptlogin2.qq.com
# nameserver:
# - 114.114.114.114
# - tls://dns.rubyfish.cn:853 # dns over tls
# - https://1.1.1.1/dns-query # dns over https
# fallback: # concurrent request with nameserver, fallback used when GEOIP country isn't CN
# - tcp://1.1.1.1
# fallback-filter:
# geoip: true # default
# ipcidr: # ips in these subnets will be considered polluted
# - 240.0.0.0/4

# 代理配置文档
# https://github.com/Ieooo/clash/blob/master/docs/zh_CN/configuration/outbound.md
# 可以使用 json,也可以使用 yaml 格式
proxies:
- {"name":"hangzhou","type":"trojan","server":"1.1.1.1","port":222,"udp":true,"password":"asdf","sni":"mytest.com","skip-cert-verify":true,"network":"ws","ws-opts":{"path":"/speedtest","headers":{"host":"mytest.com"}}}

# 代理组
# https://github.com/Ieooo/clash/blob/master/docs/zh_CN/configuration/outbound.md#proxy-groups-%E7%AD%96%E7%95%A5%E7%BB%84
# 这里为每一个 代理组 分配了 一个 规则
# 符合 规则 的,则走下边的 代理组
# 所以先从 路由 判断是哪个 规则,然后再走下边的 代理
# proxies 中的选项只是走该 代理 时的选择而已,默认走第一个
proxy-groups:
- name: "代理选择"
type: select
proxies:
- "hanghzou"
- "默认"
# url-test 通过指定的 URL 测试并选择延迟最低的节点
- name: "自动选择快速节点"
type: url-test
proxies:
- "hangzhou"
url: 'http://www.gstatic.com/generate_204'
interval: 300
# 这里 默认 是 直连,添加 hangzhou 则提供其他选择,需要时可以切换
- name: "默认"
type: select
proxies:
- "DIRECT"
- "hangzhou"

# 规则
# https://github.com/Ieooo/clash/blob/master/docs/zh_CN/configuration/rules.md
rules:
# no-resolve 用于跳过DNS解析,IP即可使用
- IP-CIDR,182.254.116.0/24,代理选择,no-resolve
- DOMAIN,www.google.com,代理选择
# 广告则拒绝
- DOMAIN-SUFFIX,17gouwuba.com,REJECT
- DOMAIN-KEYWORD,twitter,代理选择
- MATCH,默认

简单模板

YAML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
mixed-port: 7890
allow-lan: false
log-level: info
dns:
enabled: true
default-nameserver:
- 223.5.5.5
- 119.29.29.29
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:
- https://doh.pub/dns-query
- https://dns.alidns.com/dns-query
proxies:
- {"name":"hangzhou","type":"trojan","server":"111.111.111.111","port":222,"udp":true,"password":"asdf","sni":"example.com","skip-cert-verify":true,"network":"ws","ws-opts":{"path":"/speedtest","headers":{"host":"example.com"}}}
proxy-groups:
- name: 代理
type: select
proxies:
- hangzhou
- 默认
- name: 默认
type: select
proxies:
- DIRECT
- hangzhou
rules:
- IP-CIDR,192.168.3.0/24,代理,no-resolve
- IP-CIDR,192.168.4.0/24,代理,no-resolve
- IP-CIDR,10.44.12.0/24,代理,no-resolve
- MATCH,默认

Clash桌面版软件包

ClashForWindows

ClashForFlutter

ClashVerge

ClashNyanpasu

ClashWarden

ClashRev

ClashTui

ClashVergeRev

ClashrAutoDesktop

ClashMini

Clash安卓软件包

ClashCore

github备份

Clash网页离线转换

Clash工具箱

v2rayse

 评论