Docs(locales): add chinese locale support (#2772)

This commit is contained in:
a76yyyy
2023-07-14 22:20:15 +08:00
committed by GitHub
parent 24186a488a
commit c7e34bdc11
33 changed files with 2636 additions and 97 deletions

View File

@ -0,0 +1,6 @@
---
sidebarTitle: 什么是 Clash?
sidebarOrder: 1
---
<!-- 此文件用作始终链接到 / 的虚拟侧边栏项目 -->

View File

@ -0,0 +1,95 @@
---
sidebarTitle: 常见问题
sidebarOrder: 4
---
# 常见问题
这里是一些大家遇到的常见问题. 如果您有任何此处未列出的问题, 请随时[提交一个 issue](https://github.com/Dreamacro/clash/issues/new/choose).
[[toc]]
## amd64 和 amd64-v3 有什么区别?
引用自 [golang/go](https://github.com/golang/go/wiki/MinimumRequirements#amd64):
> 在 Go 1.17 之前, Go 编译器总是生成任何 64 位 x86 处理器都可以执行的 x86 二进制文件.
>
> Go 1.18 引入了 AMD64 的 [4 个架构级别](https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels).
> 每个级别都有不同的x86指令集, 编译器可以在生成的二进制文件中包含这些指令:
>
> - GOAMD64=v1 (默认) : 基线. 仅生成所有 64 位 x86 处理器都可以执行的指令.
> - GOAMD64=v2: 所有 v1 指令, 加上 CMPXCHG16B、LAHF、SAHF、POPCNT、SSE3、SSE4.1、SSE4.2、SSSE3.
> - GOAMD64=v3: 所有 v2 指令, 加上 AVX、AVX2、BMI1、BMI2、F16C、FMA、LZCNT、MOVBE、OSXSAVE.
> - GOAMD64=v4: 所有 v3 指令, 加上 AVX512F、AVX512BW、AVX512CD、AVX512DQ、AVX512VL.
>
> 例如, 设置 `GOAMD64=v3` 将允许 Go 编译器在生成的二进制文件中使用 AVX2 指令 (这可能会在某些情况下提高性能) ;但是这些二进制文件将无法在不支持 AVX2 的旧 x86 处理器上运行.
>
> Go工具链也可能生成较新的指令, 但会存在动态检查保护, 确保它们只在有能力的处理器上执行. 例如在 `GOAMD64=v1` 的情况下, 如果 [CPUID](https://www.felixcloutier.com/x86/cpuid) 报告说 [POPCNT](https://www.felixcloutier.com/x86/popcnt) 指令可用, [math/bits.OnesCount](https://pkg.go.dev/math/bits#OnesCount) 仍将使用该指令. 否则, 它就会退回到一个通用的实现.
>
> Go 工具链目前不会生成任何 AVX512 指令.
>
> 请注意, 在这种情况下, *处理器*是一个简化. 实际上, 整个系统 (固件、hypervisor、内核) 都需要支持.
## 我的系统应该使用哪个版本?
这里是一些人们在 Clash 上使用的常见系统, 以及每个系统的推荐版本:
- NETGEAR WNDR3700v2: mips-hardfloat [#846](https://github.com/Dreamacro/clash/issues/846)
- NETGEAR WNDR3800: mips-softfloat [#579](https://github.com/Dreamacro/clash/issues/579)
- 华硕RT-AC5300: armv5 [#2356](https://github.com/Dreamacro/clash/issues/2356)
- 联发科MT7620A, MT7621A: mipsle-softfloat ([#136](https://github.com/Dreamacro/clash/issues/136))
- mips_24kc: [#192](https://github.com/Dreamacro/clash/issues/192)
如果您的设备未在此处列出, 您可以使用 `uname -m` 检查设备的 CPU 架构, 并在发布页面中找到相应的版本.
## 不会修复的问题
官方 Clash 内核项目不会实现/修复以下内容:
- [Snell](https://github.com/Dreamacro/clash/issues/2466)
- [Custom CA](https://github.com/Dreamacro/clash/issues/2333)
- [VMess Mux](https://github.com/Dreamacro/clash/issues/450)
- [VLess](https://github.com/Dreamacro/clash/issues/1185)
- [KCP](https://github.com/Dreamacro/clash/issues/16)
- [mKCP](https://github.com/Dreamacro/clash/issues/2308)
- [TLS Encrypted Client Hello](https://github.com/Dreamacro/clash/issues/2295)
- [TCP support for Clash DNS server](https://github.com/Dreamacro/clash/issues/368)
- [MITM](https://github.com/Dreamacro/clash/issues/227#issuecomment-508693628)
当官方Go QUIC库发布时, 以下内容将被考虑实施:
- [TUIC](https://github.com/Dreamacro/clash/issues/2222)
- [Hysteria](https://github.com/Dreamacro/clash/issues/1863)
## 在本地机器上节点正常工作, 但在路由器或容器中不起作用
您的系统可能未与世界时间同步. 请参考您的平台关于时间同步的文件 - 如果时间不同步, 某些协议可能无法正常工作.
## 规则匹配的时间复杂度
请参考这个讨论: [#422](https://github.com/Dreamacro/clash/issues/422)
## Clash Premium 无法访问互联网
您可以参考这些相关讨论:
- [#432](https://github.com/Dreamacro/clash/issues/432#issuecomment-571634905)
- [#2480](https://github.com/Dreamacro/clash/issues/2480)
## 错误: 不支持的 RULE-SET 规则类型
如果您遇到了这个错误信息:
```txt
FATA[0000] Parse config error: Rules[0] [RULE-SET,apple,REJECT] error: unsupported rule type RULE-SET
```
您正在使用 Clash 开源版. 规则 Providers 目前仅在 [免费 Premium 内核](https://github.com/Dreamacro/clash/releases/tag/premium) 中可用.
## DNS 劫持不起作用
由于 `tun.auto-route` 不会拦截局域网流量, 如果您的系统 DNS 设置为私有子网中的服务器, 则 DNS 劫持将不起作用. 您可以:
1. 使用非私有 DNS 服务器作为系统 DNS, 如 `1.1.1.1`
2. 或者手动将系统 DNS 设置为 Clash DNS (默认为 `198.18.0.1`)

View File

@ -0,0 +1,50 @@
---
sidebarTitle: 快速开始
sidebarOrder: 2
---
# 快速开始
为了开始使用 Clash, 您可以从源码编译或者下载预编译的二进制文件.
## 使用预编译的二进制文件
您可以在这里下载 Clash 的内核二进制文件: [https://github.com/Dreamacro/clash/releases](https://github.com/Dreamacro/clash/releases)
## 从源码编译
您可以使用 Golang 1.19+ 在您的设备上编译 Clash:
```shell
$ go install github.com/Dreamacro/clash@latest
go: downloading github.com/Dreamacro/clash v1.15.1
```
二进制文件将会被编译到 `$GOPATH/bin` 目录下:
```shell
$ $GOPATH/bin/clash -v
Clash unknown version darwin arm64 with go1.20.3 unknown time
```
## 跨平台/操作系统编译
Golang 支持交叉编译, 所以您可以为不同架构或操作系统的设备编译 Clash. 您可以使用 _make_ 来轻松地编译它们, 例如:
```shell
$ git clone --depth 1 https://github.com/Dreamacro/clash
Cloning into 'clash'...
remote: Enumerating objects: 359, done.
remote: Counting objects: 100% (359/359), done.
remote: Compressing objects: 100% (325/325), done.
remote: Total 359 (delta 25), reused 232 (delta 17), pack-reused 0
Receiving objects: 100% (359/359), 248.99 KiB | 1.63 MiB/s, done.
Resolving deltas: 100% (25/25), done.
$ cd clash && make darwin-arm64
fatal: No names found, cannot describe anything.
GOARCH=arm64 GOOS=darwin CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=unknown version" -X "github.com/Dreamacro/clash/constant.BuildTime=Mon May 8 16:47:10 UTC 2023" -w -s -buildid=' -o bin/clash-darwin-arm64
$ file bin/clash-darwin-arm64
bin/clash-darwin-arm64: Mach-O 64-bit executable arm64
```
对于其他构建目标, 请查看 [Makefile](https://github.com/Dreamacro/clash/blob/master/Makefile).

View File

@ -0,0 +1,131 @@
---
sidebarTitle: Clash 服务运行
sidebarOrder: 3
---
# Clash 服务运行
Clash 需要在后台运行, 但是目前 Golang 还没有很好的守护进程实现, 因此我们推荐使用第三方工具来创建 Clash 的守护进程.
## systemd
使用以下命令将 Clash 二进制文件复制到 `/usr/local/bin`, 配置文件复制到 `/etc/clash`:
```shell
cp clash /usr/local/bin
cp config.yaml /etc/clash/
cp Country.mmdb /etc/clash/
```
创建 systemd 配置文件 `/etc/systemd/system/clash.service`:
```ini
[Unit]
Description=Clash 守护进程, Go 语言实现的基于规则的代理.
After=network-online.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/local/bin/clash -d /etc/clash
[Install]
WantedBy=multi-user.target
```
之后, 您应该使用以下命令重新加载 systemd:
```shell
systemctl daemon-reload
```
使用以下命令在系统启动时启动 Clash:
```shell
systemctl enable clash
```
使用以下命令立即启动 Clash:
```shell
systemctl start clash
```
使用以下命令检查 Clash 的运行状况和日志:
```shell
systemctl status clash
journalctl -xe
```
本指南贡献者为 [ktechmidas](https://github.com/ktechmidas). ([#754](https://github.com/Dreamacro/clash/issues/754))
## Docker
本项目提供了预构建的 Clash 和 Clash Premium Docker 镜像. 因此, 在 Linux 上您可以使用 [Docker Compose](https://docs.docker.com/compose/) 部署 Clash. 但是, 您应该知道在容器中运行 **Clash Premium** 是[不被推荐的](https://github.com/Dreamacro/clash/issues/2249#issuecomment-1203494599)
::: warning
由于 Mac 版 Docker 中缺少[主机网络和 TUN 支持](https://github.com/Dreamacro/clash/issues/770#issuecomment-650951876), 此设置将无法在 macOS 系统上运行.
:::
::: code-group
```yaml [Clash]
services:
clash:
image: ghcr.io/dreamacro/clash
restart: always
volumes:
- ./config.yaml:/root/.config/clash/config.yaml:ro
# - ./ui:/ui:ro # 仪表盘 Volume 映射
ports:
- "7890:7890"
- "7891:7891"
# - "8080:8080" # 外部控制 (RESTful API)
network_mode: "bridge"
```
```yaml [Clash Premium]
services:
clash:
image: ghcr.io/dreamacro/clash-premium
restart: always
volumes:
- ./config.yaml:/root/.config/clash/config.yaml:ro
# - ./ui:/ui:ro # 仪表盘 Volume 映射
ports:
- "7890:7890"
- "7891:7891"
# - "8080:8080" # 外部控制 (RESTful API)
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
network_mode: "host"
```
:::
保存为 `docker-compose.yaml`, 并将您的 `config.yaml` 放在同一目录下.
::: tip
在继续操作之前, 请参考您的平台关于时间同步的文件 - 如果时间不同步, 某些协议可能无法正常工作.
:::
准备就绪后, 运行以下命令以启动 Clash:
```shell
docker-compose up -d
```
您可以使用以下命令查看日志:
```shell
docker-compose logs
```
Stop Clash with:
```shell
docker-compose stop
```