Docs: new documentation site (#2723)

This commit adds a VitePress build to the main repository,
aiming to ditch GitHub Wiki. Moving further, we're going to
host our own documentation site eithor on GitHub Pages or
something alike.
This commit is contained in:
Birkhoff Lee
2023-05-15 21:47:01 +08:00
committed by GitHub
parent 10dcb7a3ad
commit ca42ca2ca8
30 changed files with 2477 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
sidebarTitle: What is Clash?
sidebarOrder: 1
---
<!-- This file is used as a dummy sidebar item that always links to / -->

73
docs/introduction/faq.md Normal file
View File

@ -0,0 +1,73 @@
---
sidebarTitle: Frequently Asked Questions
sidebarOrder: 4
---
# Frequently Asked Questions
Here we have some common questions people ask. If you have any questions not listed here, feel free to [open an issue](https://github.com/Dreamacro/clash/issues/new/choose).
[[toc]]
## Which release should I use for my system?
Here are some common systems that people use Clash on, and the recommended release for each of them:
- NETGEAR WNDR3700v2: mips-hardfloat [#846](https://github.com/Dreamacro/clash/issues/846)
- NETGEAR WNDR3800: mips-softfloat [#579](https://github.com/Dreamacro/clash/issues/579)
- ASUS RT-AC5300: armv5 [#2356](https://github.com/Dreamacro/clash/issues/2356)
- MediaTek MT7620A, MT7621A: mipsle-softfloat ([#136](https://github.com/Dreamacro/clash/issues/136))
- mips_24kc: [#192](https://github.com/Dreamacro/clash/issues/192)
If your device is not listed here, you can check the CPU architecture of your device with `uname -m` and find the corresponding release in the release page.
## List of wontfix
The official Clash core project will not implement/fix these things:
- [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)
The following will be considered implementing when the official Go QUIC library releases.
- [TUIC](https://github.com/Dreamacro/clash/issues/2222)
- [Hysteria](https://github.com/Dreamacro/clash/issues/1863)
## Proxies work on my local machine, but not on my router or in a container
Your system might be out of sync in time. Refer to your platform documentations about time synchronisation - things will break if time is not in sync.
## Time complexity of rule matching
Refer to this discussion: [#422](https://github.com/Dreamacro/clash/issues/422)
## Clash Premium unable to access Internet
You can refer to these relevant discussions:
- [#432](https://github.com/Dreamacro/clash/issues/432#issuecomment-571634905)
- [#2480](https://github.com/Dreamacro/clash/issues/2480)
## error: unsupported rule type RULE-SET
If you stumbled on this error message:
```txt
FATA[0000] Parse config error: Rules[0] [RULE-SET,apple,REJECT] error: unsupported rule type RULE-SET
```
You're using Clash open-source edition. Rule Providers is currently only available in the [Premium core](https://github.com/Dreamacro/clash/releases/tag/premium). (it's free)
## DNS Hijack does not work
Since `tun.auto-route` does not intercept LAN traffic, if your system DNS is set to servers in private subnets, DNS hijack will not work. You can either:
1. Use a non-private DNS server as your system DNS like `1.1.1.1`
2. Or manually set up your system DNS to the Clash DNS (by default, `198.18.0.1`)

View File

@ -0,0 +1,50 @@
---
sidebarTitle: Getting Started
sidebarOrder: 2
---
# Getting Started
To get started with Clash, you can either build it from source or download pre-built binaries.
## Using pre-built binaries
You can download Clash core binaries here: [https://github.com/Dreamacro/clash/releases](https://github.com/Dreamacro/clash/releases)
## Install from source
You can build Clash on your own device with Golang 1.19+:
```shell
$ go install github.com/Dreamacro/clash@latest
go: downloading github.com/Dreamacro/clash v1.15.1
```
The binary is built under `$GOPATH/bin`:
```shell
$ $GOPATH/bin/clash -v
Clash unknown version darwin arm64 with go1.20.3 unknown time
```
## Build for a different arch/os
Golang supports cross-compilation, so you can build for a device on a different architecture or operating system. You can use _make_ to build them easily - for example:
```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
```
For other build targets, check out the [Makefile](https://github.com/Dreamacro/clash/blob/master/Makefile).

View File

@ -0,0 +1,132 @@
---
sidebarTitle: Clash as a Service
sidebarOrder: 3
---
# Clash as a Service
While Clash is meant to be run in the background, there's currently no elegant way to implement daemons with Golang, hence we recommend you to daemonize Clash with third-party tools.
## systemd
Copy Clash binary to `/usr/local/bin` and configuration files to `/etc/clash`:
```shell
cp clash /usr/local/bin
cp config.yaml /etc/clash/
cp Country.mmdb /etc/clash/
```
Create the systemd configuration file at `/etc/systemd/system/clash.service`:
```ini
[Unit]
Description=Clash daemon, A rule-based proxy in Go.
After=network-online.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/local/bin/clash -d /etc/clash
[Install]
WantedBy=multi-user.target
```
After that you're supposed to reload systemd:
```shell
systemctl daemon-reload
```
Launch clashd on system startup with:
```shell
systemctl enable clash
```
Launch clashd immediately with:
```shell
systemctl start clash
```
Check the health and logs of Clash with:
```shell
systemctl status clash
journalctl -xe
```
Credits to [ktechmidas](https://github.com/ktechmidas) for this guide. ([#754](https://github.com/Dreamacro/clash/issues/754))
## Docker
We provide pre-built images of Clash and Clash Premium. Therefore you can deploy Clash with [Docker Compose](https://docs.docker.com/compose/) if you're on Linux. However, you should be advised that it's [not recommended](https://github.com/Dreamacro/clash/issues/2249#issuecomment-1203494599) to run **Clash Premium** in a container.
::: warning
This setup will not work on macOS systems due to the lack of [host networking and TUN support](https://github.com/Dreamacro/clash/issues/770#issuecomment-650951876) in Docker for Mac.
:::
::: 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 # dashboard volume
ports:
- "7890:7890"
- "7891:7891"
# - "8080:8080" # The External Controller (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 # dashboard volume
ports:
- "7890:7890"
- "7891:7891"
# - "8080:8080" # The External Controller (RESTful API)
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
network_mode: "host"
```
:::
Save as `docker-compose.yaml` and place your `config.yaml` in the same directory.
::: tip
Before proceeding, refer to your platform documentations about time synchronisation - things will break if time is not in sync.
:::
When you're ready, run the following commands to bring up Clash:
```shell
docker-compose up -d
```
You can view the logs with:
```shell
docker-compose logs
```
Stop Clash with:
```shell
docker-compose stop
```