#---------------------------------------------------# ## 配置文件需要放置在 $HOME/.config/clash/config.yml ## 或者运行目录下的config.yml #---------------------------------------------------# # HTTP 代理端口 # port: 7890 # SOCKS5 代理端口 # socks-port: 7891 # (HTTP and SOCKS5 in one port) mixed-port: 7890 # Linux 和 macOS 的 redir 代理端口 (如需使用此功能,请取消注释) # redir-port: 7892 # 本地 SOCKS5/HTTP(S) 服务验证 authentication: - "user1:xpass1" - "user2:apass2" # 允许局域网的连接(可用来共享代理) allow-lan: true # 此功能仅在 allow-lan 设置为 true 时生效,支持三种参数: # "*" 绑定所有的 IP 地址 # 192.168.122.11 绑定一个的 IPv4 地址 # "[aaaa::a8aa:ff:fe09:57d8]" 绑定一个 IPv6 地址 bind-address: "*" # Clash 路由工作模式 # rule(规则) / global(全局代理)/ direct(全局直连) mode: rule # Clash 默认将日志输出至 STDOUT # 设置日志输出级别 (默认级别:silent,即不输出任何内容,以避免因日志内容过大而导致程序内存溢出)。 # 5 个级别:silent / info / warning / error / debug。级别越高日志输出量越大,越倾向于调试,若需要请自行开启。 log-level: info # When set to false, resolver won't translate hostnames to IPv6 addresses ipv6: true # clash 的 RESTful API 监听地址 external-controller: '127.0.0.1:55555' # 存放配置文件的相对路径,或存放网页静态资源的绝对路径 # Clash core 将会将其部署在 http://${external-controller}/ui # external-ui: folder # RESTful API 的口令 (可选) # 通过 HTTP 头中 Authorization: Bearer ${secret} 参数来验证口令 # 当 RESTful API 的监听地址为 0.0.0.0 时,请务必设定口令以保证安全 # secret: "" # 出站网卡接口 # interface-name: en0 # DNS 服务器和建立连接时的 静态 Hosts # 支持通配符域名 (例如: *.clash.dev, *.foo.*.example.com ) # 不使用通配符的域名优先级高于使用通配符的域名 (例如: foo.example.com > *.example.com > .example.com ) # 注意: +.foo.com 的效果等同于 .foo.com 和 foo.com hosts: 'pub.tapt2apdada.com': 127.0.0.1 'pub.xmx3dev.com': 127.0.0.1 # '.dev': 127.0.0.1 # 'alpha.clash.dev': '::1' profile: # Store the `select` results in $HOME/.config/clash/.cache # set false If you don't want this behavior # when two different configurations have groups with the same name, the selected values are shared store-selected: false # persistence fakeip store-fake-ip: true # DNS 服务器配置(可选;若不配置,程序内置的 DNS 服务会被关闭) dns: enable: true listen: :53 ipv6: true use-hosts: true respect-rules: true # dns请求按照规则分流 # 以下填写的 DNS 服务器将会被用来解析 DNS 服务的域名 # 仅填写 DNS 服务器的 IP 地址 default-nameserver: &default-nameserver - 223.5.5.5 - 119.29.29.29 - 114.114.114.114 nameserver: - https://doh.pub/dns-query - https://dns.alidns.com/dns-query proxy-server-nameserver: *default-nameserver enhanced-mode: fake-ip fake-ip-range: 198.18.0.1/16 # Fake IP 地址池 (CIDR 形式) # 在以下列表的域名将不会被解析为 fake ip,这些域名相关的解析请求将会返回它们真实的 IP 地址 fake-ip-filter: - "*.lan" - "*.local" - "*.arpa" - "time.*.com" - "ntp.*.com" - "+.market.xiaomi.com" - "localhost.ptlogin2.qq.com" - "*.msftncsi.com" - "www.msftconnecttest.com" nameserver-policy: "wzw.pp.ua,wzw.de5.net": - https://cloudflare-dns.com/dns-query#disable-ipv6=true - https://doh.pub/dns-query#disable-ipv6=true - https://dns.alidns.com/dns-query#disable-ipv6=true "geosite:geolocation-!cn": - https://cloudflare-dns.com/dns-query - https://v.recipes/dns-cn - https://api.chibanban.de/api/paas/v4/chat/completions/gemini - https://wj7410uwnh.cloudflare-gateway.com/dns-query "geosite:private": - system tun: enable: false stack: gvisor # or system dns-hijack: - 198.18.0.2:53 # when `fake-ip-range` is 198.18.0.1/16, should hijack 198.18.0.2:53 auto-route: true # auto set global route for Windows # It is recommended to use `interface-name` auto-detect-interface: true # auto detect interface, conflict with `interface-name`