[arguments]
@@ -106,25 +128,25 @@ The commands are:
json Convert typedMessage to json
```
-Sub-command `pb`
+`pb` subcommand usage example:
```bash
-# Usage: xray convert pb [-debug] [-type] [json file] [json file] ...
+# Usage: xray convert pb [-outpbfile out.pb] [-debug] [-type] [json file] [json file] ...
-# mix three config files to mix.pb
-xray convert pb c1.json c2.json c3.json > mix.pb
+# Merge three configs into mix.pb
+xray convert pb -outpbfile mix.pb c1.json c2.json c3.json
# Use -debug option to view the content of mix.pb
xray convert pb -debug mix.pb
-# Start Xray-core with mix.pb
+# Start Xray-core using mix.pb
xray -c mix.pb
-# Detailed usage
+# Detailed instructions
xray help convert pb
```
-Sub-command JSON
+`json` subcommand usage example:
```bash
# Usage: xray convert json [-type] [stdin:] [typedMessage file]
@@ -136,13 +158,13 @@ tmsg='{
echo ${tmsg} | xray convert json stdin:
-# Outputs from above:
+# The output of the above command is:
'{
"cipherType": "AES_256_GCM",
"password": "111"
}'
-# Detailed usage
+# Detailed instructions
xray help convert json
```
@@ -169,22 +191,22 @@ Generate UUID.
Usage:
```
-xray uuid
+xray uuid [-i "example"]
```
### xray x25519
-Generate x25519 key pair。
+Generate x25519 key pair.
Usage:
```
-xray x25519 [-i "(base64.RawURLEncoding)" --std-encoding]
+xray x25519 [-i "(base64.RawURLEncoding)" --std-encoding ]
```
### xray wg
-Generate wireguard curve25519 key pair。
+Generate WireGuard curve25519 key pair.
Usage:
@@ -193,8 +215,38 @@ xray wg [-i "(base64.StdEncoding)"]
```
::: tip
-When `-config` is not specified, Xray will try to load `config.json` from the following paths:
+When `-config` is not specified, Xray will attempt to load `config.json` from the following paths in order:
- Working Directory
-- The path specified by `Xray.location.asset` in the [environment variable](../config/features/env.md).
- :::
+- The path specified by `Xray.location.asset` in [Environment Variables](../config/features/env.md#resource-file-path)
+:::
+
+### xray mldsa65
+
+Generate MLDSA-65 post-quantum signature key pair for REALITY.
+
+Usage:
+
+```
+xray mldsa65 [-i "seed (base64.StdEncoding)"]
+```
+
+### xray mlkem768
+
+Generate ML-KEM-768 post-quantum key exchange key pair for VLESS Encryption.
+
+Usage:
+
+```
+xray mlkem768 [-i "seed (base64.StdEncoding)"]
+```
+
+### xray vlessenc
+
+Generate encryption/decryption option content that can be directly used for VLESS Encryption. In the generated configuration, you can use either X25519 or ML-KEM-768 authentication method, but the server and client must use the same authentication method. The ephemeral key exchange remains post-quantum secure regardless of the authentication method.
+
+Usage:
+
+```
+xray vlessenc
+```
diff --git a/docs/en/document/config.md b/docs/en/document/config.md
index b06f1669..b657a542 100644
--- a/docs/en/document/config.md
+++ b/docs/en/document/config.md
@@ -1,25 +1,32 @@
# Configure and Run
-After [downloading and installing Xray](./install.md), you need to configure it.
+After you have [downloaded and installed](./install) Xray, you need to configure it.
-For demonstration purposes, only a simple configuration method is introduced here. For more templates, please refer to [Xray-examples](https://github.com/XTLS/Xray-examples).
+For demonstration purposes, only simple configuration methods are introduced here. For more templates: [Xray-examples](https://github.com/XTLS/Xray-examples)
-If you need to set up more advanced features, please refer to the relevant instructions in the more detailed [configuration file](../config/).
+To configure more complex features, please refer to the detailed instructions in [Configuration](../config/).
+
+::: danger
+To avoid your traffic being decrypted,
+You should use `xray uuid` or `uuidgen` to generate a unique UUID.
+On the server side, put it in `inbounds[0].settings.clients[0].id`.
+On the client side, put it in `outbounds[0].settings.vnext[0].users[0].id`.
+:::
## Server Configuration
-You need a server outside the firewall to run server-side Xray. The configuration is as follows:
+You need a server outside the firewall to run the server-side Xray. The configuration is as follows:
```json
{
"inbounds": [
{
- "port": 10086, // The port on which the server is listening
+ "port": 10086, // Server listening port
"protocol": "vmess",
"settings": {
"clients": [
{
- "id": "b831381d-6324-4d53-ad4f-8cda48b30811"
+ "id": "b831381d-6324-4d53-ad4f-8cda48b30811" // Remember to replace this field, generate using `xray uuid` or `uuidgen`
}
]
}
@@ -33,17 +40,17 @@ You need a server outside the firewall to run server-side Xray. The configuratio
}
```
-In server configuration, it is necessary to ensure that the `id` and port are consistent with the client in order to establish a normal connection.
+Ensure that the `id` and port in the server configuration match the client's, and you will be able to connect normally.
## Client Configuration
-On your PC (or phone), you need to run Xray with the following configuration:
+On your PC (or mobile phone), you need to run Xray with the following configuration:
```json
{
"inbounds": [
{
- "port": 1080, // SOCKS代理端口,需要在浏览器中配置代理并指向该端口
+ "port": 1080, // SOCKS proxy port. You need to configure the proxy in the browser to point to this port.
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
@@ -57,11 +64,11 @@ On your PC (or phone), you need to run Xray with the following configuration:
"settings": {
"vnext": [
{
- "address": "server", // 服务器地址,请将其更改为您自己的服务器IP或域名
- "port": 10086, // 服务器端口
+ "address": "server", // Server address. Please change to your own server IP or domain name.
+ "port": 10086, // Server port
"users": [
{
- "id": "b831381d-6324-4d53-ad4f-8cda48b30811"
+ "id": "b831381d-6324-4d53-ad4f-8cda48b30811" // Remember to replace this field, generate using `xray uuid` or `uuidgen`
}
]
}
@@ -77,7 +84,7 @@ On your PC (or phone), you need to run Xray with the following configuration:
"domainStrategy": "IPOnDemand",
"rules": [
{
- "ip": ["geoip:private"],
+ "ip": ["geoip:private", "geoip:cn"], // Bypass LAN and mainland China IPs
"outboundTag": "direct"
}
]
@@ -85,14 +92,14 @@ On your PC (or phone), you need to run Xray with the following configuration:
}
```
-The only thing you need to modify in the above configuration is your server's IP address, which is indicated in the configuration. This configuration will redirect all traffic to your server, except for traffic on the local area network (such as the access router).
+The only places you need to change in the above configuration are your server IP and user UUID, as noted in the configuration. The above configuration will forward all traffic to your server except for LAN (e.g., accessing the router) and mainland China IP ranges (e.g., accessing Bilibili, AcFun).
## Run
-- On Windows and macOS, the configuration files are usually named `config.json`.
- - To start Xray, simply run `Xray` or `Xray.exe`.
-- On Linux, the configuration files are usually located in `/etc/xray/` or `/usr/local/etc/xray/`.
- - To start Xray, run the command `xray run -c /etc/xray/config.json`.
- - Alternatively, you can use a tool like systemd to run Xray as a background service.
+- In Windows and macOS, the configuration file is usually the `config.json` file in the same directory as Xray.
+ - Simply run `Xray` or `Xray.exe`.
+- In Linux, the configuration file is usually located in the `/etc/xray/` or `/usr/local/etc/xray/` directory.
+ - Run `xray run -c /etc/xray/config.json`.
+ - Or use tools like systemd to run Xray as a service in the background.
-For more detailed instructions, please refer to the [Configuration](../config/) Document and [Layman's Terms](./level-0/).
+For more detailed instructions, please refer to [Configuration Documentation](../config/) and [Project X for Dummies](./level-0/).
diff --git a/docs/en/document/index.md b/docs/en/document/index.md
index ceda1f44..952d1cd6 100644
--- a/docs/en/document/index.md
+++ b/docs/en/document/index.md
@@ -1,51 +1,53 @@
----
-sidebar: auto
----
-
# Quick Start
-> **This chapter will tell you how to get Xray in the easiest way and start using Xray.**
+> **This chapter will show you the simplest way to obtain and start using Xray.**
+
+::: tip
+This section has not been updated for quite a long time, so some parts may not be entirely reliable. We mainly strive to keep the configuration file documentation up to date. If you encounter any pitfalls, suggestions for modifications via PR are welcome.
+
+ℱ.
+:::
## Download and Install
-Xray supports various platforms, and you can get various versions of Xray from various sources and methods.
+Xray supports a wide range of platforms, and you can obtain various versions of Xray through multiple channels and methods.
-Please click [How to Download and Install Xray](./install.md) to get Xray.
+Please click [Download and Install](./install.md) to get Xray.
## Configure and Run
-After downloading and installing Xray, you need to configure it.
+After downloading and installing Xray, you only need to configure it to start using it.
-Please click [How to Configure and Run Xray](./config.md) to learn the easiest way to configure Xray.
+Please click [Configure and Run](./config.md) to learn the simplest way to configure it.
## Command Parameters
Xray has a variety of commands and parameters available, making it flexible and powerful.
-Please click [Command Parameters for Xray](./command.md) to view more commands and parameters usages.
+Please click [Command Parameters](./command.md) to view more usage details of Xray's commands and parameters.
-## Improve Documents
+## Improve Documentation
-If you're interested, please click [Documents](./document.md) to help us improve the documents, or click the `Help us improve this page!`
+If you are interested, please click [Documentation Guide](./document.md) to help us improve the documentation, or click `Help us improve this page!` at the bottom of the page.
-We are very grateful to every Contributor for their contribution! You guys make Project X even stronger!
+We are very grateful for the contributions made by every Contributor! It is you who make Project X more powerful!
-## Beginner Tutorial
+## Project X for Dummies
-An easy tutorial for beginner.
+User insights and guidance for beginners.
-Please click [Beginner Tutorial](./level-0/) to view it.
+Please click [Project X for Dummies](./level-0/) to view.
-## Getting Started Tips
+## Beginner Tips
-After you have the basics, you can explore more ways to use them through [Getting Started Tips](./level-1/).
+Once you have the basics down, you can explore more usage methods through [Beginner Tips](./level-1/).
## Advanced Documentation
-Tips for advanced user guidance
+Usage tips and guidance for advanced users.
-Click on [Advanced Documentation](./level-2/) to view it
+Click [Advanced Documentation](./level-2/) to view.
-::: tip Appreciations
-Thank you very much for your selfless sharing of usage skills and experience, which makes Xray more and more powerful.
+::: tip Acknowledgements
+Many thanks to everyone for selflessly sharing their tips and insights, making Xray increasingly powerful.
:::
diff --git a/docs/en/document/install.md b/docs/en/document/install.md
index d846ee17..1840d268 100644
--- a/docs/en/document/install.md
+++ b/docs/en/document/install.md
@@ -2,53 +2,55 @@
## Platform Support
-- Xray is available on the following platforms:
- - Windows 7 and later (x86 / amd64 / arm32 / arm64);
- - If you need to use these version (1.8.18 and later marked with `win7`, 1.8.6, 1.8.4) in Windows 7, operating system update **KB4474419** is required. For better Internet security, it is recommended to install KB4490628 to acquire later operating system updates from Windows Update.
- - macOS 10.10 Yosemite and later (amd64 / arm64);
- - Linux 2.6.23 and later (x86 / amd64 / arm / arm64 / mips64 / mips / ppc64 / s390x / riscv64);
- - Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and subsequent versions, CentOS 7 / 8, Arch Linux, etc.;
- - FreeBSD (x86 / amd64);
- - OpenBSD (x86 / amd64);
+Xray is available on the following platforms:
+
+- Windows 7 and later (x86 / amd64 / arm32 / arm64);
+ - To use regular versions 1.8.4, 1.8.6, and `win7` versions after 1.8.18 on Windows 7, the system must have the **KB4474419** update installed; it is recommended to also install KB4490628 to receive subsequent operating system security updates after connecting to the internet.
+ - Starting from v25, running the `win7` version on Windows 7 only requires SP1 to function normally, but installing subsequent OS security updates is still strongly recommended for networked systems.
+- macOS 10.10 Yosemite and later (amd64 / arm64);
+- Linux 2.6.23 and later (x86 / amd64 / arm / arm64 / mips64 / mips / ppc64 / s390x / riscv64);
+ - Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 7 / 8, Arch Linux, etc.;
+- FreeBSD (x86 / amd64);
+- OpenBSD (x86 / amd64);
## Download Xray
-Precompiled binaries in ZIP format are available at [GitHub Releases](https://github.com/xtls/Xray-core/releases) found in.
+Pre-compiled binary ZIP archives can be found in [Github Releases](https://github.com/xtls/Xray-core/releases).
-Download the compressed package of the corresponding platform, and use it after decompression.
+Download the archive for your platform, extract it, and it is ready to use.
-## Verify the Installation Package
+## Verify Installation Packages
Xray provides two verification methods:
-- SHA1/SHA256 digest of the ZIP archive
-- Reproducible build: Please refer to [Compile Xray](../development/intro/compile.html)
+- SHA1 / SHA256 digests of the ZIP archive.
+- Reproducible Builds: Please refer to [Compiling Xray](../development/intro/compile.md).
-## Install on Windows
+## Windows Installation
-- Download the ZIP archive suitable for the Windows platform on [Github Releases](https://github.com/xtls/Xray-core/releases). After decompression, you can get an executable file `xray.exe`, and then run it with [parameters](./command) through the command line.
-- By [Scoop](https://scoop.sh/) Package manager installation: Xray has been added to [Mochi](https://github.com/Qv2ray/mochi).
+- Download the ZIP archive for the Windows platform from [Github Releases](https://github.com/xtls/Xray-core/releases). After extraction, you will get the executable file `xray.exe`. You can then [run it via the command line with parameters](./command).
+- Install via [Scoop](https://scoop.sh) package manager: Xray has been added to [Mochi](https://github.com/Qv2ray/mochi).
-## Install on macOS
+## macOS Installation
-- Download the ZIP archive suitable for the macOS platform on [Github Releases](https://github.com/xtls/Xray-core/releases). After decompression, you can get an executable file `xray`, and then run it with [parameters](./command) through the command line.
-- By [Homebrew](https://brew.sh/) Package manager installation: `brew install xray`
-- [homebrew-xray](https://github.com/N4FA/homebrew-xray): Thanks [@N4FA](https://github.com/N4FA)
+- Download the ZIP archive for the macOS platform from [Github Releases](https://github.com/xtls/Xray-core/releases). After extraction, you will get the executable file `xray`. You can then [run it via the command line with parameters](./command.md).
+- Install via [Homebrew](https://brew.sh) package manager: `brew install xray`
+- [homebrew-xray](https://github.com/N4FA/homebrew-xray) thanks to [@N4FA](https://github.com/N4FA).
-## Install on Linux
+## Linux Installation
-### Install Script
+### Installation Scripts
- Linux Script
- - [XTLS/Xray-install](https://github.com/XTLS/Xray-install) (**Official**)
- - [tempest](https://github.com/team-cloudchaser/tempest) (supports [`systemd`](https://systemd.io) and [OpenRC](https://github.com/OpenRC/openrc); Linux-only)
+ - [XTLS/Xray-install](https://github.com/XTLS/Xray-install) (**Official Script**)
+ - [tempest](https://github.com/team-cloudchaser/tempest) (Supports [`systemd`](https://systemd.io) and [OpenRC](https://github.com/OpenRC/openrc); Linux only)
-* One Click
+- One Click
- [Xray-REALITY](https://github.com/zxcvos/Xray-script), [xray-reality](https://github.com/sajjaddg/xray-reality), [reality-ezpz](https://github.com/aleskxyz/reality-ezpz)
- [Xray_bash_onekey](https://github.com/hello-yunshu/Xray_bash_onekey), [XTool](https://github.com/LordPenguin666/XTool)
- [v2ray-agent](https://github.com/mack-a/v2ray-agent), [Xray_onekey](https://github.com/wulabing/Xray_onekey), [ProxySU](https://github.com/proxysu/ProxySU)
-* Magisk
+- Magisk
- [Xray4Magisk](https://github.com/Asterisk4Magisk/Xray4Magisk)
- [Xray_For_Magisk](https://github.com/E7KMbb/Xray_For_Magisk)
@@ -56,15 +58,15 @@ Xray provides two verification methods:
#### Arch User Repository
-Need to use [AUR helpers](https://wiki.archlinux.org/index.php/AUR_helpers), [yay](https://github.com/Jguer/yay) as an example, it can be installed via `yay -S xray`.
+Requires [AUR helpers](https://wiki.archlinux.org/index.php/AUR_helpers). Taking [yay](https://github.com/Jguer/yay) as an example, you can install via `yay -S xray`.
#### Arch Linux CN
-First add [Arch Linux CN](https://www.archlinuxcn.org/archlinux-cn-repo-and-mirror/) repository, and then use the root user `pacman -S xray`to install.
+First add the [Arch Linux CN repository](https://www.archlinuxcn.org/archlinux-cn-repo-and-mirror/), then install using `pacman -S xray` under the root user.
### Linuxbrew
-The Linuxbrew package manager is used in the same way as Homebrew: `brew install xray`
+The usage of the Linuxbrew package manager is consistent with Homebrew: `brew install xray`
### Debian
@@ -72,33 +74,33 @@ The Linuxbrew package manager is used in the same way as Homebrew: `brew install
Currently, three third-party Overlays provide Portage installation scripts:
-- **[CHN-beta/touchfish-os](https://github.com/gentoo-mirror/touchfish-os/tree/master/net-proxy/Xray)**: Individually maintained, designed for systemD systems
-- **[Gentoo-zh](https://github.com/microcai/gentoo-zh)**: Community-maintained, designed for systemD systems
-- **[JuanCldCmt/Xray-Overlay](https://github.com/JuanCldCmt/Xray-Overlay)**: Individually maintained, designed for openRC systems. Runs under the `xray` user group for enhanced security
+- [CHN-beta/touchfish-os](https://github.com/gentoo-mirror/touchfish-os/tree/master/net-proxy/Xray): Personally maintained, suitable for systemD systems.
+- [Gentoo-zh](https://github.com/microcai/gentoo-zh): Community maintained, suitable for systemD systems.
+- [JuanCldCmt/Xray-Overlay](https://github.com/JuanCldCmt/Xray-Overlay): Personally maintained, suitable for openRC systems; runs with the xray user group to improve security.
-Use `layman` or `eselect-repository` to add the Overlay to your local repository, then install.
+Use layman or eselect-repository to add the Overlay locally, then install.
-## Install via Docker
+## Docker Installation
-Currently two different styles of Docker images are provided:
+Currently, two different styles of Docker images are provided:
-- [teddysun/xray](https://hub.docker.com/r/teddysun/xray): Root privileges, shell environment, compatible with all architectures supported by Alpine. Compiled and built via a private server (dl.lamp.sh). Offers better ease of use
-- [ghcr.io/xtls/xray-core](https://ghcr.io/xtls/xray-core): Rootless, no shell environment, supports more architectures. Compiled from the official repository with build provenance. Sacrifices convenience for extreme security
+- [teddysun/xray](https://hub.docker.com/r/teddysun/xray): Has root privileges, has shell environment, compatible with all Alpine-supported architectures. Compiled and built by private server dl.lamp.sh. More convenient to use.
+- [ghcr.io/xtls/xray-core](https://ghcr.io/xtls/xray-core): No root privileges, no shell environment, supports more architectures. Compiled and built by the official repository supporting traceability. Sacrifices convenience for more extreme security.
### Docker Image File Structure
-teddysun/xray image:
+teddysun/xray version image:
-- `/usr/bin/xray`: Xray-core executable
-- `/etc/xray/config.json`: Single configuration file (its directory is the mount point)
-- `/usr/share/xray/`: Resource directory containing v2fly geodata files
+- `/usr/bin/xray`: Xray main program
+- `/etc/xray/config.json`: Single configuration file (its directory is a mount point)
+- `/usr/share/xray/`: Resource file directory, stores v2fly version geolocation data files
- geoip.dat
- geosite.dat
-ghcr.io/xtls/xray-core image:
+ghcr.io/xtls/xray-core version image:
-- `/usr/local/bin/xray`: Xray-core executable (owner: root:root, permissions: 755)
-- `/usr/local/etc/xray/`: Configuration directory (mount point). Owner: root:root, directory permissions: 755, file permissions: 644
+- `/usr/local/bin/xray`: Xray main program (Owner is root:root, file permissions 755)
+- `/usr/local/etc/xray/`: Configuration file directory (Mount point) (Owner is root:root, directory permissions 755, file permissions 644)
- 00_log.json
- 01_api.json
- 02_dns.json
@@ -109,39 +111,55 @@ ghcr.io/xtls/xray-core image:
- 07_transport.json
- 08_stats.json
- 09_reverse.json
-- `/usr/local/share/xray/`: Resource directory containing Loyalsoldier geodata files (same permissions as above)
+- `/usr/local/share/xray/`: Resource file directory, stores Loyalsoldier version geolocation data files (Permissions same as above)
- geoip.dat
- geosite.dat
-- `/var/log/xray/`: Log directory (mount point). Directory owner: root:root, permissions: 755. File owner: 65532:65532, permissions: 600
+- `/var/log/xray/`: Log file directory (Mount point) (Directory owner is root:root, permissions 755; File owner is 65532:65532, permissions 600)
- access.log
- error.log
-# GUI Client
+# Graphical Clients
- OpenWrt
- [PassWall](https://github.com/xiaorouji/openwrt-passwall), [PassWall 2](https://github.com/xiaorouji/openwrt-passwall2)
- [ShadowSocksR Plus+](https://github.com/fw876/helloworld)
- [luci-app-xray](https://github.com/yichya/luci-app-xray) ([openwrt-xray](https://github.com/yichya/openwrt-xray))
+- Asuswrt-Merlin
+ - [XRAYUI](https://github.com/DanielLavrushin/asuswrt-merlin-xrayui)
- Windows
+ - [v2rayA](https://github.com/v2rayA/v2rayA)
- [v2rayN](https://github.com/2dust/v2rayN)
- [Furious](https://github.com/LorenEteval/Furious)
- [Invisible Man - Xray](https://github.com/InvisibleManVPN/InvisibleMan-XRayClient)
+ - [AnyPortal](https://github.com/AnyPortal/AnyPortal)
- Android
- [v2rayNG](https://github.com/2dust/v2rayNG)
- [X-flutter](https://github.com/XTLS/X-flutter)
- [SaeedDev94/Xray](https://github.com/SaeedDev94/Xray)
-- iOS & macOS arm64
+ - [SimpleXray](https://github.com/lhear/SimpleXray)
+ - [AnyPortal](https://github.com/AnyPortal/AnyPortal)
+- iOS & macOS arm64 & tvOS
+ - [Happ](https://apps.apple.com/app/happ-proxy-utility/id6504287215) ([tvOS](https://apps.apple.com/us/app/happ-proxy-utility-for-tv/id6748297274))
- [FoXray](https://apps.apple.com/app/foxray/id6448898396)
- [Streisand](https://apps.apple.com/app/streisand/id6450534064)
- macOS arm64 & x64
+ - [Happ](https://apps.apple.com/app/happ-proxy-utility/id6504287215)
+ - [v2rayA](https://github.com/v2rayA/v2rayA)
+ - [v2rayN](https://github.com/2dust/v2rayN)
- [V2rayU](https://github.com/yanue/V2rayU)
- [V2RayXS](https://github.com/tzmax/V2RayXS)
- [Furious](https://github.com/LorenEteval/Furious)
- - [FoXray](https://apps.apple.com/app/foxray/id6448898396)
+ - [OneXray](https://github.com/OneXray/OneXray)
+ - [GoXRay](https://github.com/goxray/desktop)
+ - [AnyPortal](https://github.com/AnyPortal/AnyPortal)
- Linux
- [v2rayA](https://github.com/v2rayA/v2rayA)
+ - [v2rayN](https://github.com/2dust/v2rayN)
- [Furious](https://github.com/LorenEteval/Furious)
+ - [GorzRay](https://github.com/ketetefid/GorzRay)
+ - [GoXRay](https://github.com/goxray/desktop)
+ - [AnyPortal](https://github.com/AnyPortal/AnyPortal)
# UUID Generator
-Third-party UUID generator [uuidgenerator.net](https://www.uuidgenerator.net)
+Third-party UUID generator: [uuidgenerator.net](https://www.uuidgenerator.net)
diff --git a/docs/en/document/level-0/ch01-preface.md b/docs/en/document/level-0/ch01-preface.md
index 25a132d4..c5c1e5e8 100644
--- a/docs/en/document/level-0/ch01-preface.md
+++ b/docs/en/document/level-0/ch01-preface.md
@@ -1,99 +1,95 @@
-# [Chapter 1] Simple and Plain Language
+# [Chapter 1] Plain English Guide for Absolute Beginners
-## 1.1 Who is this document written for?
+## 1.1 Who is this document for?
-One sentence: Written for newbies who are **(1) absolute beginners** and **(2) interested in learning how to build their own VPS**.
+In short: It is written for newcomers who have **① Zero technical background** and **② A desire to learn how to self-host a VPS**.
-## 1.2 Who is this document not written for?
+## 1.2 Who is this document NOT for?
-Including but not limited to: experts and professionals, beginners who are too lazy to tinker on their own, advanced users who already know how to tinker, wealthy users who insist on using airport services, and those who prefer using one-click scripts. In short, if you have a technical background or don't want to build it yourself, you can close this article directly, because this article may not be suitable for you and may even make you upset.
+Including but not limited to: various tech gurus, beginners too lazy to tinker, experts who already know the ropes, big spenders determined to use "Airports" (VPN service providers), and the "Carefree Sect" determined to use one-click scripts... In short, as long as you have a technical foundation or are unwilling/don't want to build it yourself, you can close this article right now. This article probably won't meet your high standards and might just make you angry over nothing, which isn't worth it.
-## 1.3 Declaration and Other Statements
+## 1.3 Solemn Declaration and Other Declarations
-Declaration:
+**Solemn Declaration:**
-My technical skills are extremely limited, so this article is inevitably full of errors and flaws. If you find any problems, please kindly point them out and don't be too harsh on me.
+My technical skills are incredibly poor, so this text will inevitably have omissions and be full of flaws. If you find issues, please remind me gently; do not engage in personal attacks.
-Disclaimer:
+**Disclaimer:**
-Please judge the reliability and usability of the content of this article by yourself. If you encounter any problems or negative results when establishing and using a VPS server based on the content of this article, I am not responsible for it.
+Please judge the credibility, reliability, and usability of this content yourself. I am not responsible for any issues or adverse results arising from building and using a VPS server based on this content.
-Verbose statement:
+**Verbose Declaration:**
-Considering the target audience of this article, which is "users with zero experience", many details will be explained in great detail, so the language may be verbose. Please be mentally prepared for this.
+Based on the target audience of this article (Zero-basis users), many contents will be explained as exhaustively as possible. Therefore, the language will lean towards being wordy/long-winded. Please be mentally prepared.
-## 1.4 Why is self-hosting a challenge?
+## 1.4 Why is self-hosting a difficult problem?
-To answer this question, we need to provide a little more background information.
+To answer this question, we need to provide a bit more background information.
-1. On the matter of accessing the internet through scientific means
+**I. The matter of Scientific Internet Access (Circumvention)**
-The act of accessing the internet using scientific methods has been around for almost 20 years (shocking!!!.jpg). Initially, one could do it with a little effort (changing the host file, using SSH), then one had to find a web proxy, and later, one had to develop a private protocol (such as Shadowsocks) and so on.
+The practice of "Scientific Internet Access" (circumventing the firewall) has been developing for nearly twenty years (Shocking!!!.jpg). Initially, you only needed to move your hands a little (tweak the hosts file, connect via SSH). Later, you needed to find a web proxy, and then later you needed to write a private protocol (like Shadowsocks), and so on.
-With the continuous iteration and upgrade of GFW technology over the past decade, to achieve the goal of [building your own scientific Internet access], the things that need to be done include but are not limited to:
+With the GFW technology constantly iterating and upgrading over the last decade, the tasks required to achieve the goal of "Do-It-Yourself Circumvention" now include but are not limited to:
-- Understand basic Linux commands
-- Understand network transmission protocols
-- Have the technical and financial ability to purchase and manage a VPS
-- Have the technical and financial ability to purchase and manage a domain name
-- Have the technical ability to apply for a TLS certificate, and so on.
+- Understanding basic Linux system commands
+- Understanding network transmission protocols
+- Having the technical and financial capability to complete VPS purchase and management
+- Having the technical and financial capability to complete Domain purchase and management
+- Having the technical capability to complete TLS certificate application, etc.
-This has turned the once simple act of [setting up a self-built VPS for accessing the internet in a secure and unrestricted manner] into a daunting challenge that intimidates newcomers.
+This has turned the once-simple act of "self-hosted VPS circumvention" into a daunting challenge for newcomers.
-2. Helplessness of Zero-based Users
+**II. The helplessness of zero-basis users**
-For non-technical users with zero foundation, if they complete the above series of operations, they will inevitably need to learn a lot of knowledge. However, after a little searching, newbies are likely to become even more confused: a large amount of information is scattered in various corners of the Internet: blogs, Q&A sites, groups, forums, GitHub, Telegram, YouTube, and so on. These pieces of information are chaotic and complex, with varying levels of quality, and may even contradict each other. Basically, they won't stop until they completely confuse the newcomer.
+If a zero-basis, non-technical user wants to complete the series of operations above, they inevitably have to learn a vast amount of knowledge. However, after a little searching, the newcomer will likely become even more lost: massive amounts of information are scattered across every corner of the Internet (blogs, Q&A sites, groups, forums, GitHub, Telegram, YouTube, etc.). This information is chaotic, complex, of varying quality, and potentially contradictory. Basically, it won't stop until the newcomer is completely dizzy.
-Faced with such chaotic information, newcomers suddenly shift from [information scarcity] to [information overload]. If they fail after several attempts of groping and guessing (which is highly probable), their enthusiasm is bound to be greatly frustrated. In this process, if they happen to seek help in some unfriendly places, they may be ridiculed even more: "You're so inexperienced, just use the airport, why bother messing around!" "Go learn Linux first before coming back to ask."
+Faced with this disorganized information, the newcomer suddenly goes from "information scarcity" to "information overload." If they try to muddle through a few times and end up failing (which is highly probable), their enthusiasm will inevitably suffer a major setback. During this process, if they happen to go to some unfriendly places to ask for help, they might be ridiculed, adding insult to injury: "If you're so bad at this, just use an Airport, why are you blindly tinkering?", "Go learn Linux first before coming back to ask."
-At this moment, probably only an "hehe" can express the mood.
+At this point, perhaps only a sarcastic "Heh" can express one's mood.
-## 1.5 "Why not just use the airport?"
+## 1.5 "Isn't using an airport enough?"
-An Airport refers to a pre made solution, where a provider is responsible all technical aspects of hosting and providing the service as mentioned in section 1.4, with the user only paying for the right to use the service.
+First, I want to ask those who sneer: Is "using an airport" really a panacea?
-First of all, I would like to respond to critics by asking a question: Is using an airport really a cure all?
+Secondly, I believe there is a fundamental difference between "not understanding" and "not wanting to understand." While entitled "giant babies" with bad attitudes are naturally annoying, people who genuinely want to self-study but can't find the way shouldn't be subjected to unwarranted eye-rolls and discrimination. It is precisely this toxic community atmosphere that makes no distinction regarding newcomers that prompted me to write this article. So, without further ado, let's look at the pros and cons of airports:
-Secondly, I believe that there is a fundamental difference between "not understanding" and "not wanting to understand". The bad attitude of some people who just want handouts is naturally annoying, but those who sincerely want to learn but don't know how should not be subject to unjustified contempt and discrimination. It is precisely this kind of bad community atmosphere that does not distinguish between newcomers that prompted me to write this article. So without further ado, let's take a look at the advantages and disadvantages of using an airport:
+**I. Advantages of "Airports"**
-- Advantages of "Airports"
+A so-called "Airport" is a "Line Provider" (VPN/Proxy Service). They handle the string of technical operations and management mentioned in 1.4, and the user pays for the right to use it. Therefore, its advantages are at least:
-1. **Stability**: Airports usually feature multiple exit nodes, hence resistance to attempts at blocking these node, if one get block simply switch to another
-2. **Speed**: Airports typically make use of high capacity machines and high throughput network infrastructures, therefore you can expect a higher overall network speed
-3. **Safety**: Airports are generally have good security practices, such as encryption and firewalls to ensure the security of user data
-4. **reliability**: Airports employ a dedicated team to manage their services ensuring they remain online and reliable
-5. **support**: you can generally expect an Airport to have a support team to answer your queries.
-6. **Simplicity**: One-click rule addition, Scannable configurations, etc.
-7. **diverse-exit-nodes**: Useful to access geo-restricted content or to get a lower ping for gaming
+1. **Simple User Operation**: Scanning QR codes, one-click rule addition, etc.
+2. **Many Line Choices**: Can unlock network services in different countries and regions; such as IPLC dedicated lines, game acceleration services, etc.
+3. **Many Access Nodes**: Stronger ability to resist node blocking; if one gets blocked, just switch to the next.
-- Risks of "Airport"
+**II. Risks of "Airports"**
-"The counterpart of convenience in 'internet' security is 'risk', some risk of 'airports' you can find on the market are"
+The other side of the "convenience" coin is "risk." Based on the technical characteristics and market situation of "Airports," the risks are at least:
-1. service providers can obtain all infomation that passes through their servers, these data are very likely stored by the providers for a long time with little legal means to stop them
-2. there is little governance on the market for "airports", meaning there are plenty cases of fraud where providers disappear after being paid
-3. Service providers can face regulatory pressures, while large providers are relatively secure, they cannot avoid attention from the government, In 2020 there are many cases where several large airports experience major service disruptions
-4. A providers technical prowess is difficult to determine, the quality of the service provided varies greatly, with false advertising being common
+1. **"Airports" can fully access user information**: All user traces on the Internet *inevitably* pass through and are *very likely* stored on their servers for a long time. These records are not bound by any legally effective user privacy agreements (**peeping, recording your every move**).
+2. **"Airports" lack market regulation**: There are inevitably malicious merchants aiming at fraud (**active exit scams/running away**).
+3. **"Airports" face regulatory pressure**: While big airports are relatively secure, they cannot avoid attracting attention. In 2020, several large airports suspended operations or ran away, severely interfering with users' normal usage (**passive exit scams/forced shutdown**).
+4. **"Airport" technical levels are hard to determine**: Line quality varies greatly, and deceptive practices are common (**slow speeds, frequent drops, inability to connect**).
-## 1.6 So should you host your own tunnel?
+## 1.6 So, do you want to self-host or not?
-Now that you have seen the advantages and risks of using a service provider, please think carefully and make your own decision on what to use. After all, the best plan is the one that suits you best.
+Now that you have seen the advantages and risks of airports, please think fully and decide for yourself what to use. After all, the solution that suits you best is the best solution.

-1. If you decide to use an existing service provider, you can close this article now.
+1. If you decide to use an airport, you can close this article now.
-2. If you decide to build it yourself, please continue reading the following chapters!
+2. If you decide to self-host, please continue reading the following chapters!!
-In short, the goal of this article is to serve as a starting point for users with zero experience, providing thorough explanations and demonstrations for each step, even if it may seem overly detailed or repetitive. The aim is to assist beginners in completing the entire process of deploying a VPS server from the first command input to successfully accessing the internet via the client, and gradually introducing them to basic Linux operations, laying a foundation for further self-learning.
+In short, the goal of this article is to become the knowledge starting point for zero-basis users. It provides full explanations and demonstrations for every step, clearly (even **naggingly, chattily, and wordily**) assisting newcomers to complete the entire process from **inputting the first command, deploying the VPS server, to successfully circumventing the firewall on the client side**. In this process, it helps newcomers gradually contact and become familiar with basic Linux operations, laying a foundation for further self-study.
-## 1.7 Some digressions
+## 1.7 A few extra words
-1. There is a wealth of information beyond the wall, so please learn to think rationally and independently. Don't take sides easily and don't believe in sensational information. (This also serves as an reminder for friends live beyond the wall)
+1. Information outside the wall is mixed. Please be sure to learn rational, independent critical thinking. Do not blindly take sides, and do not readily trust sensational information.
-2. We sincerely hope that with a more open internet, everyone can access knowledge in real time, find better entertainment, experience this amazing world, and find like-minded individual to befriend, but do not become a scapegoat for anyone with ulterior motives.
+2. I sincerely hope that after obtaining a smoother network, you can acquire fresh knowledge, richer entertainment, contact a better world, and make more like-minded friends, but do not become a scapegoat for anyone with ulterior motives.
-3. Your internet identity is still your identity, and achieving absolute anonymity is extremely difficult. Therefore, please be sure to comply with the relevant laws and regulations in your personal location and the location of your IP address. Self-preservation should be your highest priority. (TLDR. Please take responsibility for your action on the internet)
+3. Your internet identity is still your identity. Absolute anonymity is extremely difficult, so please be sure to comply with the relevant laws and regulations of your personal location and your IP location. At all times, self-protection is the most basic bottom line.
## 1.8 Your Progress
diff --git a/docs/en/document/level-0/ch02-preparation.md b/docs/en/document/level-0/ch02-preparation.md
index 26481255..806f34a9 100644
--- a/docs/en/document/level-0/ch02-preparation.md
+++ b/docs/en/document/level-0/ch02-preparation.md
@@ -1,52 +1,53 @@
-# [Chapter 2] Prerequisite and preparations
+# [Chapter 2] Raw Materials Preparation
-This chapter is rather special because it involves monetary transactions. This article takes a neutral stance on the project and does not make specific recommendations. What I can do is to tell you what you need to prepare.
+This chapter is somewhat special because it involves monetary transactions. Based on the neutral stance of this project, no specific recommendations will be made. What I can do is tell you what you need to prepare.
-## 2.1 Acquiring a VPS
+## 2.1 Obtain a VPS
-You need to obtain a healthy VPS with an unblocked IP, and perform the following basic preparations in the management console:
+You need to obtain a healthy VPS whose IP is not blocked, and complete the following basic preparations in the management panel:
-1. Install Debian 10 64 bit Operating System on your VPS.
-2. Note down the IP address of VPS (this article will use `"100.200.300.400"` as an example, which is an intentionally incorrect and illegal IP address. Please replace it with your real IP address).
-3. Note down the SSH remote login port of VPS.
-4. Note down the username and password for SSH remote login.
+1. Install the **Debian 10 64bit** system in the VPS management panel.
+2. Make a note of the VPS IP address (this article will use `"100.200.300.400"` to represent it).
+ ::: tip
+ This is a deliberately written illegal IP; please replace it with your real IP.
+ :::
+3. Make a note of the VPS SSH remote login port.
+4. Make a note of the SSH remote login username and password.
-Buying a VPS is a relatively complex matter. It is recommended to first learn the relevant knowledge and choose one that suits your own economic ability and network requirements. In addition, you can choose to take advantage of some benefits offered by tech giants (such as permanent free or limited-time free packages offered by Oracle Cloud Infrastructure and Google Cloud Platform). In any case, you must act within your means.
+Purchasing a VPS is a relatively complex matter. It is recommended to learn some relevant knowledge first and choose one that fits your financial ability and line quality needs. Additionally, you can choose to take advantage of free offers from major international tech giants (such as the permanent free or limited-time free tiers provided by Oracle and Google). In short, please act according to your means.
-:::tip Explanation
-Regarding the choice of Debian 10 as the operating system, let me elaborate a bit: No matter what you have heard online, no matter which guru has told you that XXX version of Linux is better or XXX version of Linux is more powerful, these sectarian disputes have **nothing to do with you right now**! Using Debian 10 is enough to optimize your VPS server for security, stability, and performance (such as using cloud-optimized kernel, timely support of BBR, etc.). After you become familiar with Linux, you can try other Linux distributions.
+::: tip Note
+Regarding the choice of Debian 10 as the operating system, let me add a few words here: No matter what you hear online, no matter which "guru" tells you that XXX version of Linux is better or XXX version of Linux is cooler, these Linux distro wars **have absolutely nothing to do with you right now**! Using Debian 10 is sufficient to allow your VPS server to run securely and stably while receiving enough optimization (such as cloud-specific kernels, timely BBR support, etc.). Once you are familiar with Linux, it won't be too late to look back and try other Linux distributions.
:::
-## 2.2 Obtaining a Desired Domain Name
+## 2.2 Obtain a Desired Domain Name
-You need to obtain a domain name and add an A record in the DNS settings, pointing to the IP address of your VPS.
+You need to obtain a domain name and add an A record in the DNS settings pointing to your VPS IP address.
-1. Please choose a reliable international domain name service provider. Choose some common domain name suffixes, and make sure not to use the `.cn` suffix.
-2. In the DNS settings, add an A record pointing to the IP address of your VPS (the name of the A record can be anything, and in this article, it will be represented by `"a-name"`). The complete domain name will be represented by `"subdomain.yourdomain.com"` or `"a-name.yourdomain.com"`. The effect is as shown in the picture below:
+1. Please choose a reliable international domain registrar. Choose some common domain suffixes, but be careful **not** to use the `.cn` suffix.
+2. In the DNS settings, add an **A record** pointing to your VPS IP address (The name of the A record can be anything; this article will use `"a-name"` to represent it. The full domain name will be represented as `"subdomain.yourdomain.com"` or `"a-name.yourdomain.com"`). The effect is shown in the figure below:

::: tip
-This is **not** a real usable website. Please replace it with your real website URL.
+This is **not** a real, usable URL; please replace it with your real URL.
:::
-## 2.3 Software you need to install on your local computer
+## 2.3 Software to Install on Your Local Computer
-1. SSH remote login tool
+1. **SSH Remote Login Tool**
+ * Windows: [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)
+ * macOS/Linux: Terminal
-- Windows: [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)
- - macOS/Linux: Terminal
+2. **Remote File Copy Tool**
+ * Windows: [WinSCP](https://winscp.net/eng/index.php)
+ * macOS/Linux: Terminal
-2. Remote file copying tool
-
-- Windows: [WinSCP](https://winscp.net/eng/index.php)
- - macOS/Linux: Terminal
-
-3. Reliable text editor
- - Windows/macOS/Linux: [VSCode](https://code.visualstudio.com)
+3. **Reliable Text Editor**
+ * Windows/macOS/Linux: [VSCode](https://code.visualstudio.com)
## 2.4 Your Progress
-If you have all the raw materials ready as mentioned above, you have already obtained the key to unlocking the door to a new world. So, what are you waiting for? Let's quickly move on to the next chapter and step through this door!
+If you have prepared all the raw materials above, you have obtained the key to opening the door to a new world. So what are you waiting for? Let's move on to the next chapter and walk through that door!
> ⬛⬛⬜⬜⬜⬜⬜⬜ 25%
diff --git a/docs/en/document/level-0/ch03-ssh.md b/docs/en/document/level-0/ch03-ssh.md
index 203bacfb..65a9554c 100644
--- a/docs/en/document/level-0/ch03-ssh.md
+++ b/docs/en/document/level-0/ch03-ssh.md
@@ -2,88 +2,83 @@
## 3.1 Remote Login to VPS (PuTTY)
-First of all, considering that the user base of Windows is the largest among the zero-based population, this article uses Windows as an example for demonstration.
+First, given that Windows has the largest user base among beginners, this article will use Windows as an example.
-Secondly, although PowerShell and WSL after Windows 10 can also achieve a good SSH operation experience, not all versions of Windows have the latest components. Therefore, this article uses the classic PuTTY as an example to provide a detailed explanation of SSH remote login operation. (If you use other tools, the operations after the SSH login are the same.)
+Secondly, although modern Windows 10 and later versions feature PowerShell and WSL which offer a great SSH experience, not all versions of Windows have the latest components. Therefore, we will use the classic tool **PuTTY** for this detailed SSH tutorial. (If you use other tools, the operations after logging in are identical.)
-Follow me step by step and let's start the operation.
+Now, follow me step by step.
-1. Go to the [official website](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) of PuTTY and download the version that suits your operating system (this article uses the 64-bit version as an example).
+1. Go to PuTTY's [official website](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) and download the version suitable for your operating system (this article uses the 64-bit version).
-
+ 
-2. After installation and running, you will see the main interface of PuTTY. Now please take out your notebook from the previous chapter where you wrote down the **IP address (VPS IP)** and **port (VPS PORT)** of your VPS in the corresponding positions of the following figure. In order to save time and avoid repeatedly entering these details in the future, we can save the session (Saved Sessions), and simply load it in the future with one click.
+2. After installation, open PuTTY. Now, take out the [notebook](./ch02-preparation.md#21-getting-a-vps) where you jotted things down in the previous chapter. Fill in your VPS **IP Address** and **Port** in the corresponding fields shown below. To avoid typing this every time, we can save the session. Just click `Save` under Saved Sessions, and in the future, click `Load` to restore settings instantly.
-
+ 
-3. I suggest setting `keepalive` to `60` seconds in the `Connection` to prevent SSH from automatically disconnecting after a period of inactivity. Be sure to save the settings again.
+3. I suggest setting `Seconds between keepalives` under `Connection` to `60`. This prevents SSH from automatically disconnecting due to inactivity. **Make sure to save your session settings again.**
-
+ 
-::: warning Attention
-Any update to the PuTTY configuration needs to be manually saved to the session again. Otherwise, it will be lost after closing.
+::: warning Note
+Any setting updates in PuTTY must be manually saved to the Session again, otherwise, they will be lost when you close the program.
:::
-4. Click on Open to enter the SSH connection window, then enter the username and password corresponding to the following figure to establish a connection with your VPS remote host. (This article assumes that the default username is `root`. Also, when entering a password in the Linux system, there will be no prompt like `******`, which can avoid password length leakage. It's not that your keyboard is broken!)
+1. Click `Open` to enter the SSH connection window. Enter your username and password as shown below to connect to your VPS. (This article assumes the default username is `root`. Also, when typing passwords in Linux, **no asterisks `******` will appear**. This prevents password length leakage—your keyboard isn't broken!)
-
+ 
-## 3.2 Successfully Logging in SSH! Introduction to Command Line Interface!
+## 3.2 Successfully Logged into SSH! Meet the Command Line Interface
-1. If you have filled in your information correctly, you will see a similar interface as the picture below, indicating that you have successfully logged in:
+1. If you entered everything correctly, you will see a screen similar to the one below, indicating a successful login:
-
+ 
-This interface is equivalent to the "desktop" of a remote server, but it does not have familiar icons and a mouse, nor does it have colorful graphics. Instead, all you see is simple text. This is the "**Command Line Interface**" - shortened as `CLI`.
+ This interface is the remote server's [Desktop], but without the icons, mouse, or colorful graphics you are used to. It's just simple text. This is the **Command Line Interface** (CLI).
-All the following operations require you to act like a hacker in a movie and complete them in this command-line interface. Maybe you will feel unfamiliar, but please believe me, using the command-line interface is neither scary nor mysterious. In the end, it just turns your familiar mouse operations into textual commands, **you say it, it does it**.
+ All subsequent operations require you to work in this interface, just like a hacker in the movies. It might feel strange, but trust me, the command line is neither scary nor mysterious. Ultimately, it just turns your mouse clicks into text commands: **You say it, it does it**.
-2. Now, you can observe and familiarize yourself with the command line environment a little bit. This interface has actually provided you with some useful information, such as the system kernel version (e.g. `4.19.37-5` in the picture), last login time and IP address. Of course, depending on the VPS, the interface you see may be slightly different.
+2. Now, look around and get familiar with the CLI environment. This interface actually tells you some useful info, like the system kernel version (e.g., `4.19.37-5` in the image), last login time, and IP. Of course, depending on your VPS, what you see might differ slightly.
-3. Please pay attention to the line at the bottom of the command line, to the left of the flashing cursor, there is a string of characters. The one shown in the figure is `root@vps-server:~#`. How to understand this string? It's very simple:
+3. Pay attention to the last line, to the left of the flashing cursor. There is a string of characters. In the image, it shows `root@vps-server:~#`. How should you understand this? Simple:
+ - The current user is `root`
+ - The server `root` is on is `vps-server`
+ - The folder `root` is currently in is `~`
+ - The `#` indicates where you can type commands
-- The current user is `root`
-- The server where `root` is located is `vps-server`
-- The current directory where `root` is located is `~`
-- After `#` is the place where you can input commands.
+ The first two are intuitive. The third is about the Linux file system; for now, just know that "`~`" is the [Current User's Home Base]. The fourth, the prompt `#`, doesn't need much thought. Just know that in future articles, commands you need to type will start with `#` or `$`, indicating **where** you start typing. (So when copying commands, **only copy the content after this symbol**, do not copy the prompt itself.)
-The first two are pretty straightforward, no need to explain further. The third one is about the folder system in Linux. You don't need to go too deep into it for now. Just know that "`~`" represents **the home directory of the current user**. As for the fourth one, the prompt symbol "`#`", you don't need to worry about it either. Just know that in future articles, there will be some commands that you need to input, and they will be preceded by "`#`" or "`$`" to indicate **where you should input the command**. (So when you copy the command, **just copy the content after the prompt symbol** and don't copy the prompt symbol itself.)
+## 3.3 Updating Linux Software for the First Time
-## 3.3 Updating software on Linux for the first time!
+1. Just like your phone (Android or iPhone) checks the App Store for updates (security patches and new features), Linux has a very similar update logic. If you can update apps on your phone, you can update Linux software!
-1. Just like your phone, whether it's Android or iPhone, in order to keep your apps up-to-date (to get security patches and new features), you will occasionally receive update notifications from the app store, telling you how many apps need to be updated. Linux systems also have a similar update mechanism that works logically. So as long as you know how to update phone apps, you can learn how to update Linux software!
+2. In Linux, every app is called a "package". The program that manages apps is naturally called the "Package Manager". You can install, update, and uninstall software, or even update the Linux system itself through it. The package manager is powerful, but for now, you only need to know that the Debian system's manager is called `apt`. Next, let's use `apt` to perform a full software update to get familiar with it.
-2. In Linux, each application is called a "package". The program that manages the applications is naturally called a "package manager". You can use it to install, update, and uninstall various software, and even update the Linux system itself. Package managers in Linux are very powerful, but we won't go into details here. For now, you only need to know that the package manager for the Debian system is called `apt`. Next, we will first use `apt` to do a comprehensive update of the software to familiarize you with its basic operations.
+3. Basic Linux commands for beginners:
-3. Tiny White Linux Basic Commands:
+ | Code | Command Name | Description |
+ | :---: | :---: | :---: |
+ | `cmd-01` | `apt update` | Check for software updates |
+ | `cmd-02` | `apt upgrade` | Execute software updates |
-| Number | Command Name | Command Description |
-| :------: | :-----------: | :----------------------: |
-| `cmd-01` | `apt update` | Query software updates |
-| `cmd-02` | `apt upgrade` | Perform software updates |
+4. Now enter the first command to fetch update information:
-4. Now, please enter the first command to get update information.
+ ```shell
+ apt update
+ ```
-```shell
-apt update
-```
+5. Then enter the second command. When asked whether to continue `(Y/n)`, type `y` and hit Enter to start the installation:
-This is a command used in a Linux terminal to update the package list from the repositories configured on the system.
+ ```shell
+ apt upgrade
+ ```
-5. Then enter the second command, and when asked if you want to continue installing `(Y/n)`, type `y` and press enter to confirm and start the installation.
+6. The complete process is demonstrated below:
-```shell
-apt upgrade
-```
-
-This is a command in the shell terminal to upgrade the installed packages on a Debian or Ubuntu Linux system.
-
-6. The complete demonstration of the process is as follows:
-
-
+ 
## 3.4 Your Progress
-**Congratulations on taking another solid step!** Now, you can log in to your remote server via SSH! After logging in, besides upgrading the software, what else should you do? Please enter the next chapter to find out!
+**Congratulations on taking another solid step!** Now, you can log in to your remote server via SSH! After logging in and updating software, what should you do next? Head to the next chapter to find out!
> ⬛⬛⬛⬜⬜⬜⬜⬜ 37.5%
diff --git a/docs/en/document/level-0/ch04-security.md b/docs/en/document/level-0/ch04-security.md
index cd0fe77d..8cb70fc5 100644
--- a/docs/en/document/level-0/ch04-security.md
+++ b/docs/en/document/level-0/ch04-security.md
@@ -1,351 +1,319 @@
-# [Chapter 4] Security and Protection
+# [Chapter 4] Security Protection
-## 4.1 Why Do We Need Security Protection?
+## 4.1 Why Security Protection is Necessary
-Security protection for Linux servers is a complex and huge subject. Countless websites, apps, services, and even offline infrastructure are built on the foundation of Linux, which involves huge economic benefits and commercial value. This also means that there is a huge motivation for black and gray industries to launch attacks. However, these services are so important that major security vulnerabilities are not allowed. Therefore, countless operation and maintenance professionals are working hard on the battlefield of security attacks and defense, which enables us to enjoy a basic stable modern digital life.
+Security protection for Linux servers is a vast and complex topic. Countless websites, apps, services, and even offline infrastructure are built upon the foundation of Linux. Behind this lies enormous economic interest and commercial value, which naturally implies that the black/gray market has a huge motivation to attack. However, these services are so critical that major security vulnerabilities simply cannot be allowed. Consequently, countless operations professionals strive on the battlefield of security offense and defense, allowing everyone to enjoy a basically stable modern digital life.
-Now, you have a VPS and will open its data access channel to achieve the goal of traffic forwarding, which means you are now on the front line of the security battle and face all risks. However, at the same time, newcomers tend to have a polarized view of security issues due to lack of knowledge and information: either they feel it is as light as a feather and has nothing to do with them, or they feel it is as heavy as Mount Tai and feel anxious all day long.
+Now that you own a VPS and will be opening up its data access channels to achieve traffic forwarding, you have effectively placed yourself on the front lines of this security battlefield, facing all risks directly. However, due to a lack of knowledge and information, newcomers often view security issues with polarized attitudes: they either feel it's trivial and has nothing to do with them, or they feel the weight is unbearable and live in constant fear.
-- For the former, my suggestion is: safety is of utmost importance. Try to gather more information on safety issues to avoid regretting after experiencing losses.
+* **For the former**, my advice is: No security matter is too small. Try to research security information as much as possible to avoid regretting it only after you have suffered a loss.
+* **For the latter**, my advice is: Don't panic. Our servers generally don't hold high value and won't attract high-level targeted attacks. We mostly face malicious scanning and login attempts by automated scripts. Just follow this article to implement basic protections.
-- For the latter, my suggestion is: don't worry too much, our servers still don't have too much value and generally won't attract high-level attacks. The basic threats we need to face are mostly malicious scans and login attempts from some automated scripts. Just follow this article to do some basic protection.
+## 4.2 What Exactly Are the Specific Risks?
-## 4.2 What are the specific risks
+Just as we configured in the "Remote Login" chapter, anyone only needs to know four elements—**[IP Address] + [Port] + [Username] + [Password]**—to log into your VPS server. Obviously, the security of these four elements is the baseline we need to protect. Let's analyze them one by one:
-Just like the configuration we did in the "Remote Login" section, anyone who knows the four elements of [IP address] + [port] + [username] + [password] can log in to your VPS server. So obviously, the security of these four elements is the bottom line that we need to protect. Let's analyze them one by one:
+1. **[IP Address]**: Malicious scripts randomly attempt and scan IP ranges. You can simply consider this public information; it cannot be hidden.
+2. **[Port]**: If using the default port, then **[Port = `22`]**.
+3. **[Username]**: If using the default user, then **[Username = `root`]**.
+4. **[Password]**: There is no default password; it is definitely randomly generated by the VPS backend or set by you. This means if your server uses default settings, three of the four elements are already known. The security of your entire server relies entirely on a small string of passwords. Here are a few scenarios:
+ * If you use the random password generated by the VPS panel, it usually contains a dozen mixed-case letters and symbols, which is relatively safe.
+ * If, for the sake of memory, you changed the password to something ultra-weak like `123456`, cracking your VPS server would be effortless.
+ * If, for the sake of memory, you changed the password to something complex but used elsewhere, it is essentially unsafe. You must understand that hackers have "cheat sheets," such as **Password Dictionaries**, containing tens of thousands to millions of leaked real passwords.
-1. [IP Address]: Malicious scripts randomly attempt to scan IP ranges, which can be regarded as public information and cannot be hidden.
+5. **But you must understand**, no hacker is actually sitting in front of a computer trying your password one by one. All attack attempts are carried out automatically by malicious scripts working 24/7. Perhaps while you are sound asleep, your server is enduring round after round of impacts.
-2. [Port]: If you are using the default port, then [Port = `22`].
+ Once the password is successfully brute-forced, it means all your four elements are mastered by the attacker. The malicious script will quickly log in, obtain the highest `root` control of the server, install/deploy its malicious services, and then use your server to do various bad things 24 hours a day (such as mining, spreading viruses, sending spam/phishing emails, acting as a BT relay, or even becoming a public node for the dark web, etc.). If the malicious script is restrained, it can be quite stealthy. Since newcomers generally don't observe VPS login records, process changes, CPU usage, or traffic changes, it is difficult to discover that you have been hacked until your VPS provider bans your account or you receive a lawyer's letter.
-3. [Username]: If using the default user, then [Username = `root`]
+6. **Don't forget**, you likely used real payment information to obtain the VPS, and you leave your IP address when logging into various websites and social platforms. These are directly or indirectly related to your identity. **Once these bad things happen, they will inevitably be linked to you.**
-4. [Password]: There is no default value for the password. It must be randomly generated by the VPS backend or set by you. In other words, if all the settings of your server are default, then three of the four elements are already known. Therefore, the security of your entire server relies on a small password. In this case, there are several situations:
+## 4.3 What Security Protections Will We Implement?
-- If you use a VPS management background to generate passwords randomly, it usually contains random uppercase and lowercase letters, symbols, and is relatively secure.
+Based on the analysis above, what we need to do is naturally strengthen the **[Port]**, **[Username]**, and **[Password]** elements to reduce the risk of being breached:
-- If you changed your password to something super weak like `123456` just for the sake of easy memorization, hacking into your VPS server would be a piece of cake.
+1. **[Port]**: Change the SSH remote login port to a **[Non-22 Port]** (Section 4.4).
+2. **[Username]**: Create a **[Non-root]** new user and disable root SSH remote login (Sections 4.5, 4.6).
+3. **[Password]**: Enable SSH RSA key authentication and disable password authentication (Section 4.7).
-- If you change your password to a more complex one that you have used elsewhere just for the sake of easy memory, it is not really safe. You should understand that hackers have cheats in their hands, such as `password tables`, which contain tens of thousands, hundreds of thousands, millions, or even more real leaked passwords.
+Remember to follow the order so you don't lock yourself out.
-5. But you should understand that no hacker really sits in front of a computer and tries your password repeatedly. All attack attempts are carried out automatically by malicious scripts, which work tirelessly for 24 hours. Perhaps while you are sleeping soundly every night, your server is enduring round after round of attacks.
+## 4.4 Change SSH Remote Login Port to Non-22 Port
-Once the password is successfully cracked, it means that all four of your elements have been mastered by the attacker. The malicious script will quickly log in to the server, obtain the highest `root` control of the server, install and deploy its malicious services, and then use your server to do all kinds of bad things 24 hours a day (such as mining, spreading viruses, sending spam emails, fraudulent emails, acting as a BT relay, and even dark web public nodes, and so on). If the malicious script is relatively restrained, it can actually achieve considerable concealment. Generally, newcomers will not observe and pay attention to indicators such as login records, process changes, CPU usage changes, and traffic changes of the VPS, so it is difficult for you to discover that you have been hacked. Until your VPS service provider blocks your account or you receive a lawyer's letter.
+Now, let's solve the **[Port = `22`]** issue. (Note: Some VPS providers already use a non-22 port by default. You can skip this step or follow along to change it to another port).
-6. Don't forget that when you obtain a VPS, you probably need to use your real payment information, and when you log in to various websites and social platforms, your IP address will also be recorded, which has a direct or indirect relationship with your identity. Therefore, once these bad things happen, they will inevitably be associated with you.
+1. **Newbie Linux Basic Commands:**
-## 4.3 What security measures do we need to take
+ | ID | Command Name | Command Description |
+ | :---: | :---: | :---: |
+ | `cmd-03` | `nano` | Text Editor |
+ | `cmd-04` | `systemctl restart` | Restart a specific service |
-Based on the above analysis, what we need to do is to strengthen the three elements of [port], [username], and [password] to reduce the risk of being hacked.
+2. **Newbie Linux Basic Configuration Files:**
-1. [Port]: Modify the SSH remote login port to a [non-22 port] (4.4).
-2. [Username]: Create a [non-root] new user and disable root user SSH remote login (4.5, 4.6).
-3. [Password]: Enable RSA key verification for SSH login and disable password verification login (4.7).
+ | ID | Config File Location | File Description |
+ | :---: | :---: | :---: |
+ | `conf-01` | `/etc/ssh/sshd_config` | SSH Remote Login Program Settings |
-Remember to follow the order and don't lock yourself out.
+3. The first thing we need to do is **[Use the `nano` text editor to open the `SSH Remote Login Program Settings`]**. In Windows, you would "find the file and double-click it." What about in Linux? Look at the command description above; isn't it simple? That's right, it is:
-## 4.4 Change the SSH Remote Login Port to a Non-22 Port
+ ```shell
+ nano /etc/ssh/sshd_config
+ ```
-Now, let's solve the problem of "port = `22`". (Note: some VPS service providers have non-22 ports set as default, so you can ignore this step if that's the case. Of course, you can also follow this article to change it to another port.)
+4. After the file opens, you enter the `nano` interface. Observe briefly, and you'll find that it displays important shortcut keys at the bottom of the screen (in the red box below). It's like an open-book exam; no need for rote memorization. Isn't that thoughtful?
-1. Basic commands of Little White Linux:
+ 
-| ID | Command Name | Description |
-| :------: | :-----------------: | :---------------: |
-| `cmd-03` | `nano` | Text editor |
-| `cmd-04` | `systemctl restart` | Restart a service |
+5. The second thing we need to do is **[Find `Port` in the opened file and modify its port number]**. The number after `Port` is the SSH port. It is generally recommended to change it to an integer greater than `1024` and less than `65535` (this article uses `9753` as an example). Combining with `nano` shortcuts, how should we operate? As expected, you got it right again!
+ * Use `ctrl+w` to enter search mode, then type `Port 22` and hit Enter.
+ * Delete `22` and change it to `9753`.
+ * **Note:** If the line starts with a `#`, it means this line is **[Not Effective]** (commented out). You can write a new one without `#` at the end of the file like I did, or just delete the `#`.
-2. Basic Configuration Files of Little White Linux
+ ::: warning
+ Using `9753` as an example in this article means that with the release of this article, this port will become a minor characteristic. It might be prioritized by attackers or interfered with/blocked by the GFW. Therefore, I strongly suggest you use a different port number you come up with yourself. After all, you have over 60,000 ports to choose from freely.
+ :::
-| Number | Configuration File Location | File Description |
-| :-------: | :-------------------------: | :-------------------------------: |
-| `conf-01` | `/etc/ssh/sshd_config` | SSH Remote Login Program Settings |
+6. The third thing we need to do is **[Save the file and exit]**.
+ * If you observed carefully in step 3, you'd notice that save isn't the common `ctrl+s`.
+ * **Correct Shortcuts:** Save is `ctrl+o` + `Enter`, Exit is `ctrl+x`.
+ * **(Some Operating Systems)** Add a firewall rule for the new SSH port; otherwise, you won't be able to login via SSH after the instance restarts.
+ * Example for Ubuntu `ufw`:
-3. The first thing we need to do, of course, is to [open the SSH remote login program settings with the text editor `nano`]. In Windows, you will [find the file and double-click] it. What should you do in Linux? Take a close look at the command instructions above, isn't it simple? Yes, it is:
+ ```shell
+ sudo ufw allow 9753/tcp
+ ```
-```shell
-nano /etc/ssh/sshd_config
-```
+7. The final thing to do is **[Restart the SSH service to make changes take effect]**:
-This is a command in the shell terminal to open the `sshd_config` file located in the `/etc/ssh/` directory using the `nano` text editor.
+ ```shell
+ systemctl restart ssh
+ ```
-4. Once the file is opened, you will enter the interface of `nano`. After observing for a while, you will find that it displays important shortcut keys at the bottom of the screen (enclosed in a red box in the figure below). You can take the exam directly without memorizing them, which is very user-friendly, isn't it?
+ *Then try to open a new session in your SSH software to see if you can connect. If there are issues, you can modify the configuration via the old SSH session (the SSH session that was already open when sshd restarted will not be closed).*
-
+8. Full process demonstration:
-5. The second thing we need to do is to **find the `Port` item in the opened file and modify its port**. The number after `Port` is the SSH port. It is generally recommended to change it to an integer greater than `1024` and less than `65535` (this article takes `9753` as an example). Please think about how to operate it with the shortcut keys of `nano`. You are right again! It is:
+ 
-- Use `ctrl+w` to enter search mode, then type `Port 22` and press Enter
-- Delete `22` and replace it with `9753`
-- Note: If this line starts with `#`, it means that this line is [commented out] and [does not take effect]. You can write a new line at the end of the file without `#`, or delete the `#` to enable this line.
+9. **Modify PuTTY Configuration**
+
+ Now that the new port is effective, you must use `9753` the next time you log in with PuTTY. So, please go to PuTTY settings, change the port number, and **Save Session**. You know where to change it, right? (If not, re-read the previous content!)
+
+## 4.5 Create a Non-root New User
+
+Step two, let's solve the **[Username = `root`]** issue.
+
+First, you need to understand that `root` in a Linux system is not just a simple administrator account. It is the **foundation** of the entire system, the master, the supreme god. Once the `root` account has a security issue, the entire system is at the mercy of others with nowhere to run. So follow me to operate:
+
+1. **Newbie Linux Basic Commands:**
+
+ | ID | Command Name | Command Description |
+ | :---: | :---: | :---: |
+ | `cmd-05` | `adduser` | Add a user to the system |
+ | `cmd-06` | `apt install` | Install specific software |
+ | `cmd-07` | `visudo` | Dedicated editor for modifying sudo permissions |
+
+2. The first thing to do is **[Add a new user and set a login password]**. You can name it whatever you want; I will use `vpsadmin` as an example:
+
+ ```shell
+ adduser vpsadmin
+ ```
+
+ After executing the command, follow the prompts. **Be sure to set a user password** (don't forget that you won't see `******` when typing the password). Afterward, the system will ask for some additional user info; you can ignore these and just keep hitting Enter.
+
+ 
+
+ ::: warning
+ Using `vpsadmin` as an example means this username will also become a minor characteristic upon this article's release. Like the port, I strongly suggest you use a different username you create yourself.
+ :::
+
+3. Full process demonstration:
+
+ 
+
+4. The second thing to do is **[Install the `sudo` function]** (`sudo` allows a standard account to temporarily gain the power of `root` at critical moments to save the world).
+
+ ```shell
+ apt update && apt install sudo
+ ```
+
+ Smart users may have noticed this line is actually two commands. The first half `apt update` you've seen and used before; it refreshes software version info. The latter `apt install` is the **[Install Command]**. Joined by `&&`, it means [Refresh available software, AND THEN install the latest version of the `sudo` program].
+
+5. The third thing to do is **[Add the `vpsadmin` user to the `sudo` list, granting them eligibility to borrow `root` powers]**.
+
+ ```shell
+ visudo
+ ```
+
+ Under `User Privilege Specification`, add a line: `vpsadmin ALL=(ALL) NOPASSWD: ALL`.
+
+ ::: warning
+ I want to specifically explain the `NOPASSWD` setting. It means the `vpsadmin` user does not need to enter an extra password when using `root` privileges. **This is contrary to general security advice.** The reason I recommend this is that many newcomers ignore danger and persist in using the `root` account simply because they find repeatedly entering passwords annoying. Weighing the lesser of two evils, I believe **[The risk of using the `root` user directly]** is greater than **[The risk of not entering a password when using `sudo`]**, hence the recommendation.
+
+ If you prefer to follow tradition and enter a password every time you use `sudo`, change that line to `vpsadmin ALL=(ALL:ALL) ALL`.
+ :::
+
+6. Full process demonstration:
+
+ 
+
+## 4.6 Disable Root SSH Remote Login
+
+1. Now you are getting familiar with Linux, so let's have you think: what is the first thing we need to do? Correct, it is still **[Use the `nano` editor to open `SSH Remote Login Program Settings`]**. What? Can't remember how? Go review the content above and come back! ... Correct Answer:
+
+ ```shell
+ nano /etc/ssh/sshd_config
+ ```
+
+2. Find the `PermitRootLogin Yes` item, and change its setting to `no`. Remember how? ... Correct Answer:
+ * Use `ctrl+w` to enter search mode, type `PermitRootLogin`, and Enter.
+ * Delete `yes` and change it to `no`.
+
+3. Save the file and exit. Remember how? ... Correct Answer:
+ * Save is `ctrl+o`, then `Enter` to confirm.
+ * Exit is `ctrl+x`.
+
+4. Restart the SSH service to make changes take effect. Remember... Never mind, here is the answer:
+
+ ```shell
+ systemctl restart ssh
+ ```
+
+5. Full process demonstration:
+
+ 
+
+6. Next time you log in via PuTTY, the `root` user will no longer connect; you must switch the username to `vpsadmin`! For convenience, set `vpsadmin` as the default login username in PuTTY. (Nagging Note: Don't forget to Save Session).
+
+ 
+
+## 4.7 Use RSA Key Login and Disable Password Login
+
+Step three, let's solve the problem of the **[Password]** potentially being brute-forced.
+
+As mentioned earlier, hackers don't stupidly try every combination; they use cheat methods like "password dictionaries." Unless you use a randomly generated ultra-long password (via 1Password, macOS Keychain, etc.), you are easily vulnerable.
+
+While ultra-long random passwords improve security, they are basically impossible to memorize and tedious to type manually. To solve this dilemma, we can abandon **[Password Authentication]** and switch to the more secure **[Key Authentication]**.
+
+**[Key Authentication]** involves generating a **[Pair]** of related key files (Public Key and Private Key). You upload the **[Public Key]** to the VPS. Every time you log in, SSH matches the **[Public Key]** with the **[Private Key]**. If the validation confirms it is the correct **[Key Pair]**, authentication passes. (In other words, you don't need to remember or type complex passwords; you just need to protect the **[Private Key]** file from leaking).
::: warning
-This article uses `9753` as an example, which means that with the release of this article, this port will become a feature that may be prioritized or blocked by attackers or the Great Firewall of China. Therefore, I strongly recommend that you use another port that you come up with yourself, after all, you have over 60,000 ports to choose from freely.
-:::
-
-6. The third thing we need to do is to [save the file and exit].
-
-- If you observed carefully in step 3, you would have noticed that saving is not done by the common `ctrl+s`.
-- The correct shortcut keys: save is `ctrl+o` + `enter`, and exit is `ctrl+x`.
-- (For some operating systems) Add a firewall rule to set the new SSH port, otherwise, you won't be able to log in via SSH after the instance restarts.
-- For example, on Ubuntu using ufw.
-
-```shell
-sudo ufw allow 9753/tcp
-```
-
-7. The last thing we need to do is to [restart the SSH service to make the changes take effect].
-
-```shell
-systemctl restart ssh
-```
-
-Then you can try opening a new session in your SSH software to check if you can connect. If there are any issues, you can modify the configuration through the old SSH session (SSH connections that are already open will not be closed when restarting sshd).
-
-8. The complete process demonstration is as follows:
-
-
-
-9. Modify PuTTY Configuration
-
-"Now that the new port is in effect, you will need to use `9753` the next time you log in with PuTTY. So please go to the PuTTY settings to change the port number and save the session. Well, you should know where to change it, right? (If you don't know, you need to reread the previous content!)"
-
-## 4.5 Creating a New User Without Root Access
-
-In the second step, let's solve the issue of the username being `root`.
-
-Firstly, you need to understand that `root` in Linux system is not just a simple administrator account. It is the foundation of the entire system, the ruler and the supreme god of the system. Once the `root` account has security issues, the entire system will be vulnerable and there will be nowhere to hide. So, let's follow me to carry out the operations:
-
-1. Little White Linux Basic Commands:
-
-| Number | Command Name | Command Description |
-| :------: | :-----------: | :-----------------------------------------------: |
-| `cmd-05` | `adduser` | Add new user to the system |
-| `cmd-06` | `apt install` | Install a software package |
-| `cmd-07` | `visudo` | Special editor to modify sudo permission settings |
-
-2. The first thing we need to do is to [add a new user and set a login password]. You can choose any name you want, here I will use `vpsadmin` as an example:
-
-```shell
-adduser vpsadmin
-```
-
-This is a command in the shell terminal to add a new user named "vpsadmin".
-
-After executing the command, follow the prompts to operate. Be sure to set a user password (remember that you won't see `******` when setting the password). Afterwards, the system will ask you for some additional user information, which can be ignored by pressing Enter all the way.
-
-
-
-::: warning
-This article takes "vpsadmin" as an example, which means that with the release of this article, this username will also become a significant feature, and may be the first choice for attackers to try. Therefore, just like ports, I strongly recommend that you use another username that you come up with yourself.
-:::
-
-3. The complete process demonstration is as follows:
-
-
-
-4. The second thing we need to do is to install the `sudo` function (which allows ordinary accounts to temporarily obtain the power of `root` at critical moments and unleash their full power to save the world).
-
-```shell
-apt update && apt install sudo
-```
-
-This is a shell command to update the package list and install the "sudo" package.
-
-You may have noticed that this command actually consists of two commands. The first half, `apt update`, you have seen and used before, is to refresh the software version information on the server. The latter half, `apt install`, is the installation command that will be used this time. The two commands are connected together to instruct the system to refresh the latest available software and then install the latest version of the `sudo` program. `&&` is used to link the two commands together for execution.
-
-5. The third thing we need to do is to add the `vpsadmin` user to the `sudo` list, so that they have the privilege to borrow the power of `root`.
-
-```shell
-visudo
-```
-
-(Note: `visudo` is a command used in Linux/Unix systems to edit the sudoers file, which specifies which users or groups are allowed to run certain commands with administrative privileges.)
-
-Simply add the following line under `User Privilege Specification`: `vpsadmin ALL=(ALL) NOPASSWD: ALL`.
-
-::: warning
-I want to specifically explain the setting of `NOPASSWD`. It means that when the `vpsadmin` user temporarily uses the `root` permission, no additional password needs to be entered. This is contrary to general security recommendations. The reason why I recommend this is that many newcomers insist on using the `root` account because they feel relaxed when using `root` without repeatedly entering passwords. "Choosing the lesser of two evils," I believe that the risk of [directly using the `root` user] is greater than the risk of [not entering a password when using `sudo`], so I made the above suggestion.
-
-If you want to follow the traditional practice and enter a password every time you use `sudo`, then you can change this line to `vpsadmin ALL=(ALL:ALL) ALL`.
-
-6. The complete process demonstration is as follows:
-
-
-
-## 4.6 Disabling SSH Remote Login for Root User
-
-1. Now that you're gradually getting familiar with Linux, it's time for you to think. What's the first thing we need to do? That's right, it's still to use the `nano` editor to open the `SSH remote login program settings`. What? You can't remember how to do it? Then go back and review the content above and come back! ............ Correct answer:
-
-```shell
-nano /etc/ssh/sshd_config
-```
-
-This is a command line instruction to open and edit the `sshd_config` file located at `/etc/ssh/` using the `nano` text editor.
-
-2. Find the line `PermitRootLogin Yes`, and change the value after it to `no`. Do you remember how to do it? ............ Correct answer:
-
-- Use `ctrl+w` to enter search mode, then enter `PermitRootLogin` and press enter.
-- Delete `yes` and change it to `no`.
-
-3. Save the file and exit. Do you remember how to do it? ............ Correct answer: N/A (The correct answer is not provided in the given text.)
-
-- Save is `ctrl+o`, then press `Enter` to confirm.
-- Exit is `ctrl+x`.
-
-4. Restart the ssh service to make the changes take effect. Do you remember...? Never mind, let's just reveal the correct answer:
-
-```shell
-systemctl restart ssh
-```
-
-(This is a Linux shell command to restart the SSH service.)
-
-5. The complete process is demonstrated as follows:
-
-
-
-6. Next time you log in remotely via SSH using PuTTY, you will no longer be able to connect as the `root` user. You will need to use the username `vpsadmin` instead. For convenience, you can set `vpsadmin` as the default login username in PuTTY. (Tip: Don't forget to save the session.)
-
-
-
-## 4.7 Login with RSA Key and Disable Password Login
-
-In the third step, we will solve the problem of the password being cracked.
-
-As mentioned earlier, hackers are not foolish enough to crack your password by brute force, but rather they use cheating methods such as "password tables". Unless you use a randomly generated super long password (such as with 1Password, or macOS keychain and other password management tools), it's easy to fall victim to this.
-
-Although a very long random password can improve security, it is usually difficult to remember and manually enter, which can also lead to mistakes. To solve this problem, we can simply abandon the "password verification" method and switch to a more secure "key verification" method.
-
-The so-called "key authentication" refers to generating a pair of related key files (public key and private key), uploading the "public key" to the VPS for backup. Each time you log in, SSH will match the "public key" and "private key". If the verification is correct, the "key pair" will be verified and the authentication will pass. (In other words, you don't need to remember and enter complex passwords, just protect the "private key" file from being leaked.)
-
-::: warning
-This article uses `RSA` keys as an example because `RSA` keys have a long history of support in various devices and `SSH` clients and can still provide sufficient security. However, it is not the only choice available.
+This article uses `RSA` keys as an example because `RSA` has a long history of support across various devices and SSH clients, and it currently provides sufficient security. However, it is by no means the only choice.
Other common keys include:
-- `DSA` - It has been mathematically proven to be insecure, so never use it.
-- `ECDSA` - It has high security with small keys, but its algorithm is suspected to have a backdoor by the NSA. If there is something on your VPS that is worth the attention of the NSA, do not use it.
-- `Ed25519` - This is an algorithm that is very similar to `ECDSA`, and it has similar performance advantages. At the same time, all of its documentation is public, so it is generally considered to be free of backdoors.
+* `DSA` - Mathematically proven insecure. Never use it.
+* `ECDSA` - Small key size, high security, but its algorithm is suspected of having an NSA backdoor. If you have things on your VPS the NSA cares about, don't use it.
+* `Ed25519` - An algorithm very similar to `ECDSA` with similar performance benefits. Its documentation is fully public, so it is generally considered backdoor-free.
-So, if your device and software both support it, I recommend choosing `Ed25519` keys as a priority.
+Therefore, if your devices and software support it, I recommend prioritizing `Ed25519` keys.
:::
-Now let's configure the [Key Authentication]!
+Now, let's configure **[Key Authentication]**!
-1. Run `PuTTYgen` (PuTTY Key Generator). The location is `Start Menu` --> `All Programs` --> `PuTTY (64-bit)` --> `PuTTYgen`.
+1. Run `PuTTYgen` (PuTTY Key Generator). Location: `Start Menu` --> `All Programs` --> `PuTTY (64-bit)` --> `PuTTYgen`.
+ 1. Click `Generate` to start (move your mouse randomly in the blank area to increase randomness).
-1. Click on `Generate` to start the generation process (move the mouse randomly in the blank area of the interface to add random numbers).
+ 
-
+ ::: warning
+ The image uses a `2048` bit `RSA` key as an example. However, to achieve security equivalent to `ECDSA/Ed25519` `256` bit keys, you need to use a `3072` bit `RSA` key (change the number in the bottom right to `3072`).
+ :::
+
+ 1. You can set a password for the private key to add a layer of security.
+ 2. Click `Save public key` to save the public key, name it `id_rsa.pub`.
+ 3. Click `Save private key` to save the private key, name it `id_rsa` (PuTTY private keys come with a `.ppk` extension).
+ 4. **Most Importantly:** Scroll down and copy **all** the content in the red box above, save it as a file named `authorized_keys`. (Saving with vscode might default to a `.txt` extension; that's fine, we will remove the extension when uploading to VPS).
+
+ 
+
+2. **Upload the public key to the `vpsadmin` user on the VPS.**
+ 1. This step requires `WinSCP` which we prepared earlier.
+ 2. Download and install from the [official site](https://winscp.net/eng/index.php). It will prompt you to import PuTTY settings; do it!
+
+ 
+
+ 3. If it doesn't prompt or you installed it earlier, configure it as shown below.
+
+ 
+
+ 4. The left directory in WinSCP is your local computer; locate the folder where your keys are.
+ 5. The right directory in WinSCP is the VPS. Default is `/home/vpsadmin/`. Click `X hidden` in the bottom right to show hidden files.
+
+ 
+
+ 6. Right-click on the right side (VPS) and create a new folder named `.ssh` (Note the dot `.`).
+
+ 
+
+ 7. Upload the **[Public Key]** `authorized_keys` into the `.ssh` folder.
+
+ 
+
+ 8. During upload (or after), rename `authorized_keys.txt` to `authorized_keys` (remove the `.txt` extension).
+
+ 
+
+ 9. Full process demonstration:
+
+ 
+
+3. **Configure VPS to Enable RSA Key Login and Disable Password Login.**
+ 1. **Newbie Linux Basic Commands:**
+
+ | ID | Command Name | Command Description |
+ | :---: | :---: | :---: |
+ | `cmd-08` | `sudo` | Run a command with `root` privileges |
+ | `cmd-09` | `chmod` | Change permissions of target file/folder |
+
+ 2. Remote SSH into your VPS (PuTTY).
+ 3. Change permissions of `authorized_keys` to `600` (Read/Write for owner only).
+
+ ```shell
+ chmod 600 ~/.ssh/authorized_keys
+ ```
+
+ 4. Modify SSH Configuration. We've done this many times, but now we are the normal user `vpsadmin`, not the omnipotent `root`. We don't have permission to edit SSH config directly. We need the `sudo` command:
+
+ ```shell
+ sudo nano /etc/ssh/sshd_config
+ ```
+
+ 5. Find (`ctrl+w`) `PasswordAuthentication` and change it to `no`.
+ 6. Find (`ctrl+w`) `PubkeyAuthentication` and change it to `yes`. Save (`ctrl+o`) and Exit (`ctrl+x`).
+ 7. Restart SSH service. (Nagging Note: Don't forget you need `sudo` for permission now).
+
+ ```shell
+ sudo systemctl restart ssh
+ ```
+
+ 8. Full process follows:
+
+ 
+
+4. **Configure PuTTY to use the Private Key.**
+ The VPS side has the public key. Now specify the private key location for PuTTY to use during login (Nagging Note: Don't forget to Save Session).
+
+ 
+
+5. At this point, **[Key Login]** is enabled, **[Password Authentication]** is disabled, and PuTTY has the default username and private key saved. In the future, just load the `VPS-SERVER` config in PuTTY and click `Open` for one-click login.
+
+ If you set a password for your private key, you will need to enter that passphrase to unlock the key when logging in, as shown below:
+
+ 
+
+6. Don't forget to configure the key for `WinSCP` as well, otherwise, you won't be able to log in to transfer files later:
+
+ 
::: warning
-The example in this image is based on a `2048`-bit `RSA` key. However, in reality, if you want to achieve the same level of security as a `256`-bit key for `EDCSA/Ed25519`, you need to use a `3072`-bit `RSA` key. (i.e., change the number in the bottom right corner to `3072`)
-:::
-
-2. You can add a password to your private key to increase security.
-3. Click on `Save public key` to save the public key with the file name `id_rsa.pub`.
-4. Click on `Save private key` to save the private key with the file name `id_rsa` (PuTTY private keys come with the `.ppk` extension).
-5. Most importantly, copy and save all the content inside the red box below by scrolling down, with the file name `authorized_keys`. (If you save it using vscode, it will be saved as a text file with a `.txt` extension, which is fine. We will remove the extension when uploading it to VPS later.)
-
-
-
-2. Upload the public key to the "vpsadmin" user on the VPS.
-
-1, This step requires the use of the previously prepared `WinSCP`.
-
-2, Go to the [official website](https://winscp.net/eng/index.php) to download and install. It will prompt you to import PuTTY settings, and of course, you can import them with one click!
-
-
-
-3, If there is no prompt for import or you have already installed it in advance, configure it according to the following figure.
-
-
-
-4, The directory on the left side of WinSCP is the folder and files on your local computer. Please locate the folder where the key is stored.
-
-5, The directory on the right side of WinSCP is the folder and files on the VPS server, which are located in the `/home/vpsadmin/` folder by default. To display hidden files, please click on `X hidden` in the lower right corner.
-
-
-
-6, Right-click on the right side (in VPS) and create a new folder named `.ssh` (note the period at the beginning).
-
-
-
-7, Upload the [public key] `authorized_keys` to the `.ssh` folder.
-
-
-
-8, When uploading, rename the [public key] from `authorized_keys.txt` to `authorized_keys` (remove the `.txt` extension).
-
-
-
-9, The complete process demonstration is as follows:
-
-
-
-3. Enable RSA key authentication for SSH login and disable password authentication login on the VPS side.
-
-- Basic Linux Commands:
- | Number | Command | Description |
- | :------: | :-----: | :-----------------------------------------------: |
- | `cmd-08` | `sudo` | Run a command with `root` privileges |
- | `cmd-09` | `chmod` | Change the permissions of a target file/directory |
-- SSH remote connection to VPS (PuTTY)
-- Change the permission of the `authorized_keys` file to `600` (only the owner can read and write).
-
-```shell
-chmod 600 ~/.ssh/authorized_keys
-```
-
-This is a command in shell script to change the permissions of the `authorized_keys` file to `600` for the current user's SSH directory (`~/.ssh/`).
-
-4. Modify SSH configuration. We have used this many times, but now that we have changed from the almighty `root` to the ordinary user `vpsadmin`, we do not have the permission to edit SSH configuration directly. At this time, we need to use the `sudo` command:
-
-```shell
-sudo nano /etc/ssh/sshd_config
-```
-
-(This is a command in the shell/terminal to open the sshd_config file located in the /etc/ssh/ directory with the sudo privilege using the nano text editor.)
-
-5. Find (`ctrl+w`) `PasswordAuthentication` and change it to `no`.
-
-6. Find (`ctrl+w`) `PubkeyAuthentication`, change it to `yes`, then save (`ctrl+o`) and exit (`ctrl+x`).
-
-7. Restart the SSH service. (Note: Don't forget to use `sudo` to gain permission.)
-
-```shell
-sudo systemctl restart ssh
-```
-
-This is a command in the shell terminal to restart the SSH service with root privileges using the `systemctl` command.
-
-8. The complete process is as follows:
-
-
-
-4. The public key has been set up on the VPS end. Now we need to specify the private key location for PuTTY to use when logging in. (Reminder: Don't forget to save the session.)
-
-
-
-5. Now, the [Key-based login] has been successfully enabled, [Password authentication] has been successfully disabled, and the default login username and private key have been saved for PuTTY. In the future, when using PuTTY to log in, simply load the `VPS-SERVER` configuration, click `Open`, and you can log in with just one click.
-
-If you have set a password for your private key, you need to enter this password to use the key when logging in, as shown in the following figure:
-
-
-
-6. Don't forget to set the corresponding key for `WinSCP`, otherwise you won't be able to log in when you want to transfer files later.
-
-
-
-::: warning
-Any software that requires SSH login needs key verification. As there are too many software, it is impossible to show them one by one. Please set it up according to your needs.
+Any software that needs to log in via SSH will now require key authentication. There are too many software options to show individually, so please configure them yourself according to your needs.
:::
## 4.8 Your Progress
-Up to this point, your VPS has completed the basic security measures of [port], [username], and [password]. Although it is not completely impregnable, most malicious scripts should no longer be able to harm you.
+Up to this point, your VPS has completed the basic security guarantees for the three elements: **[Port]**, **[Username]**, and **[Password]**. While far from impregnable, common malicious scripts should no longer be able to harm you!
-Now that we finally have a secure system foundation, in the next chapter, we can start step by step to install and configure the infrastructure that Xray needs! (What infrastructure? A web page, a certificate)
+Now we finally have a secure system foundation. In the next chapter, we can start gradually installing and configuring the infrastructure required for Xray! (What infrastructure? A webpage, a certificate).
> ⬛⬛⬛⬛⬜⬜⬜⬜ 50%
diff --git a/docs/en/document/level-0/ch05-webpage.md b/docs/en/document/level-0/ch05-webpage.md
index 9b8e1965..98991434 100644
--- a/docs/en/document/level-0/ch05-webpage.md
+++ b/docs/en/document/level-0/ch05-webpage.md
@@ -1,160 +1,199 @@
-# Chapter 5: Website Building
+# [Chapter 5] Website Setup
-## 5.1 Why should you create a website?
+## 5.1 Why create a website?
-Some newcomers may be confused: why do I need to build a website for securing an open digital environment? I don't know how to code! Isn't it very complicated?
+Newcomers might be confused: why do I need to build a website just to access the "scientific internet" (circumvent the firewall)? I don't know programming; isn't it very troublesome?
-First, let's answer the first question. The reasons for building a website are:
+Let's answer the first question. Reasons for building a website:
-1. Apply for a legitimate TLS certificate (very important)
-2. Provide reasonable fallback to prevent active probing attacks and improve security
-3. Set up a camouflage site (such as a blog, private cloud storage, multimedia site, game site, etc.) with a reasonable frontend when directly accessed, making traffic usage look more legitimate.
+1. To apply for a legitimate TLS certificate (Very important).
+2. To provide a reasonable fallback mechanism to prevent active probing attacks and improve security.
+3. To build a camouflage site (such as a blog, private cloud drive, multimedia site, game site, etc.) so that there is a legitimate front-end when accessed directly, making traffic usage look more reasonable.
-Now let's answer the second question:
+Now for the second question:
-1. As a demonstration, this article uses only the simplest "single-file HTML page + Nginx" setup to achieve the above objectives, so it is **very easy**.
-2. This website can not only be used for camouflage but also for real development and growth. The complexity depends entirely on you.
-3. For the goals of "camouflage" and "website operation", uniqueness and personalization are needed. Students who need this can search and learn by themselves. This content has completely deviated from scientific online access, so this article will not go into depth.
+1. This article, as a demonstration, uses only a very simple [single-file HTML page + Nginx] to achieve the above goals, so it is **very simple**.
+2. This website can be more than just camouflage; you can actually make it big and strong. The complexity depends entirely on you.
+3. For the goals of "camouflage" and "website operation," what is needed is individuality and showing your true self. Interested students can search and learn on their own. This content has completely deviated from "scientific internet access," so this article will not delve into it.
-## 5.2 Log in to VPS, install and run Nginx
+## 5.2 Login to VPS, Install and Run Nginx
-1. Here we use commands that have been explained in detail before, so they won't be repeated. If you don't understand, please refer to the previous chapters.
+1. The commands used here have been explained in detail previously, so they won't be repeated. Students who don't understand can review the previous chapters.
- ```shell
- sudo apt update && sudo apt install nginx
- ```
+ ```shell
+ sudo apt update && sudo apt install nginx
+ ```
-2. After completion, Nginx will automatically run. Open the browser on Windows and enter `http://100.200.300.400:80`. If you see the interface shown below, it means Nginx is running normally.
+2. After completion, Nginx runs automatically. Now open a browser on Windows and enter `http://100.200.300.400:80`. If you see the interface below, Nginx is running normally.
- 
+ 
-## 5.3 Create the simplest web page
+3. If you cannot see the Nginx default page mentioned above, you may need to configure the default firewall component, Uncomplicated Firewall (UFW), on the Debian system to enable HTTP (80) and HTTPS (443) port traffic.
-1. Basic Linux commands for beginners:
- | No. | Command Name | Command Description |
- | :------: | :----------------: | :-----------------------: |
- | `cmd-10` | `mkdir` | Create a new folder |
- | `cmd-11` | `systemctl reload` | Reload a specific service |
+ a. Verification method, input:
-2. Basic Linux configuration files for beginners:
- | No. | Configuration File Location | File Description |
- | :-------: | :-------------------------: | :--------------------: |
- | `conf-02` | `/etc/nginx/nginx.conf` | Nginx program settings |
+ ```shell
+ sudo ufw status
+ ```
-3. Create a dedicated folder `/home/vpsadmin/www/webpage/` for the website and create the web page file `index.html`
- ```shell
- mkdir -p ~/www/webpage/ && nano ~/www/webpage/index.html
- ```
+ b. If the output is as follows, indicating ports 80 and 443 are not enabled, proceed to step c.
-::: warning
-If you are not using the username `vpsadmin`, please be sure to understand the meaning of the "~" symbol in this command (this is related to Step 5 content):
+ ```shell
+ Status: active
+ To Action From
+ -- ------ ----
+ 22/tcp ALLOW Anywhere
+ 22/tcp (v6) ALLOW Anywhere (v6)
+ ```
-- If it is a **non-root user**, "~" is equivalent to `/home/username`
-- If it is a **root user**, "~" is equivalent to `/root`
- :::
+ c. Command to enable Nginx ports 80 and 443 in UFW:
-4. Copy the entire content below, save (`ctrl+o`) and exit (`ctrl+x`).
+ ```shell
+ sudo ufw allow 'Nginx Full'
+ ```
- ```html
-
-
-
- Enter a title, displayed at the top of the window.
-
-
-
- Enter the main heading, usually the same as the title.
- Be bold in stating your key points. Put them in a list:
-
- - The first item in your list
- - The second item; italicize key words
-
- Improve your image by including an image.
-
-
-
-
- Add a link to your favorite
- Web site. Break up your page
- with a horizontal rule or two.
-
-
-
- Finally, link to another page in your own Web
- site.
-
-
- © Wiley Publishing, 2011
-
-
- ```
+ d. Enter the command from step a again to verify. If the output is as follows, it means Nginx traffic has been allowed by the firewall, and you should be able to see the Nginx default page mentioned in point 2.
-5. Modify `nginx.conf` and restart the `Nginx` service, directing the http access on port 80 to the newly created `html` page.
- 1. Modify `nginx.conf`.
+ ```shell
+ Status: active
+ To Action From
+ -- ------ ----
+ 22/tcp ALLOW Anywhere
+ Nginx Full ALLOW Anywhere
+ 22/tcp (v6) ALLOW Anywhere (v6)
+ Nginx Full (v6) ALLOW Anywhere (v6)
+ ```
- ```shell
- sudo nano /etc/nginx/nginx.conf
- ```
+## 5.3 Create a Very Simple Web Page
- 2. Add the following content inside`http{}`, then save (`ctrl+o`) and exit (`ctrl+x`). (Remember to replace the domain name with the real domain name you prepared earlier, including the subdomain)
+1. **Basic Linux Commands for Beginners:**
- ```
+ | Code | Command Name | Description |
+ | :---: | :---: | :---: |
+ | `cmd-10` | `mkdir` | Create a new directory |
+ | `cmd-11` | `systemctl reload` | Reload a service |
+
+2. **Basic Linux Configuration Files for Beginners:**
+
+ | Code | File Location | Description |
+ | :---: | :---: | :---: |
+ | `conf-02` | `/etc/nginx/nginx.conf` | Nginx program settings |
+
+3. Create a dedicated folder for the website `/home/vpsadmin/www/webpage/` and create the webpage file `index.html`.
+
+ ```shell
+ mkdir -p ~/www/webpage/ && nano ~/www/webpage/index.html
+ ```
+
+ ::: warning
+ If you are not using the username `vpsadmin`, please understand the meaning of the `“~”` symbol in this command (this relates to the content you will write in [Step 5]):
+
+ - If you are a [non-root user], `“~”` is equivalent to `/home/username`.
+ - If you are the [root user], `“~”` is equivalent to `/root`.
+ :::
+
+4. Copy the content below completely into the file, then save (`ctrl+o`) and exit (`ctrl+x`).
+
+ ```html
+
+
+ Enter a title, displayed at the top of the window.
+
+
+ Enter the main heading, usually the same as the title.
+ Be bold in stating your key points. Put them in a list:
+
+ - The first item in your list
+ - The second item; italicize key words
+
+ Improve your image by including an image.
+
+
+
+
+ Add a link to your favorite
+ Web site. Break up your page
+ with a horizontal rule or two.
+
+
+
+ Finally, link to another page in your own Web
+ site.
+
+ © Wiley Publishing, 2011
+
+
+ ```
+
+ Grant read permissions to other users for this file:
+
+ ```shell
+ chmod -R a+r .
+ ```
+
+5. Modify `nginx.conf` and restart the `Nginx` service to point http access on port `80` to the `html` page just created.
+
+ 1. Modify `nginx.conf`.
+
+ ```shell
+ sudo nano /etc/nginx/nginx.conf
+ ```
+
+ 2. Add the following segment inside `http{}`, then save (`ctrl+o`) and exit (`ctrl+x`). (Remember to replace the domain name with the real domain name including the subdomain you prepared earlier).
+
+ ```nginx
server {
listen 80;
- server_name subdomain.your_domain.com;
+ server_name subdomain.yourdomain.com;
root /home/vpsadmin/www/webpage;
index index.html;
}
- ```
+ ```
- ::: warning Be extra careful!
- As mentioned in Step 3 of section 5.3, make sure to change `/home/vpsadmin/www/webpage` to your actual file path.
- :::
+ ::: warning Special Note!
+ As mentioned in my hint in [Step 3], please make sure `/home/vpsadmin/www/webpage` is changed to your actual file path.
+ :::
- 3. Make `nginx` reload the configuration to take effect.
+ 3. Reload the `nginx` configuration to make it effective.
- ```shell
- sudo systemctl reload nginx
- ```
+ ```shell
+ sudo systemctl reload nginx
+ ```
- 4. The complete setup process is as follows:
+ 4. The complete setup process is shown below:
- 
+ 
- 5. Now, if you visit `http://subdomain.your_domain.com`, you should see this page, indicating success:
+ 5. Now, if you visit `http://subdomain.yourdomain.com` and see a page like this, it means success:
- 
+ 
-## 5.4 Common error explanations
+## 5.4 Explanation of Common Errors
-First of all, if you follow the instructions in the article step by step and are careful enough, you will definitely not encounter any errors. So, I don't intend to change how this article is written.
+First, if you followed the instructions in the article step by step and were careful enough, you definitely wouldn't encounter errors. Therefore, I do not intend to modify how this article is written.
-Then why do some students still get stuck at this step, and the web page just won't open? There are basically two words: **carelessness**. Because there are only two possible issues with the configuration here, and there are only two reasons for them.
+So why do many students still get stuck at this step and can't open the webpage? Basically, it comes down to one word: **carelessness**. There are only two potential configuration problems here, and only two causes.
-I. Two types of issues:
+**I. Two Problems:**
-- In `nginx.conf`, the `/home/vpsadmin/www/webpage` does not match the actual file path; `nginx` cannot find the file
-- The path is correct, but `nginx` doesn't have permission to access it
+- The path `/home/vpsadmin/www/webpage` in `nginx.conf` does not match your actual file path, so `nginx` cannot find the file.
+- The path is correct, but `nginx` does not have permission to read it.
-II. Two reasons:
+**II. Two Causes:**
-- Use a **non-root user** but still directly copy the commands in the text without modification. (This is basically like copying the name of another student when copying answers)
-- Insist on using a **root user**
+- Using a [non-root user] but still copying the commands from the article directly without modification. (This is basically like copying a classmate's name along with their answers during a test).
+- Insisting on using the [root user].
-If you encounter any errors, please carefully review the explanations in Steps 3 and 5-2 of Section 5.3.
+Students encountering errors should look back carefully at the instructions in [Step 3] and [Step 5-2] of section [5.3].
::: warning
-In the early stages of this article, a lot of space has been devoted to explaining the importance of using a **non-root user** for security, and the entire article is written based on this premise. So, issues caused by using a **root user** are not within the scope of this article.
+Earlier in this article, a significant amount of space was dedicated to explaining the importance of using a [non-root user] for security, and the entire text is written based on this premise. Therefore, problems caused by using the [root user] are not within the scope of this article's design.
-But I believe that students who persist in using the `root` user should have their own opinions, strong hands-on ability, or have a certain foundation in Linux. I have already explained the crux of the problem, and I believe you can solve it on your own.
+However, I believe that students who insist on using the [root user] likely have their own opinions, strong hands-on abilities, or a certain Linux foundation. I have explained the crux of the problem, and I trust you can solve it on your own.
+:::
## 5.5 Your Progress
-So far, Xray's first infrastructure [webpage] has been established. Let's now move on to the second infrastructure [certificate]!
+At this point, Xray's first infrastructure component, the [Website], is in place. We will immediately move on to the second infrastructure component: [Certificates]!
> ⬛⬛⬛⬛⬛⬜⬜⬜ 62.5%
diff --git a/docs/en/document/level-0/ch06-certificates.md b/docs/en/document/level-0/ch06-certificates.md
index b1d806cb..132bbcce 100644
--- a/docs/en/document/level-0/ch06-certificates.md
+++ b/docs/en/document/level-0/ch06-certificates.md
@@ -2,222 +2,173 @@
## 6.1 Applying for a TLS Certificate
-Next, we need to apply for a real TLS certificate for our domain name, so that the website has the ability to encrypt with standard TLS and the ability to access via HTTPS. This is the most important tool for Xray and other current security proxy tools to ensure fully encrypted traffic.
+Next, we need to apply for a real TLS certificate for our domain name. This enables standard TLS encryption and HTTPS access for the website. This is the most crucial tool for modern secure proxy tools like Xray to ensure traffic is fully encrypted.
::: warning
-Please do not use self-signed certificates lightly. It does not make the operation much simpler, but adds unnecessary risks (such as man-in-the-middle attacks).
+Please do not use self-signed certificates lightly. They don't make the operation much simpler, but they add senseless risks (such as Man-in-the-Middle attacks).
:::
-Here, I will use a certificate management tool called [`acme.sh`](https://github.com/acmesh-official/acme.sh), which is simple, lightweight, efficient, and capable of automatically updating certificates.
+Here, I will use a certificate management tool called [`acme.sh`](https://github.com/acmesh-official/acme.sh). It is simple, lightweight, efficient, and handles automatic certificate renewals.
-In addition, I believe that you have gradually become familiar with the basic operations of Linux. Therefore, from this chapter on, commands that have appeared multiple times will no longer have screenshots and will only be briefly described. If you really can't remember how to use them, just review the previous chapters.
+Additionally, I trust that by now you are gradually becoming familiar with basic Linux operations. Therefore, starting from this chapter, commands that have appeared multiple times will no longer be accompanied by screenshots, but only simple descriptions. If you really can't remember how to use them, please review the previous chapters.
-## 6.2 Install `acme.sh`
+## 6.2 Installing `acme.sh`
-1. Basic Linux commands for beginners:
- | Number | Command | Description |
- | :------: | :-------: | :------------------------------------------------: |
- | `cmd-12` | `wget` | Retrieve (or download) a webpage file |
- | `cmd-13` | `acme.sh` | Commands related to acme.sh certificate management |
+1. Basic Linux Commands for Beginners:
-2. Run the installation script.
+ | ID | Command | Description |
+ |:--:|:--:|:--:|
+ | `cmd-12` | `wget` | Visit (or download) a web file |
+ | `cmd-13` | `acme.sh` | Commands related to acme.sh certificate management |
-```shell
-wget -O - https://get.acme.sh | sh
-```
+2. Run the installation script
-3. Make the `acme.sh` command effective.
+ ```shell
+ wget -O - [https://get.acme.sh](https://get.acme.sh) | sh
+ ```
-```shell
-. .bashrc
-```
+3. Make the `acme.sh` command effective
-(Note: This command is used to source (load) the `.bashrc` file in the shell environment.)
+ ```shell
+ . .bashrc
+ ```
-4. Enable `acme.sh` automatic upgrade.
+4. Enable auto-upgrade for `acme.sh`
-```shell
-acme.sh --upgrade --auto-upgrade
-```
+ ```shell
+ acme.sh --upgrade --auto-upgrade
+ ```
-5. The complete process up to this point is shown in the following diagram:
+5. The complete process up to this step is shown below:
-
+ 
-## 6.3 Testing Certificate Application
+## 6.3 Testing Certificate Issuance
-Before officially applying for the certificate, we use the testing command (`--issue --server letsencrypt_test`) to verify if the application can be successfully submitted. This can avoid repeated failures in applying for a certificate due to incorrect local configuration, exceeding the frequency limit of Let's Encrypt (such as a maximum of 5 failures per hour, per domain, or per user), which may prevent the subsequent steps from being carried out.
+Before officially applying for a certificate, let's use a test command (`--issue --server letsencrypt_test`) to verify if the application can be successful. This avoids repeated failures due to local configuration errors, which could exceed Let's Encrypt's frequency limits (e.g., maximum of 5 failures per hour, per domain, per user), blocking subsequent steps.
-1. The command to apply for a test certificate is as follows (this article uses ECC certificate as an example, because there is really no reason not to use it nowadays):
+1. The command to test certificate issuance is as follows (This article uses `ECC` certificates as an example, because nowadays, there is really no reason not to use them):
-```shell
-acme.sh --issue --server letsencrypt_test -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256
-```
+ ```shell
+ acme.sh --issue --server letsencrypt_test -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256
+ ```
-(Note: This is a command in shell script for obtaining SSL certificate from Let's Encrypt CA using ACME protocol. It specifies the test server, the subdomain for which the certificate is requested, the webroot directory of the subdomain, and the key length to use for the certificate.)
+ ::: warning Note
+ The main advantage of `ECC` certificates lies in their smaller Key size, which means improved security and faster encryption/decryption speeds for the same size. For instance, the strength of ECC-256bit is roughly equivalent to RSA-3072bit, so why not? Of course, some say ECC certificate handshakes are noticeably faster; I think that's a bit of an exaggeration. RSA handshakes aren't that slow, and even if there is a difference, it should be in milliseconds, which is hard to perceive directly.
-::: warning Explanation
-The main advantage of the `ECC` certificate is that its `Keysize` is smaller, which means that security is improved and encryption and decryption speed is faster for the same size. Why not choose ECC-256bit, which is approximately equivalent to RSA-3072bit in strength? Of course, some people say that the ECC certificate handshake is significantly faster, which I think is a bit exaggerated, because RSA handshake is not too slow either. Even if there is a difference, it should be in milliseconds and difficult to perceive directly.
+ However, if some websites specifically need to be compatible with very ancient devices, please choose `RSA` certificates as needed.
+ :::
-In addition, if some websites do need to be compatible with certain old devices, please still choose RSA certificates according to your needs.
+2. You should ultimately see a log similar to this:
-2. You should eventually see a prompt similar to this:
+ ```log
+ [Wed 30 Dec 2022 04:25:12 AM EST] Using ACME_DIRECTORY: [https://acme-staging-v02.api.letsencrypt.org/directory](https://acme-staging-v02.api.letsencrypt.org/directory)
+ [Wed 30 Dec 2022 04:25:13 AM EST] Using CA: [https://acme-staging-v02.api.letsencrypt.org/directory](https://acme-staging-v02.api.letsencrypt.org/directory)
+ [Wed 30 Dec 2022 04:25:13 AM EST] Create account key ok.
+ [Wed 30 Dec 2022 04:25:13 AM EST] Registering account: [https://acme-staging-v02.api.letsencrypt.org/directory](https://acme-staging-v02.api.letsencrypt.org/directory)
+ [Wed 30 Dec 2022 04:25:13 AM EST] Registered
+ [Wed 30 Dec 2022 04:25:13 AM EST] ACCOUNT_THUMBPRINT='CU6qmPKuRqhyTAIrF4swosR375194z_1ddUlWef8xDc'
+ [Wed 30 Dec 2022 04:25:13 AM EST] Creating domain key
+ [Wed 30 Dec 2022 04:25:13 AM EST] The domain key is here: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
+ [Wed 30 Dec 2022 04:25:13 AM EST] Single domain='subdomain.yourdomain.com'
+ [Wed 30 Dec 2022 04:25:13 AM EST] Getting domain auth token for each domain
+ [Wed 30 Dec 2022 04:25:14 AM EST] Getting webroot for domain='subdomain.yourdomain.com'
+ [Wed 30 Dec 2022 04:25:14 AM EST] Verifying: subdomain.yourdomain.com
+ [Wed 30 Dec 2022 04:25:23 AM EST] Pending
+ [Wed 30 Dec 2022 04:25:25 AM EST] Success
+ [Wed 30 Dec 2022 04:25:25 AM EST] Verify finished, start to sign.
+ [Wed 30 Dec 2022 04:25:25 AM EST] Lets finalize the order.
+ [Wed 30 Dec 2022 04:25:25 AM EST] Le_OrderFinalize='[https://acme-staging-v02.api.letsencrypt.org/acme/finalize/490205995/7730242871](https://acme-staging-v02.api.letsencrypt.org/acme/finalize/490205995/7730242871)'
+ [Wed 30 Dec 2022 04:25:25 AM EST] Downloading cert.
+ [Wed 30 Dec 2022 04:25:25 AM EST] Le_LinkCert='[https://acme-staging-v02.api.letsencrypt.org/acme/cert/xujss5xt8i38waubafz2xujss5xt8i38waubz2](https://acme-staging-v02.api.letsencrypt.org/acme/cert/xujss5xt8i38waubafz2xujss5xt8i38waubz2)'
+ [Wed 30 Dec 2022 15:21:52 AM EST] Cert success.
+ --BEGIN CERTIFICAT--
+ sxlYqPvWreKgD5b8JyOQX0Yg2MLoRUoDyqVkd31PthIiwzdckoh5eD3JU7ysYBtN
+ cTFK4LGOfjqi8Ks87EVJdK9IaSAu7ZC6h5to0eqpJ5PLhaM3e6yJBbHmYA8w1Smp
+ wAb3tdoHZ9ttUIm9CrSzvDBt6BBT6GqYdDamMyCYBLooMyDEM4CUFsOzCRrEqqvC
+ ... (omitted for brevity) ...
+ yiLKcBFc5H7dgJCImo7us7aJeftC44uWkPIjw9AKH=
+ --END CERTIFICAT--
+ [Wed 30 Dec 2022 15:21:52 AM EST] Your cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.cer
+ [Wed 30 Dec 2022 15:21:52 AM EST] Your cert key is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
+ [Wed 30 Dec 2022 15:21:52 AM EST] The intermediate CA cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/ca.cer
+ [Wed 30 Dec 2022 15:21:52 AM EST] And the full chain certs is there: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/fullchain.cer
+ ```
-```log
-[Wed 30 Dec 2022 04:25:12 AM EST] Using ACME_DIRECTORY: https://acme-staging-v02.api.letsencrypt.org/directory
-[Wed 30 Dec 2022 04:25:13 AM EST] Using CA: https://acme-staging-v02.api.letsencrypt.org/directory
-[Wed 30 Dec 2022 04:25:13 AM EST] Create account key ok.
-[Wed 30 Dec 2022 04:25:13 AM EST] Registering account: https://acme-staging-v02.api.letsencrypt.org/directory
-[Wed 30 Dec 2022 04:25:13 AM EST] Registered
-[Wed 30 Dec 2022 04:25:13 AM EST] ACCOUNT_THUMBPRINT='CU6qmPKuRqhyTAIrF4swosR375194z_1ddUlWef8xDc'
-[Wed 30 Dec 2022 04:25:13 AM EST] Creating domain key
-[Wed 30 Dec 2022 04:25:13 AM EST] The domain key is here: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
-[Wed 30 Dec 2022 04:25:13 AM EST] Single domain='subdomain.yourdomain.com'
-[Wed 30 Dec 2022 04:25:13 AM EST] Getting domain auth token for each domain
-[Wed 30 Dec 2022 04:25:14 AM EST] Getting webroot for domain='subdomain.yourdomain.com'
-[Wed 30 Dec 2022 04:25:14 AM EST] Verifying: subdomain.yourdomain.com
-[Wed 30 Dec 2022 04:25:23 AM EST] Pending
-[Wed 30 Dec 2022 04:25:25 AM EST] Success
-[Wed 30 Dec 2022 04:25:25 AM EST] Verify finished, start to sign.
-[Wed 30 Dec 2022 04:25:25 AM EST] Lets finalize the order.
-[Wed 30 Dec 2022 04:25:25 AM EST] Le_OrderFinalize='https://acme-staging-v02.api.letsencrypt.org/acme/finalize/490205995/7730242871'
-[Wed 30 Dec 2022 04:25:25 AM EST] Downloading cert.
-[Wed 30 Dec 2022 04:25:25 AM EST] Le_LinkCert='https://acme-staging-v02.api.letsencrypt.org/acme/cert/xujss5xt8i38waubafz2xujss5xt8i38waubz2'
-[Wed 30 Dec 2022 15:21:52 AM EST] Cert success.
---BEGIN CERTIFICAT--
-sxlYqPvWreKgD5b8JyOQX0Yg2MLoRUoDyqVkd31PthIiwzdckoh5eD3JU7ysYBtN
-cTFK4LGOfjqi8Ks87EVJdK9IaSAu7ZC6h5to0eqpJ5PLhaM3e6yJBbHmYA8w1Smp
-wAb3tdoHZ9ttUIm9CrSzvDBt6BBT6GqYdDamMyCYBLooMyDEM4CUFsOzCRrEqqvC
-2mTTEmhvpojo5rhdTSJxibozyNWTGwoTj0v9pTUeQcGqLIzqi4DowjBHD5guwRid
-SjAFnm6JT2xUQgWFm58A1gv1OhbH1TRPUUmtE1nFEN7YiSjI4xgxqAXT3CLD2EUb
-wXlUrO6c75zSsQP4bRMzgOjJUqHtSb6IEqELzt4M7KzL5iCOruCChCo2DZxUwvVX
-tOoaAyQJzCbTqE6aUqwiKi3gVyoxvDP9mI5JdRYzsDL6GVud7EHPnYeMl9ubLZAK
-0vg84mbMP3f6mYM4KRa1cqiyOIcQPT4AzGFYVv4sm049bZQg7sd0Bz9CaFvE7yDA
-1y17XlgCDnsjxl66bqI1vkENN9XT5xeFHONqc18b5fZEKSIvdX7iWPFWp1PyMPpG
-0pMCP1EymZNFxIMJLgbWqExwLWfPc5Ib3PjBaIqhXPnw6sT2MQSxXwDupq1UJVhV
-7E3hQRVlwI4CXi6WLHJMNvNRyyK87gCrLH1bKYsPeRVaz77poWBq49zwBCts6hPY
-IeF4ltGXyANNIOPEi8vy138fRU4LYh81d8FjOtFfJZogMjwhfNvapqxPMsioPlmX
-TnZu0n7setrVNUEfTMHWqPpDgk5MPrWLA4LapqaDfEX4pwnQJLMwMi6s94z165c0
-iMRSKA1yU5zqv8aNsDfPoY4OkSPWs4MaXgRRSLBsUfZ15DwQXPk76kegHIyxWvwF
-tYw9HKR5QCMK66fa0z4aJoFVFLK0IIOGEZOanRFUCnkLUDd3QZ3YU8lEcrj7Uxos
-haiRNICyC6UfsCJ94a8vcNyMosPv3xBLMp19WXgiFYqEFQkntkv1FLRI35fjeJmg
-0fmD9VG9bkzGPHihJgQLRlCHasGf6XrdfkSsODAyCUHUHJ0RzqF4YEZMcxDxzuQ2
-YO7bFwj7S3mUdVPZ6MPasjxdyBjJgEBMch2uy4AhmudXfEBQBye8W6ZI4ztZjLVV
-FmP4SIuaNUmMe20TjR8b9NVC96AhxOanWT3mRROsdokpKQGTJvl27EHH8KuAbUOc
-G6KtPy4wslNZNXWcBy9n63RcWak12r7kAIFn38tZxmlw2WUKoRSMAH64GcDTjRQd
-Am65hBHzvGrj93wEuVNIebvNIsJOlng3HFjpIxVqKGMCIfWIKGDE3YzK3p4LbGZ6
-NZFQWYJLNVf2M9CCJfbEImPYgvctrxl39H6KVYPCw1SAdaj9NneUqmREOQkKoEB0
-x6PmNirbMscHhQPSC0JQaqUgaQFgba1ALmzRYAnYhNb0twkTxWbY7DBkAarxqMIp
-yiLKcBFc5H7dgJCImo7us7aJeftC44uWkPIjw9AKH=
---END CERTIFICAT--
-[Wed 30 Dec 2022 15:21:52 AM EST] Your cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.cer
-[Wed 30 Dec 2022 15:21:52 AM EST] Your cert key is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
-[Wed 30 Dec 2022 15:21:52 AM EST] The intermediate CA cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/ca.cer
-[Wed 30 Dec 2022 15:21:52 AM EST] And the full chain certs is there: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/fullchain.cer
-```
+3. Note: What we applied for here is a test certificate. It cannot be used directly; it merely proves that your domain and configuration are all correct. Look closely, and you will find that the issuer domain is `https://acme-staging-v02.api.letsencrypt.org`. You can understand this `staging` as the "Test Server"!
-3. Note: The certificate applied for here is a test certificate, which cannot be used directly. It is only used to prove that your domain and configuration are correct. If you observe carefully, you will find that the domain that issues the certificate to you is `https://acme-staging-v02.api.letsencrypt.org`, and this `staging` can be understood as a "test server"!
+4. If an error occurs in this step, you can run the following command to view the detailed application process and specific errors. (If you don't understand it, hide sensitive information and ask in the Xray community group).
-4. If this step goes wrong, you can run the following command to check the detailed application process and specific errors. If you don't understand, you can hide sensitive information and ask in the Xray group.
+ ```shell
+ acme.sh --issue --server letsencrypt_test -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256 --debug
+ ```
-```shell
-acme.sh --issue --server letsencrypt_test -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256 --debug
-```
+ Yes, that's right, just add a `--debug` parameter at the end of the command.
-(Note: This command is written in Chinese characters, therefore I have translated it into English. The command is used to issue SSL/TLS certificates using acme.sh client with Let's Encrypt CA in test mode for a subdomain of your domain with the specified webroot path, key length and in debug mode.)
+5. After confirming this step is successful, you can apply for the official certificate. (You don't need to delete the test certificate; it will be automatically overwritten by the official certificate).
-Hmm, that's right. Just added a `--debug` parameter at the end of the command.
+## 6.4 Official Certificate Issuance
-5. Once this step is confirmed to be successful, you can apply for the formal certificate. (The test certificate does not need to be deleted, as it will be automatically replaced by the formal certificate.)
+1. The command to apply for the official certificate is as follows (change the `--server letsencrypt_test` parameter to `--server letsencrypt`, and add the `--force` parameter at the end):
-## 6.4 Application for Official Certification
+ ```shell
+ acme.sh --set-default-ca --server letsencrypt
+ ```
-1. The command for applying for an official certificate is as follows (i.e., replace `letsencrypt_test` with `letsencrypt` and add the `--force` parameter at the end):
+ ```shell
+ acme.sh --issue -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256 --force
+ ```
-```shell
-acme.sh --set-default-ca --server letsencrypt
-```
+ ::: warning Note
+ The `--force` parameter means to manually (forcefully) update the certificate before the existing certificate expires. Although the certificate we applied for from the "Test Server" in the previous step cannot be used directly, it has not yet expired, so this parameter is needed.
+ :::
-This is a command in the shell language. It sets the default Certificate Authority (CA) to Let's Encrypt by using the `acme.sh` script.
+2. You should ultimately see a log very similar to the one above:
-```shell
-acme.sh --issue -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256 --force
-```
+ ```log
+ vpsadmin@vps-server:~$ acme.sh --issue -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256
+ [Wed 30 Dec 2022 15:22:51 AM EST] Using CA: [https://acme-v02.api.letsencrypt.org/directory](https://acme-v02.api.letsencrypt.org/directory)
+ [Wed 30 Dec 2022 15:22:51 AM EST] Creating domain key
+ [Wed 30 Dec 2022 15:22:51 AM EST] The domain key is here: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
+ [Wed 30 Dec 2022 15:22:51 AM EST] Single domain='subdomain.yourdomain.com'
+ [Wed 30 Dec 2022 15:22:51 AM EST] Getting domain auth token for each domain
+ [Wed 30 Dec 2022 15:22:51 AM EST] Getting webroot for domain='subdomain.yourdomain.com'
+ [Wed 30 Dec 2022 15:22:51 AM EST] Verifying: subdomain.yourdomain.com
+ [Wed 30 Dec 2022 15:22:51 AM EST] Pending
+ [Wed 30 Dec 2022 15:22:51 AM EST] Success
+ [Wed 30 Dec 2022 15:22:51 AM EST] Verify finished, start to sign.
+ [Wed 30 Dec 2022 15:22:51 AM EST] Lets finalize the order.
+ [Wed 30 Dec 2022 15:22:51 AM EST] Le_OrderFinalize='[https://acme-v02.api.letsencrypt.org/acme/finalize/490205996/7730242872](https://acme-v02.api.letsencrypt.org/acme/finalize/490205996/7730242872)'
+ [Wed 30 Dec 2022 15:22:51 AM EST] Downloading cert.
+ [Wed 30 Dec 2022 15:22:51 AM EST] Le_LinkCert='[https://acme-v02.api.letsencrypt.org/acme/cert/vsxvk0oldnuobe51ayxz4dms62sk2dwmw9zhuw](https://acme-v02.api.letsencrypt.org/acme/cert/vsxvk0oldnuobe51ayxz4dms62sk2dwmw9zhuw)'
+ [Wed 30 Dec 2022 15:22:51 AM EST] Cert success.
+ --BEGIN CERTIFICAT--
+ sxlYqPvWreKgD5b8JyOQX0Yg2MLoRUoDyqVkd31PthIiwzdckoh5eD3JU7ysYBtN
+ cTFK4LGOfjqi8Ks87EVJdK9IaSAu7ZC6h5to0eqpJ5PLhaM3e6yJBbHmYA8w1Smp
+ ... (omitted for brevity) ...
+ yiLKcBFc5H7dgJCImo7us7aJeftC44uWkPM=
+ --END CERTIFICAT--
+ [Wed 30 Dec 2022 15:22:52 AM EST] Your cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.cer
+ [Wed 30 Dec 2022 15:22:52 AM EST] Your cert key is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
+ [Wed 30 Dec 2022 15:22:52 AM EST] The intermediate CA cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/ca.cer
+ [Wed 30 Dec 2022 15:22:52 AM EST] And the full chain certs is there: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/fullchain.cer
+ ```
-(Note: This is a command written in shell script that requests a SSL certificate from ACME server using the ACME client "acme.sh". It specifies the subdomain of the domain name, the web root directory of the website, the key length, and forces the re-issuance of the certificate.)
-
-::: warning Explanation
-The meaning of the `--force` parameter is to manually (forcefully) update the certificate before the existing certificate expires. Although the certificate we applied for from the "test server" in the previous step cannot be used directly, it has not expired yet, so this parameter is needed.
-:::
-
-2. You should eventually see a prompt that looks similar to the one above.
-
-```log
-vpsadmin@vps-server:~$ acme.sh --issue -d subdomain.yourdomain.com -w /home/vpsadmin/www/webpage --keylength ec-256
-[Wed 30 Dec 2022 15:22:51 AM EST] Using CA: https://acme-v02.api.letsencrypt.org/directory
-[Wed 30 Dec 2022 15:22:51 AM EST] Creating domain key
-[Wed 30 Dec 2022 15:22:51 AM EST] The domain key is here: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
-[Wed 30 Dec 2022 15:22:51 AM EST] Single domain='subdomain.yourdomain.com'
-[Wed 30 Dec 2022 15:22:51 AM EST] Getting domain auth token for each domain
-[Wed 30 Dec 2022 15:22:51 AM EST] Getting webroot for domain='subdomain.yourdomain.com'
-[Wed 30 Dec 2022 15:22:51 AM EST] Verifying: subdomain.yourdomain.com
-[Wed 30 Dec 2022 15:22:51 AM EST] Pending
-[Wed 30 Dec 2022 15:22:51 AM EST] Success
-[Wed 30 Dec 2022 15:22:51 AM EST] Verify finished, start to sign.
-[Wed 30 Dec 2022 15:22:51 AM EST] Lets finalize the order.
-[Wed 30 Dec 2022 15:22:51 AM EST] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/490205996/7730242872'
-[Wed 30 Dec 2022 15:22:51 AM EST] Downloading cert.
-[Wed 30 Dec 2022 15:22:51 AM EST] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/vsxvk0oldnuobe51ayxz4dms62sk2dwmw9zhuw'
-[Wed 30 Dec 2022 15:22:51 AM EST] Cert success.
---BEGIN CERTIFICAT--
-sxlYqPvWreKgD5b8JyOQX0Yg2MLoRUoDyqVkd31PthIiwzdckoh5eD3JU7ysYBtN
-cTFK4LGOfjqi8Ks87EVJdK9IaSAu7ZC6h5to0eqpJ5PLhaM3e6yJBbHmYA8w1Smp
-wAb3tdoHZ9ttUIm9CrSzvDBt6BBT6GqYdDamMyCYBLooMyDEM4CUFsOzCRrEqqvC
-2mTTEmhvpojo5rhdTSJxibozyNWTGwoTj0v9pTUeQcGqLIzqi4DowjBHD5guwRid
-SjAFnm6JT2xUQgWFm58A1gv1OhbH1TRPUUmtE1nFEN7YiSjI4xgxqAXT3CLD2EUb
-wXlUrO6c75zSsQP4bRMzgOjJUqHtSb6IEqELzt4M7KzL5iCOruCChCo2DZxUwvVX
-tOoaAyQJzCbTqE6aUqwiKi3gVyoxvDP9mI5JdRYzsDL6GVud7EHPnYeMl9ubLZAK
-0vg84mbMP3f6mYM4KRa1cqiyOIcQPT4AzGFYVv4sm049bZQg7sd0Bz9CaFvE7yDA
-1y17XlgCDnsjxl66bqI1vkENN9XT5xeFHONqc18b5fZEKSIvdX7iWPFWp1PyMPpG
-0pMCP1EymZNFxIMJLgbWqExwLWfPc5Ib3PjBaIqhXPnw6sT2MQSxXwDupq1UJVhV
-7E3hQRVlwI4CXi6WLHJMNvNRyyK87gCrLH1bKYsPeRVaz77poWBq49zwBCts6hPY
-IeF4ltGXyANNIOPEi8vy138fRU4LYh81d8FjOtFfJZogMjwhfNvapqxPMsioPlmX
-TnZu0n7setrVNUEfTMHWqPpDgk5MPrWLA4LapqaDfEX4pwnQJLMwMi6s94z165c0
-iMRSKA1yU5zqv8aNsDfPoY4OkSPWs4MaXgRRSLBsUfZ15DwQXPk76kegHIyxWvwF
-tYw9HKR5QCMK66fa0z4aJoFVFLK0IIOGEZOanRFUCnkLUDd3QZ3YU8lEcrj7Uxos
-haiRNICyC6UfsCJ94a8vcNyMosPv3xBLMp19WXgiFYqEFQkntkv1FLRI35fjeJmg
-0fmD9VG9bkzGPHihJgQLRlCHasGf6XrdfkSsODAyCUHUHJ0RzqF4YEZMcxDxzuQ2
-YO7bFwj7S3mUdVPZ6MPasjxdyBjJgEBMch2uy4AhmudXfEBQBye8W6ZI4ztZjLVV
-FmP4SIuaNUmMe20TjR8b9NVC96AhxOanWT3mRROsdokpKQGTJvl27EHH8KuAbUOc
-G6KtPy4wslNZNXWcBy9n63RcWak12r7kAIFn38tZxmlw2WUKoRSMAH64GcDTjRQd
-Am65hBHzvGrj93wEuVNIebvNIsJOlng3HFjpIxVqKGMCIfWIKGDE3YzK3p4LbGZ6
-NZFQWYJLNVf2M9CCJfbEImPYgvctrxl39H6KVYPCw1SAdaj9NneUqmREOQkKoEB0
-x6PmNirbMscHhQPSC0JQaqUgaQFgba1ALmzRYAnYhNb0twkTxWbY7DBkAarxqMIp
-yiLKcBFc5H7dgJCImo7us7aJeftC44uWkPM=
---END CERTIFICAT--
-[Wed 30 Dec 2022 15:22:52 AM EST] Your cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.cer
-[Wed 30 Dec 2022 15:22:52 AM EST] Your cert key is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/subdomain.yourdomain.com.key
-[Wed 30 Dec 2022 15:22:52 AM EST] The intermediate CA cert is in /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/ca.cer
-[Wed 30 Dec 2022 15:22:52 AM EST] And the full chain certs is there: /home/vpsadmin/.acme.sh/subdomain.yourdomain.com_ecc/fullchain.cer
-```
-
-3. If you observe carefully, you will find that the domain name that issues the certificate to you this time is `https://acme-v02.api.letsencrypt.org`, which lacks the word `staging`. Therefore, this is the [Production Environment]!
+3. Look closely, and you will find that the issuer domain this time is `https://acme-v02.api.letsencrypt.org`. The `staging` is gone, which naturally means it is the "Official Server" (Production)!
## 6.5 Certificate Installation
-1. After completing the certificate application, it needs to be installed to a specified location and referenced in the configuration file to take effect:
+1. After the certificate application is complete, it needs to be installed. Install it to the specified location and reference it in the configuration file:
-```shell
-vpsadmin@vps-server:~$ acme.sh --installcert -d subdomain.yourdomain.com --cert-file /path/to/install/cert.crt --key-file /path/to/install/cert.key --fullchain-file /path/to/install/fullchain.crt --ecc
-[Mon 14 Feb 2022 03:00:25 PM CST] Installing cert to: /etc/xray/cert/cert.crt
-[Mon 14 Feb 2022 03:00:25 PM CST] Installing key to: /etc/xray/cert/cert.key
-[Mon 14 Feb 2022 03:00:25 PM CST] Installing full chain to: /etc/xray/cert/fullchain.crt
-```
-
-(Note: This is a shell command for installing a SSL certificate using acme.sh. The command is specifying the domain, file paths for the certificate, private key, and full chain, as well as indicating that an ECC certificate should be used.)
+ ```shell
+ vpsadmin@vps-server:~$ acme.sh --installcert -d subdomain.yourdomain.com --cert-file /path/to/installation/cert.crt --key-file /path/to/installation/cert.key --fullchain-file /path/to/installation/fullchain.crt --ecc
+ [Mon 14 Feb 2022 03:00:25 PM CST] Installing cert to: /etc/xray/cert/cert.crt
+ [Mon 14 Feb 2022 03:00:25 PM CST] Installing key to: /etc/xray/cert/cert.key
+ [Mon 14 Feb 2022 03:00:25 PM CST] Installing full chain to: /etc/xray/cert/fullchain.crt
+ ```
## 6.6 Your Progress
-At this point, the two basic infrastructures required by Xray are finally in place! Xray, which has been eagerly awaited, is about to be revealed, and we are finally about to enter the most exciting chapter!
+At this point, the two pieces of infrastructure required by Xray are finally in place! The long-awaited Xray is about to be unveiled. We are finally entering the most exciting chapter!
> ⬛⬛⬛⬛⬛⬛⬜⬜ 75%
diff --git a/docs/en/document/level-0/ch07-xray-server.md b/docs/en/document/level-0/ch07-xray-server.md
index 079bdb9d..96492a07 100644
--- a/docs/en/document/level-0/ch07-xray-server.md
+++ b/docs/en/document/level-0/ch07-xray-server.md
@@ -1,580 +1,565 @@
-# [Chapter 7]Xray Server
+# [Chapter 7] Xray Server Guide
-## 7.1 Study broadly, Act decisively.
+## 7.1 Extensive Preparation, Effortless Execution
-During the writing of this article, the boss joked: Your tutorial has been serialized for 6 chapters and has not yet reached Xray. People who don’t know would think that you are a "hand-in-hand teaching you to build a website" tutorial. (I can't refute it.jpg!)
+During the writing of this article, a pro jokingly complained to me: "Your tutorial has been running for 6 chapters and still hasn't reached Xray? People who don't know better might think this is a 'Build Your Own Website' tutorial." (I couldn't even refute that.jpg!)
-In fact, this structure is my decision after much thinking. After all, only by laying a solid foundation can you quickly surpass others with half the effort. I saw many newcomers in the group who can't even use `nano` correctly, nor can they use `WinSCP`. The `config.json` edited by remote handwriting is naturally full of errors, and even error checking becomes difficult.
+Actually, this structure was a decision made after much deliberation. Only by laying a solid foundation can you achieve twice the result with half the effort later on and overtake others quickly. I've seen many newcomers in groups who can't even use `nano` correctly, don't know how to use `WinSCP`, and naturally, the `config.json` they hand-edit remotely is full of errors, making debugging a struggle.
::: warning
-After the preparation of the first 6 chapters, you have already climbed over several mountains with me, such as basic Linux operations, VPS remote management, web page construction, domain name management, certificate application, etc. Do you think it is actually very simple when you look back? Now that we have such solid preparations, we will have a light feeling of [smooth success] when installing and configuring Xray.
+After the preparations in the first 6 chapters, we have climbed over several mountains together: Basic Linux operations, VPS remote management, website setup, domain management, certificate application, etc. Looking back, doesn't it seem quite simple? Now that we have such solid preparation, the upcoming installation and configuration of Xray will feel completely natural and effortless.
:::
-The things to do next are very simple:
+What needs to be done next is very simple:
-1. Installation
-2. Configuration (such as installing TLS certificates, `config.json`)
-3. Run
-4. Optimization (such as updating the kernel, enabling `bbr`, automatically redirecting `http` visits to `https`, etc.)
+1. Installation
+2. Configuration (e.g., installing TLS certificates, `config.json`)
+3. Running
+4. Optimization (e.g., updating the kernel, enabling `bbr`, auto-redirecting `http` to `https`, etc.)
-## 7.2 Install Xray
+## 7.2 Installing Xray
-First of all, the official carrier of Xray is the binary program generated by the open source project [xray-core](https://github.com/XTLS/Xray-core) (Open sourced with License `MPL 2.0`
-). If you put this binary on the server and run it, it is the server side; if you download it to the local computer and run it, it is the client side. The main difference comes from [configuration].
+First, the official carrier of Xray is the binary program generated by the [xray-core](https://github.com/XTLS/Xray-core) open-source project (based on the `MPL 2.0` open-source license). If you run this binary on a server, it is the server-side; if you download it to your local computer and run it, it is the client-side. The main difference lies in the [Configuration].
-When installing, it is very simple and direct to use the official installation script directly. It provides a variety of installation options. If you are interested, you can go to the official [installation script repository](https://github.com/XTLS/Xray-install) to see the script instructions. **This article uses the [non-root
-user] installation mode**.
+For installation, using the official installation script is simple and direct. It provides multiple installation options. Interested users can check the script instructions in the official [installation script repository](https://github.com/XTLS/Xray-install). **This article uses the [Non-root User] installation mode.**
-When writing this article, the installation script had some minor bugs when using a non-root account, so I decided to separate these steps and explain the deletion command under Linux.
+At the time of writing, the installation script has a few small bugs when using a non-root account, so I decided to separate these steps. This also serves as a good opportunity to explain the delete command in Linux.
-1. Basic Linux commands for beginners:
+1. Linux 101 - Basic Commands:
- | Number | Command name | Command description |
- | :------: | :----------: | :-----------------: |
- | `cmd-14` | `rm` | delete |
+ | Number | Command Name | Command Description |
+ | :---: | :---: | :---: |
+ | `cmd-14` | `rm` | Delete command |
-2. Download the installation script:
+2. Download the installation script locally:
-```shell
-wget https://github.com/XTLS/Xray-install/raw/main/install-release.sh
-```
+ ```shell
+ wget [https://github.com/XTLS/Xray-install/raw/main/install-release.sh](https://github.com/XTLS/Xray-install/raw/main/install-release.sh)
+ ```
-3. Execute the installation command
+3. Execute the installation command:
-```shell
-sudo bash install-release.sh
-```
+ ```shell
+ sudo bash install-release.sh
+ ```
-4. You can delete the script after use
+4. After use, you can delete the script:
-```shell
-rm ~/install-release.sh
-```
-
-::: warning
-When you use the `rm` command to delete files, the default is to delete the files in the current folder. However, **I still wrote the full path**: `~/install-release.sh`, which is a safety habit I have when using `rm`, and it is also what I want to emphasize after I divide the installation into several steps. If you have heard some jokes like "Programmers go from deleting libraries to running away", you probably know why.
-:::
-
-5. The complete process is demonstrated as follows:
-
-
-
-## 7.3 Configure TLS certificate for Xray
-
-Although we have applied for TLS
-certificate before, according to the official instructions of [`acme.sh`](https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E#3-copy%E5%AE%89%E8%A3%85-%E8%AF%81%E4%B9%A6), it is not recommended to use the applied certificate directly. The correct way is to use the `--install-cert`
-command to install it for the required program. Let's install the certificate for `xray-core` now.
-
-1. In order to avoid various potential permission problems of non-root accounts, we create a certificate folder under the vpsadmin account
-
-```shell
-mkdir ~/xray_cert
-```
-
-2. Use `--install-cert` of `acme.sh` to correctly install (copy) the certificate file
-
-```shell
-acme.sh --install-cert -d secondary domain name.your domain name.com --ecc \
---fullchain-file ~/xray_cert/xray.crt \
---key-file ~/xray_cert/xray.key
-```
-
-3. The `xray.key` file is not readable by other users by default, so it needs to be given readability
-
-```shell
-chmod +r ~/xray_cert/xray.key
-```
-
-4. The process is relatively simple, so no animated picture:
-
-
-
-5. `acme.sh` will check the certificate every 60 days and automatically renew the expiring certificate. But as far as I know, it does not automatically install the new certificate to `xray-core`, so we need to add a system automatic periodic task to complete this step.
- 1. Basic Linux commands for beginners:
-
- | Number | Command name | Command description |
- | :------: | :----------: | :------------------------------------: |
- | `cmd-15` | `crontab -e` | Edit the current user's scheduled task |
-
- 2. Create a script file (`xray-cert-renew.sh`)
-
- ```shell
- nano ~/xray_cert/xray-cert-renew.sh
- ```
-
- 3. Copy the following content, remember to replace your real domain name, then save and exit
-
- ```bash
- #!/bin/bash
-
- /home/vpsadmin/.acme.sh/acme.sh --install-cert -d a-name.yourdomain.com --ecc --fullchain-file /home/vpsadmin/xray_cert/xray.crt --key-file /home/vpsadmin/xray_cert/xray.key
- echo "Xray Certificates Renewed"
-
- chmod +r /home/vpsadmin/xray_cert/xray.key
- echo "Read Permission Granted for Private Key"
-
- sudo systemctl restart xray
- echo "Xray Restarted"
- ```
+ ```shell
+ rm ~/install-release.sh
+ ```
::: warning
- As you have reminded, `acme.sh` has a `reloadcmd` command that can automatically execute a specific command when the certificate is updated, so you can specify to automatically install the certificate for `Xray`, but because `crontab` is a very useful and commonly used function in Linux, this article retains the `crontab` method to update the `Xray` certificate. (If you interested in `reloadcmd` can check out the [official documentation](https://github.com/acmesh-official/acme.sh) of `acme.sh`)
+ When using the `rm` command to delete a file, it defaults to deleting the file in the current folder. However, **I still wrote the full path**: `~/install-release.sh`. This is a safety habit of mine when using `rm`, and it is also something I wanted to emphasize by breaking the installation into steps. If you've heard jokes about "programmers deleting the database and running away," you probably understand why.
+ :::
- In addition, when recording animated images, the script did not include a command to restart `Xray` because `Xray` plans to support the [Certificate Hot Update] function, which means that `Xray` will automatically identify certificate updates and reload certificates without manual restart. After the function is added, I will modify `config.json` appropriately
- to enable this setting and delete the restart command in the script.
- ::: 4. Add [executable] permissions to this file
+5. The complete process demonstration is as follows:
+ 
+
+## 7.3 Configuring TLS Certificates for Xray
+
+Although we have already applied for TLS certificates earlier, according to the [official documentation of `acme.sh`](https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E#3-copy%E5%AE%89%E8%A3%85-%E8%AF%81%E4%B9%A6), it is not recommended to use the applied certificates directly. The correct method is to use the `--install-cert` command to install them for the required program. Now, let's install the certificate for `xray-core` to use.
+
+1. To avoid various potential permission issues with non-root accounts, we create a certificate folder under the vpsadmin account.
+
+ ```shell
+ mkdir ~/xray_cert
+ ```
+
+2. Use `acme.sh`'s `--install-cert` to correctly install (copy) the certificate files.
+
+ ```shell
+ acme.sh --install-cert -d subdomain.yourdomain.com --ecc \
+ --fullchain-file ~/xray_cert/xray.crt \
+ --key-file ~/xray_cert/xray.key
+ ```
+
+3. The `xray.key` file is not readable by other users by default, so we need to grant it read permissions.
+
+ ```shell
+ chmod +r ~/xray_cert/xray.key
+ ```
+
+4. The process is simple, so no GIF is provided:
+
+ 
+
+5. `acme.sh` checks the certificate every 60 days and automatically renews it if it's close to expiration. However, as far as I know, it does not automatically install the new certificate to `xray-core`, so we need to add a system automatic periodic task to complete this step.
+
+ 1. Linux 101 - Basic Commands:
+
+ | Number | Command Name | Command Description |
+ | :---: | :---: | :---: |
+ | `cmd-15` | `crontab -e` | Edit the current user's scheduled tasks |
+
+ 2. Create a script file (`xray-cert-renew.sh`):
+
+ ```shell
+ nano ~/xray_cert/xray-cert-renew.sh
```
+
+ 3. Copy the content below into it, remembering to replace it with your real domain name, then save and exit.
+
+ ```bash
+ #!/bin/bash
+
+ /home/vpsadmin/.acme.sh/acme.sh --install-cert -d a-name.yourdomain.com --ecc --fullchain-file /home/vpsadmin/xray_cert/xray.crt --key-file /home/vpsadmin/xray_cert/xray.key
+ echo "Xray Certificates Renewed"
+
+ chmod +r /home/vpsadmin/xray_cert/xray.key
+ echo "Read Permission Granted for Private Key"
+
+ sudo systemctl restart xray
+ echo "Xray Restarted"
+ ```
+
+ ::: warning
+ As pointed out by others, `acme.sh` has a `reloadcmd` command that can automatically execute specific commands when the certificate is updated. This could be used to automatically install certificates for `Xray`. However, since `crontab` is a very useful and common function in Linux systems, this article retains the `crontab` method for updating `Xray` certificates. (Those interested in `reloadcmd` can check the [official documentation](https://github.com/acmesh-official/acme.sh) of `acme.sh`).
+
+ Additionally, in the GIF recording, the script did not include the `Xray` restart command because `Xray` plans to support [Certificate Hot Reload], meaning `Xray` will automatically recognize certificate updates and reload them without a manual restart. Once this feature is added, I will modify `config.json` appropriately to enable this setting and remove the restart command from the script.
+ :::
+
+ 4. Add [Executable] permission to this file.
+
+ ```shell
chmod +x ~/xray_cert/xray-cert-renew.sh
```
- 5. Run `crontab -e` and add an automatic task [Automatically run `xray-cert-renew.sh` once a month] (Note that you should not add `sudo`, because we are adding an automatic task for the `vpsadmin`
- account. When you run it for the first time, you will be asked to choose an editor. Of course, choose the familiar `nano`!)
+ 5. Run `crontab -e` to add an automatic task [Run `xray-cert-renew.sh` automatically once a month] (Note: do not add `sudo`, because we are adding the automatic task for the `vpsadmin` account. When running for the first time, it will ask you to choose an editor; choose the familiar `nano`!).
- ```shell
- crontab -e
- ```
+ ```shell
+ crontab -e
+ ```
- 6. Add the following content to the end of the file, save and exit.
+ 6. Add the following content to the end of the file, save, and exit.
```
# 1:00am, 1st day each month, run `xray-cert-renew.sh`
0 1 1 * * bash /home/vpsadmin/xray_cert/xray-cert-renew.sh
```
- 7. The complete process is demonstrated as follows:
+ 7. The complete process demonstration is as follows:
- 
+ 
-## 7.4 Configure Xray
+## 7.4 Configuring Xray
-First, you can refer to the [official VLESS configuration example](https://github.com/XTLS/Xray-examples) for various configurations. This article will configure a simplest method based on the official example: [Single `VLESS` protocol inbound + `80` Port fallback], which meets the maximum speed and necessary security of most scenarios.
+First, various configurations can refer to the [official VLESS configuration examples](https://github.com/XTLS/Xray-examples). This article will configure a most streamlined method based on the official examples: [Single `VLESS` protocol inbound + Port `80` fallback], satisfying maximum speed and necessary security for most scenarios.
-1. Generate a legal `UUID` and save it for backup (`UUID` can be simply and roughly understood as an ID that is almost never repeated like a fingerprint)
+1. Generate a valid `UUID` and save it for later use (`UUID` can be simply understood as an ID, like a fingerprint, that almost never repeats).
- ```shell
- xray uuid
- ```
+ ```shell
+ xray uuid
+ ```
-2. Create log files and folders for backup
- 1. Basic Linux commands for beginners:
- | Number | Command name | Command description |
- |:--:|:--:|:--:|
- | `cmd-16` | `touch` | Create a blank file |
+2. Create log files and folders for later use.
+ 1. Linux 101 - Basic Commands:
- 2. Create a [log dedicated folder] in the `vpsadmin` folder
+ | Number | Command Name | Command Description |
+ | :---: | :---: | :---: |
+ | `cmd-16` | `touch` | Create a blank file |
- ```shell
- mkdir ~/xray_log
- ```
+ 2. Create a [Log Dedicated Folder] inside the `vpsadmin` folder.
- 3. Generate the two required log files (access log, error log)
+ ```shell
+ mkdir ~/xray_log
+ ```
- ```shell
- touch ~/xray_log/access.log && touch ~/xray_log/error.log
- ```
+ 3. Generate the two required log files (access log, error log).
- ::: warning
- This location is not the standard log file location of `Xray`. It is placed here to avoid permission issues that cause trouble for new users. Once you are familiar with it, it is recommended to return to the default location: `/var/log/xray/access.log` and `/var/log/xray/error.log`.
- ::: 4. Because Xray is used by the nobody user by default, we need to allow other users to have "write" permissions (`*.log` means all files with the suffix `log`, and the efficiency advantage of the `CLI` interface gradually appears at this time)
+ ```shell
+ touch ~/xray_log/access.log && touch ~/xray_log/error.log
+ ```
- ```shell
- chmod a+w ~/xray_log/*.log
- ```
+ ::: warning
+ This location is not the standard `Xray` log file location. Placing it here is to avoid permission issues causing trouble for newcomers. Once you are familiar with it, it is recommended to revert to the default location: `/var/log/xray/access.log` and `/var/log/xray/error.log`.
+ :::
-3. Use `nano` to create the configuration file of `Xray`
+ 4. Since Xray defaults to running as the `nobody` user, we need to allow other users to have "write" permissions (`*.log` means all files with the `log` suffix; the efficiency advantage of the `CLI` interface gradually appears here).
-```shell
-sudo nano /usr/local/etc/xray/config.json
-```
+ ```shell
+ chmod a+w ~/xray_log/*.log
+ ```
-4. Copy all the files below and fill in the previously generated `UUID` into the 61st line `"id": "",`. (After filling in, it will look like `"id": "uuiduuid-uuid-uuid-uuid-uuiduuiduuid"`
- ) This configuration file in this article adds my various verbose comments to help you understand the function of each configuration module.
+3. Use `nano` to create the `Xray` configuration file.
-```json
-// REFERENCE:
-// https://github.com/XTLS/Xray-examples
-// https://xtls.github.io/config/
-// Commonly used config files, whether server or client, have 5 parts. Plus Xiao Xiaobai's interpretation:
-// ┌─ 1*log Log settings - what to write in the log and where to write (there is evidence when errors occur)
-// ├─ 2_dns DNS-settings - how to check DNS (anti-DNS pollution, anti-peeping, avoid matching domestic and foreign sites to foreign servers, etc.)
-// ├─ 3_routing Diversion settings - how to classify and process traffic (whether to filter ads, whether to divert traffic domestically and internationally)
-// ├─ 4_inbounds Inbound settings - what traffic can flow into Xray
-// └─ 5_outbounds Outbound settings - where does the traffic out of Xray go
-{
- // 1\_Log settings
- "log": {
- "loglevel": "warning", // content from less to more: "none", "error", "warning", "info", "debug"
- "access": "/home/vpsadmin/xray_log/access.log", // access record
- "error": "/home/vpsadmin/xray_log/error.log" // Error log
- },
- // 2_DNS settings
- "dns": {
- "servers": [
- "https+local://1.1.1.1/dns-query", // Prefer 1.1.1.1 DoH query, sacrificing speed but preventing ISP snooping
- "localhost"
- ]
- },
- // 3*Diversion settings
- "routing": {
- "domainStrategy": "IPIfNonMatch",
- "rules": [
- // 3.1 Prevent local server flow problems: such as intranet attacks or abuse, incorrect local loopbacks, etc.
- {
- "ip": [
- "geoip:private" // Diversion condition: In the geoip file, the rule named "private" (local)
- ],
- "outboundTag": "block" // Diversion strategy: Hand over to the outbound "block" for processing (black hole shielding)
- },
- {
- // 3.2 Prevent the server from connecting directly to China
- "ip": ["geoip:cn"],
- "outboundTag": "block"
- },
- // 3.3 Block ads
- {
- "domain": [
- "geosite:category-ads-all" // Diversion conditions: In the geosite file, the rule named "category-ads-all" (various advertising domain names)
- ],
- "outboundTag": "block" // Diversion strategy: Hand it over to the outbound "block" for processing (black hole shielding)
- }
- ]
- },
- // 4* Inbound settings
- // 4.1 Here is only the simplest vless+xtls inbound, because this is the most powerful mode of Xray. If you need other, please add it according to the template.
- "inbounds": [
+ ```shell
+ sudo nano /usr/local/etc/xray/config.json
+ ```
+
+4. Copy the entire file below into it, and fill in the previously generated `UUID` into line 61 `"id": "",`. (After filling it in, it looks like `"id": "uuiduuid-uuid-uuid-uuid-uuiduuiduuid"`). I have added various verbose annotations to this configuration file in this article to help you understand the function of each configuration module.
+
+ ```json
+ // REFERENCE:
+ // [https://github.com/XTLS/Xray-examples](https://github.com/XTLS/Xray-examples)
+ // [https://xtls.github.io/config/](https://xtls.github.io/config/)
+ // Common config files, whether server or client, have 5 parts. Plus newbie interpretation:
+ // ┌─ 1*log Log Settings - What to write, where to write (evidence available when errors occur)
+ // ├─ 2_dns DNS Settings - How to query DNS (prevent DNS pollution, prevent snooping, avoid matching domestic sites to foreign servers, etc.)
+ // ├─ 3_routing Routing Settings - How to classify and process traffic (whether to filter ads, split domestic/international traffic)
+ // ├─ 4_inbounds Inbound Settings - What traffic can flow into Xray
+ // └─ 5_outbounds Outbound Settings - Where the traffic flowing out of Xray goes
{
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
+ // 1_Log Settings
+ "log": {
+ "loglevel": "warning", // Content from least to most: "none", "error", "warning", "info", "debug"
+ "access": "/home/vpsadmin/xray_log/access.log", // Access record
+ "error": "/home/vpsadmin/xray_log/error.log" // Error record
+ },
+ // 2_DNS Settings
+ "dns": {
+ "servers": [
+ "https+local://1.1.1.1/dns-query", // Prefer 1.1.1.1 DoH query, sacrifices speed but prevents ISP snooping
+ "localhost"
+ ]
+ },
+ // 3_Routing Settings
+ "routing": {
+ "domainStrategy": "IPIfNonMatch",
+ "rules": [
+ // 3.1 Prevent local server loop issues: e.g., intranet attacks or abuse, wrong local loops, etc.
{
- "id": "", // Fill in your UUID
- "flow": "xtls-rprx-vision",
- "level": 0,
- "email": "vpsadmin@yourdomain.com"
- }
- ],
- "decryption": "none",
- "fallbacks": [
+ "ip": [
+ "geoip:private" // Routing condition: rules named "private" in the geoip file (local)
+ ],
+ "outboundTag": "block" // Routing strategy: hand over to outbound "block" processing (blackhole blocking)
+ },
{
- "dest": 80 // Fall back to anti-detection proxy by default
+ // 3.2 Prevent server from directly connecting to domestic (CN) IPs
+ "ip": ["geoip:cn"],
+ "outboundTag": "block"
+ },
+ // 3.3 Block Ads
+ {
+ "domain": [
+ "geosite:category-ads-all" // Routing condition: rules named "category-ads-all" in the geosite file (various ad domains)
+ ],
+ "outboundTag": "block" // Routing strategy: hand over to outbound "block" processing (blackhole blocking)
}
]
},
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "alpn": "http/1.1",
- "certificates": [
- {
- "certificateFile": "/home/vpsadmin/xray_cert/xray.crt",
- "keyFile": "/home/vpsadmin/xray_cert/xray.key"
+ // 4_Inbound Settings
+ // 4.1 Here only one simplest vless+xtls inbound is written, because this is Xray's most powerful mode. If needed, please add others based on templates.
+ "inbounds": [
+ {
+ "port": 443,
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": "", // Fill in your UUID
+ "flow": "xtls-rprx-vision",
+ "level": 0,
+ "email": "vpsadmin@yourdomain.com"
+ }
+ ],
+ "decryption": "none",
+ "fallbacks": [
+ {
+ "dest": 80 // Default fallback to the probe-resistant proxy
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "tcp",
+ "security": "tls",
+ "tlsSettings": {
+ "alpn": "http/1.1",
+ "certificates": [
+ {
+ "certificateFile": "/home/vpsadmin/xray_cert/xray.crt",
+ "keyFile": "/home/vpsadmin/xray_cert/xray.key"
+ }
+ ]
}
- ]
+ }
}
- }
+ ],
+ // 5_Outbound Settings
+ "outbounds": [
+ // 5.1 The first outbound is the default rule, freedom is direct connection (VPS is already on the external network, so direct connection)
+ {
+ "tag": "direct",
+ "protocol": "freedom"
+ },
+ // 5.2 Blocking rule, blackhole protocol sends traffic into a black hole (blocking)
+ {
+ "tag": "block",
+ "protocol": "blackhole"
+ }
+ ]
}
- ],
- // 5*Outbound settings
- "outbounds": [
- // 5.1 The first outbound is the default rule, freedom is a direct connection to the outside (vps is already an external network, so it is a direct connection)
- {
- "tag": "direct",
- "protocol": "freedom"
- },
- // 5.2 Blocking rules, blackhole protocol is to import traffic into the black hole (blocking)
- {
- "tag": "block",
- "protocol": "blackhole"
- }
- ]
-}
-```
+ ```
-5. The complete process is demonstrated as follows:
- 
+5) The complete process demonstration is as follows:
+ 
-## 7.5 Start Xray service! ! (and check the service status)
+## 7.5 Start Xray Service!! (And check service status)
-If you follow this article step by step, you have actually avoided the two most common pitfalls of **insufficient log file permissions** and **insufficient certificate file permissions**. Now running `Xray` should be very smooth.
+If you have followed this article step by step, you have actually avoided the most common pitfalls of **insufficient log file permissions** and **insufficient certificate file permissions**. So now, running `Xray` should naturally be incredibly smooth.
-1. Enter the following command and enjoy the historic moment of starting `Xray`! ! !
+1. Enter the command below and enjoy the historic moment of starting `Xray`!!!
-```shell
-sudo systemctl start xray
-```
+ ```shell
+ sudo systemctl start xray
+ ```
-2. Just `start` does not determine whether the Xray service has been successfully started. To determine its status, use the following command.
+2. Just `start` doesn't confirm if we have successfully opened the Xray service. To determine its status, use the following command.
-```shell
-sudo systemctl status xray
+ ```shell
+ sudo systemctl status xray
+ ```
-```
+ See that green, delightful `active (running)`? It says `Xray` is running correctly.
-Do you see the green, pleasant `active (running)`? It means that `Xray` is running correctly
+3. The complete process demonstration is as follows:
-3. The complete process is demonstrated as follows:
+ 
-
+## 7.6 Reviewing `systemd` for Basic Service Management
-## 7.6 Review `systemd` for basic service management
+So far, we have used `systemctl` related commands like `start`, `status`, `reload`, etc. These are general commands for managing various services in the Linux system based on the `systemd` management module. Now is a good time to familiarize yourself with a few other related commands.
-So far, we have used `systemctl` related commands such as `start`, `status`, `reload`, etc. These are general commands based on the `systemd` management module to manage various services in the Linux
-system. Now it is a good time to get familiar with several other related commands.
+1. If you need to temporarily stop the `Xray` service, use the `stop` command:
-1. If you need to temporarily shut down the `Xray` service, use the `stop` command
+ ```shell
+ sudo systemctl stop xray
+ ```
-```shell
-sudo systemctl stop xray
-```
+2. If you need to restart the `Xray` service, use the `restart` command:
-2. If you need to restart the `Xray` service, use the `restart` command
+ ```shell
+ sudo systemctl restart xray
+ ```
-```shell
-sudo systemctl restart xray
-```
+3. If you need to disable the `Xray` service (prevent Xray from running automatically after computer restart), use the `disable` command:
-3. If you need to disable the `Xray` service (disable Xray from running automatically after the computer is restarted), use the `disable` command
+ ```shell
+ sudo systemctl disable xray
+ ```
-```shell
-sudo systemctl disable xray
-```
+4. If you need to enable the `Xray` service (ensure Xray runs automatically after computer restart), use the `enable` command:
-4. If you need to enable the `Xray` service (ensure that Xray runs automatically after the computer is restarted), use the `enable` command
-
-```shell
-sudo systemctl enable xray
-```
+ ```shell
+ sudo systemctl enable xray
+ ```
## 7.7 Server Optimization 1: Enable BBR
-1. The legendary `BBR`
+1. The Legendary `BBR`
-I believe that when you search for various scientific Internet technologies, you must have heard of the thing `bbr` more than once. With the exaggeration of various blogs, people feel that it is magical. There are also a lot of derivatives such as `bbrplus`, `bbr2`, `magic bbr`, etc. It's like a magic, which can turn a poorly routed lines become dedicated connections.
+ I believe that when you search for various scientific internet access technologies (censorship circumvention), you must have heard of `bbr` more than once. Under the embellishment of various blogs, it seems miraculous. There are also a bunch of derivatives like `bbrplus`, `bbr2`, `modified bbr`, etc., as if they were magic oils that can turn a cheap line into a dedicated line.
-So, what is this thing? Is it useful? Which version should I use?
+ So, what exactly is this thing? Is it useful? And which version should be used?
-2. The actual `BBR`
+2. The Actual `BBR`
-**BBR** = **B**ottleneck **B**andwidth and **R**ound-trip propagation time, which is a **congestion control algorithm** of TCP. A simple and rough understanding is **traffic management of data traffic**
-: When the road is no longer congested, each car can naturally maintain a faster speed.
+ **BBR** = **B**ottleneck **B**andwidth and **R**ound-trip propagation time. It is a TCP **congestion control algorithm**. To understand it simply and crudely, it is **traffic management for data**: when the highway is not jammed, every car can naturally maintain a faster speed.
-So is it useful? Generally speaking, there will be a perceptible difference between `with BBR` and `without BBR` (there will be some improvements in speed, stability, and latency), so **[It is highly recommended to turn on `BBR`]**.
+ So is it useful? Generally speaking, there is a perceptible difference between `With BBR` and `Without BBR` (improvements in speed, stability, and latency), so **[It is highly recommended to enable `BBR`]**.
-But after it is enabled, the difference between `BBR` in `4.x` and `5.x` is often subtle and subjective, and the decisive factor that causes the difference in experience is still the line quality. So **[Don't worry about the version, don't blindly chase the new, just follow your distribution to update the kernel]**
+ However, after enabling it, the difference between `BBR` in `4.x` and `5.x` is often subtle and subjective. The decisive factor causing the experience difference is still the line quality. So **[Do not obsess over versions, do not blindly chase the new, just follow your distribution's kernel updates]**.
-3. Are `bbrplus`, `bbr2`, `magic bbr` and other versions that sound cool better?
+3. Are `bbrplus`, `bbr2`, `modified bbr` and other versions with cool-sounding names better?
-In a word: **No! Don't use these! These names are just to attract attention! **
+ In one word: **No! Don't use these! These are names made up just to attract attention!**
-The update and release of `BBR` are all carried out in accordance with the Linux kernel (`Kernel`). In other words, as long as you use a relatively new kernel, you will naturally use the new version of `BBR`.
+ The update and release of `BBR` follow the Linux kernel (`Kernel`). In other words, as long as you use a relatively new kernel, you will naturally use the new version of `BBR`.
-And these things with cool names are, to put it bluntly, kernels that have not yet been officially released and are still in the testing stage and their corresponding `BBR` versions. These scripts are just the first to enable by downloading the preview version of the kernel (even a third-party magic kernel).
+ And those things with cool names are essentially unreleased kernels still in the testing phase and their corresponding `BBR` versions. These scripts merely enable them by downloading preview kernels (or even third-party modified kernels).
-The stability of the kernel is the cornerstone of the stable operation of a server. **The slight performance difference brought by the BBR beta is definitely not worth changing to an unstable Kernel. 】** Please choose the latest kernel supported by your Linux distribution, so as to maximize the long-term stability and compatibility of the server.
+ Kernel stability is the cornerstone of a stable server operation. **[The subtle performance difference brought by the BBR beta version is absolutely not worth swapping for an unstable kernel.]** Please choose the latest kernel supported by your Linux distribution, which maximizes the long-term stability and compatibility of the server.
-::: warning
-The so-called "leading" of the magic modification `bbr` is very time-sensitive. For example, many `bbrplus` scripts, because they have not been updated for several years, will still change your kernel to `4.19`. You should know that Debian is now stable and it is already the era of `5.9`. Then this script may be a little ahead in January 2018, but it has lost its meaning when 4.19 is released in October 2018. It can even be said to be completely [downgraded] and [degraded] now.
-:::
+ ::: warning
+ The so-called "lead" of modified `bbr` has a very strong timeliness. For example, many `bbrplus` scripts have not been updated for several years, and even now they will replace your kernel with `4.19`. You should know that stable distributions like Debian are already in the `5.9` era. So maybe this script was a little ahead in January 2018, but by October 2018 when 4.19 was officially released, it had lost its meaning. Putting it in use now can even be considered a complete [Downgrade] and [Degradation].
+ :::
-4. Which of `fq`, `fq_codel`, `fq_pie`, `cake` and other algorithms is better?
+4. Which algorithm is better: `fq`, `fq_codel`, `fq_pie`, `cake` or others?
-In one sentence: **If you don't understand, please keep `fq`, which is enough and will not degrade your line**
+ In one word: **If you don't understand, please keep `fq`. It is sufficient and will not degrade your line.**
-5. Ruisu, Finalspeed, LotServer and other "acceleration tools"
+5. RuiSu (ServerSpeeder), Finalspeed, LotServer, and other "Acceleration Tools"
-In one sentence: **Don't use these! Throw them into the trash can of history! **
+ In one word: **Do not use these! Throw them into the trash bin of history!**
-It can only solve the problem of packet loss rate. A not very accurate analogy is that you originally used a car to deliver your goods, and sometimes the car broke down halfway (packet loss). After using these, you directly sent out 3 copies of the same goods and let three cars deliver them at the same time. As long as one of them is not broken, it can be delivered. The road is full of your cars, so you can naturally squeeze others out. But it is conceivable that when you squeeze others, others will also squeeze you, and the exit road of the entire computer room is so wide, and it is bound to become a collective traffic jam in the end.
+ The only problem they can solve is the packet loss rate. To use an imprecise analogy: originally you used one car to deliver your goods, sometimes the car broke down halfway (packet loss). After using these, you directly send out 3 identical copies of the goods, letting three cars deliver at the same time. As long as one doesn't break down, it gets delivered. The road is full of your cars, so naturally, you squeeze others out. But predictably, when you squeeze others, others will also squeeze you. The exit road of the entire computer room is only so wide, and eventually, it is bound to turn into a massive collective traffic jam.
-::: warning Description
-Their principle is not algorithm optimization, not speed-up, most of them are simple and crude **multiple packet delivery**. It may be useful for bad lines with very high packet loss rates, but it has no optimization effect on good lines with low packet loss rates. Instead, it will consume your traffic exponentially, causing unnecessary pressure on the server and your neighbors.
+ ::: warning Note
+ Their principle is not algorithm optimization or speed boosting; most are simple and crude **multi-packet sending**. For poor lines with [very high packet loss rates], they might have some effect, but for good lines with low packet loss rates, [they have no optimization effect, and instead will multiply your traffic consumption], thereby causing unnecessary pressure on the server and your neighbors.
-If your line really has a very high packet loss rate, the only reliable solution is to **change the line**.
-:::
+ If your line really has a ridiculously high packet loss rate, the truly reliable solution is to [Change the Line].
+ :::
-6. I have said so much because there are too many misconceptions and scam scripts around `BBR` to fool novices. I hope you now have a relatively clear understanding of `BBR`. Next, let's install the latest Debian kernel and enable `BBR`! (It's really simple)
+6. I've been rambling so much because there are too many misconceptions and pitfall scripts fooling newbies surrounding `BBR`. I hope you now have a relatively clear understanding of `BBR`. Next, let's install the latest Debian kernel and enable `BBR`! (It's really simple)
-7. Add the official `backports` source to Debian 10 to get the updated software library
+7. Add the official `backports` source to Debian 10 to get updated software libraries.
-```shell
-sudo nano /etc/apt/sources.list
-```
+ ```shell
+ sudo nano /etc/apt/sources.list
+ ```
-::: warning Description
-This article takes Debian 10 as an example, so there is still no problem using `/etc/apt/sources.list`, but if you are not starting from scratch according to this article, or using other Linux
-distributions, it is recommended that you create a `/etc/apt/sources.list.d/` folder and create your own configuration file in this folder, such as `/etc/apt/sources.list.d/vpsadmin.list`
-, to ensure compatibility and avoid the default file being overwritten in unforeseen circumstances and causing configuration loss.
-:::
+ ::: warning Note
+ This article takes Debian 10 as an example, so using `/etc/apt/sources.list` is fine. However, if you are not starting from scratch following this article, or are using another Linux distribution, I suggest you create a `/etc/apt/sources.list.d/` folder and create your own configuration file inside this folder, like `/etc/apt/sources.list.d/vpsadmin.list`. This ensures compatibility and avoids configuration loss caused by default files being overwritten in unforeseen circumstances.
+ :::
-8. Then add the following item at the end, save and exit.
+8. Then add the following line at the end, save, and exit.
-```
-deb http://deb.debian.org/debian buster-backports main
-```
+ ```
+ deb [http://archive.debian.org/debian](http://archive.debian.org/debian) buster-backports main
+ ```
-9. Refresh the software library and query the latest version of the official Debian kernel and install it. Please be sure to install the version corresponding to your VPS (this article takes the more common [amd64] as an example).
+9. Refresh the software library, query the latest official Debian kernel, and install it. Please be sure to install the version corresponding to your VPS (this article uses the common [amd64] as an example).
-```shell
-sudo apt update && sudo apt -t buster-backports install linux-image-amd64
-```
+ ```shell
+ sudo apt update && sudo apt -t buster-backports install linux-image-amd64
+ ```
-::: warning Note
+ ::: warning Attention
+ If your VPS supports it, you can try the [Cloud Server Dedicated Kernel] `linux-image-cloud-amd64`. The advantage is that it is streamlined and uses fewer resources. The downside is that some students reported that forcing installation on unsupported systems leads to boot failure (Kernel cannot be recognized).
-If your VPS supports it, you can try the [cloud server dedicated kernel] `linux-image-cloud-amd64`. The advantages are simplicity and low resource usage. The disadvantage is that some students have reported that forced installation on an unsupported system will cause the system to fail to boot (the kernel cannot be recognized).
+ To avoid the tragedy of being unable to recognize the kernel, please ensure:
+ - Take a system snapshot before trying, or
+ - You have `vnc` to save the situation (and you know how to use it)
+ :::
-To avoid the tragedy of being unable to identify, please make sure:
+10. Modify the `kernel` parameter configuration file `sysctl.conf` and specify enabling `BBR`.
-- Take a system snapshot before trying, or
-- You have `vnc` to save the day (and you know how to use it)
+ ```shell
+ sudo nano /etc/sysctl.conf
+ ```
-:::
+ ::: warning Note
+ This article takes Debian 10 as an example, so using `/etc/sysctl.conf` is fine. However, if you are not starting from scratch following this article, or are using another Linux distribution, I suggest you create a `/etc/sysctl.d/` folder and create your own configuration file inside this folder, like `/etc/sysctl.d/vpsadmin.conf`. This ensures compatibility because some distributions no longer read parameters from `/etc/sysctl.conf` after `systemd` version 207. Using a custom configuration file also avoids configuration loss caused by default files being overwritten in unforeseen circumstances.
+ :::
-10. Modify the `kernel` parameter configuration file `sysctl.conf` and specify to enable `BBR`
+11. Add the following content into it:
-```shell
-sudo nano /etc/sysctl.conf
-```
+ ```
+ net.core.default_qdisc=fq
+ net.ipv4.tcp_congestion_control=bbr
+ ```
-::: warning Description
-This article takes Debian 10 as an example, so it is still no problem to use `/etc/sysctl.conf`, but if you are not following this article from scratch, or use other Linux distributions, it is recommended that you create a `/etc/sysctl.d/`
-folder and create your own configuration file in this folder, such as `/etc/sysctl.d/vpsadmin.conf`, to ensure compatibility, because some distributions no longer read parameters from `/etc/sysctl.conf` after `systemd`
-207 version. Using a custom configuration file can also prevent the default file from being overwritten in unexpected circumstances, resulting in configuration loss.
-:::
+12. Reboot the VPS to make the kernel update and `BBR` settings take effect.
-11. Add the following content
+ ```shell
+ sudo reboot
+ ```
-```
-net.core.default_qdisc=fq
-net.ipv4.tcp_congestion_control=bbr
-```
+13. The complete process demonstration is as follows:
-12. Restart the VPS to make the kernel update and `BBR` settings take effect
+ ::: tip Mr. Verbose
+ Because the VPS I used for the demonstration supports the cloud server dedicated kernel, I used `linux-image-cloud-amd64` in the GIF. If you are not sure if your VPS supports it, please be sure to follow the command in step 3 and use the regular kernel `linux-image-amd64`.
+ :::
-```shell
-sudo reboot
-```
+ 
-13. The complete process is demonstrated as follows:
+14. Confirm `BBR` is enabled
-::: tip
-Because the VPS I am demonstrating supports the cloud server-specific kernel, I used `linux-image-cloud-amd64` in the animation.
+ If you want to confirm if `BBR` is enabled correctly, you can use the following command:
-If you are not sure whether your VPS supports it, please follow the command in step 3 and use the regular kernel `linux-image-amd64`.
-:::
+ ```shell
+ lsmod | grep bbr
+ ```
-
+ It should return a result like this:
-14. Confirm that `BBR` is enabled
+ ```
+ tcp_bbr
+ ```
-If you want to confirm whether `BBR` is enabled correctly, you can use the following command:
+ If you want to confirm if the `fq` algorithm is enabled correctly, you can use the following command:
-```shell
-lsmod | grep bbr
-```
+ ```shell
+ lsmod | grep fq
+ ```
-This should return the following result:
+ It should return a result like this:
-```
-tcp_bbr
-```
+ ```
+ sch_fq
+ ```
-If you want to confirm whether the `fq` algorithm is enabled correctly, you can use the following command:
+## 7.8 Server Optimization 2: Enable Auto-Redirect from HTTP to HTTPS
-```shell
-lsmod | grep fq
-```
+1. We previously set up an `http` webpage on port `80` and used it to apply for a TLS certificate.
-This should return the following result:
+ But if you tried to access our interface using a browser, you would find that `http` access does not automatically upgrade to `https` access like most websites. In other words, under our current settings, `http(80)` and `https(443)` are completely independent. To solve this problem, some modifications are needed.
-```
-sch_fq
-```
+2. Edit the Nginx configuration file.
-## 7.8 Server Optimization 2: Enable HTTP to automatically redirect to HTTPS
+ ```shell
+ sudo nano /etc/nginx/nginx.conf
+ ```
-1. We have previously built an `http` webpage on port `80` and applied for a TLS certificate.
+3. Add the following statement to the Server block listening on port 80 that we set up, then save and exit (you can also delete the `root` and `index` lines):
-But if you try to access our interface with a browser, you will find that `http` access will not automatically upgrade to `https` access like most websites. In other words, under our current settings, `http(80)` and `https(443)` are completely independent. If you want to solve this problem, you need to make some changes.
+ ```
+ return 301 https://$http_host$request_uri;
+ ```
-2. Edit the Nginx configuration file
+4. Add a local port listener at the same level as port `80` to provide webpage display. This article uses port `8080` for demonstration. (It can be any port).
-```shell
-sudo nano /etc/nginx/nginx.conf
-```
+ ```
+ server {
+ listen 127.0.0.1:8080;
+ root /home/vpsadmin/www/webpage;
+ index index.html;
+ add_header Strict-Transport-Security "max-age=63072000" always;
+ }
+ ```
-3. Add the following statement to the 80 port server we set, save and exit (you can delete the `root` and `index` lines at the same time)
+5. Restart the Nginx service.
-```
-return 301 https://$http_host$request_uri;
-```
+ ```shell
+ sudo systemctl restart nginx
+ ```
-4. Add a local port listener at the same level as the `80` port to provide web page display. This article uses the `8080` port for demonstration. (Can be any port)
+6. Modify the Xray fallback setting, changing the fallback from port `80` to port `8080`. (Find `"dest": 80` and change it to `"dest": 8080`).
-```
-server {
-listen 127.0.0.1:8080;
-root /home/vpsadmin/www/webpage;
-index index.html;
-add_header Strict-Transport-Security "max-age=63072000" always;
-}
-```
+ ```shell
+ sudo nano /usr/local/etc/xray/config.json
+ ```
-5. Restart Nginx service
+7. Restart the `Xray` service to complete the setup.
-```shell
-sudo systemctl restart nginx
-```
+ ```shell
+ sudo systemctl restart xray
+ ```
-6. Modify the fallback settings of Xray, changing the fallback from `80` port to `8080` port. (Find `"dest": 80`, and change it to `"dest": 8080`)
+8. The complete process demonstration is as follows:
-```shell
-sudo nano /usr/local/etc/xray/config.json
-```
+ 
-7. Restart the `Xray` service to complete the configuration
+9. When you enter `http://a-name.yourdomain.com`, it should now automatically redirect to https.
-```shell
-sudo systemctl restart xray
-```
+ 
-8. The complete process is demonstrated as follows:
+## 7.9 Server Optimization 3: Richer Fallbacks
-
+If you need richer fallback functionality, you can refer to [《Fallbacks (fallbacks) Feature Analysis》](../level-1/fallbacks-lv1.md)
-9. When you enter `http://a-name.yourdomain.com`, it should automatically jump to https
+## 7.10 Your Progress
-
-
-## 7.9 Server Optimization 3: More Fallbacks
-
-If you need more fallback functions, please refer to [《Fallbacks (fallbacks) Functional Analysis》](../level-1/fallbacks-lv1.md)
-
-## 7.10 Your progress
-
-Congratulations!! At this point, you already have a server that can access the Internet normally and scientifically, and also have a disguised website that can prevent active detection attacks. Next, just install the appropriate software on your client and you can enjoy a smooth network!
+Congratulations!! At this step, you already possess a server capable of proper scientific internet access (censorship circumvention), and also a camouflage website that prevents active probing attacks. Next, just install the appropriate software on your client, and you can enjoy a smooth network!
> ⬛⬛⬛⬛⬛⬛⬛⬜ 87.5%
-## 7.11 Important errata
+## 7.11 Important Errata
-1. The folder location of the `Xray` configuration file `config.json` in the first version is wrong. If you have already operated according to the previous location, `Xray` will not start correctly. Therefore, the errata is explained here, please check it yourself, and I am very sorry for the inconvenience!
+1. In the first edition, the `Xray` configuration file `config.json` folder location was incorrect. If you operated according to the previous location, `Xray` would not start correctly. Therefore, the correction is explained here. Please check yourself. Sorry for the inconvenience!
-- Correct location: `/usr/local/etc/xray/config.json`
-- Wrong location: `/usr/local/etc/config.json`
+ - Correct location: `/usr/local/etc/xray/config.json`
+ - Incorrect location: `/usr/local/etc/config.json`
-Affected sections:
+ Affected sections:
+ - 7.4 Configuring `Xray` - 3. Use `nano` to create the `Xray` configuration file
+ - 7.8 Server Optimization 2 - 6. Modify `Xray`'s fallback settings
-- 7.4 Configure `Xray` - 3. Use `nano` to create `Xray` configuration file
-- 7.8 Server Optimization 2 - 6. Modify `Xray` fallback settings
+2. In the first edition, when modifying the `Nginx` configuration file `nginx.conf`, the content was incorrect (webpage folder location error). If you operated according to the previous location, `Nginx` would not find the correct website. Please check yourself. Sorry for the inconvenience!
-2. In the first version, the content of the `Nginx` configuration file `nginx.conf` was modified incorrectly (the webpage folder location was incorrect). If you have already performed the operation according to the previous location, `Nginx` will not be able to find the correct website. Please check it yourself. Sorry for the inconvenience!
+ - Correct folder location: `root /home/vpsadmin/www/webpage;`
+ - Incorrect folder location: `root /var/www/website/html`
-- Correct folder location: `root /home/vpsadmin/www/webpage;`
-- Wrong folder location: `root /var/www/website/html`
-
-Affected sections:
-
-- 7.8 Server Optimization 2 - 4. Add a local port listener at the same level as the `80` port to provide web page display
+ Affected sections:
+ - 7.8 Server Optimization 2 - 4. Add a local port listener at the same level as port `80` to provide webpage display
diff --git a/docs/en/document/level-0/ch08-xray-clients.md b/docs/en/document/level-0/ch08-xray-clients.md
index 01372c18..a328f3f0 100644
--- a/docs/en/document/level-0/ch08-xray-clients.md
+++ b/docs/en/document/level-0/ch08-xray-clients.md
@@ -1,220 +1,218 @@
-# 【第 8 章】Xray 客户端篇
+# 【Chapter 8】 Xray Clients
-## 8.1 Xray 的工作原理简述
+## 8.1 Brief Description of Xray's Working Principles
-要正确的配置和使用`Xray`,就需要正确的理解其工作原理,对于新人,可以先看看下面简化的示意图(省略了许多复杂的设置):
+To configure and use `Xray` correctly, you need to properly understand how it works. For newcomers, you can first take a look at the simplified diagram below (many complex settings have been omitted):
-
+
-这其中的关键点是:
+The key points are:
-1. APP 要主动或借助转发工具,将数据【流入(`inbounds`)】`Xray` 客户端
+1. Apps must, either actively or via a forwarding tool, send data so it **[flows in (`inbounds`)]** to the `Xray` client.
-2. 流量进入客户端后,会被【客户端路由(`routing`)】按规则处理后,向不同方向【流出`(outbounds)`】`Xray` 客户端。比如:
- 1. 国内流量直连(`direct`)
- 2. 国外流量转发 VPS(`proxy`)
- 3. 广告流量屏蔽(`block`)
+2. After traffic enters the client, it is processed by the **[Client Routing (`routing`)]** according to rules, and then sent to **[flow out (`outbounds`)]** of the `Xray` client in different directions. For example:
+ 1. Domestic traffic connects directly (`direct`).
+ 2. Foreign traffic is forwarded to the VPS (`proxy`).
+ 3. Ad traffic is blocked (`block`).
-3. 向 VPS 转发的国外流量,会跨过防火墙,【流入(`inbounds`)】 `Xray` 服务器端
+3. Foreign traffic forwarded to the VPS will cross the firewall and **[flow in (`inbounds`)]** to the `Xray` server-side.
-4. 流量进入服务器端后,与客户端一样,会被【服务器端路由(`routing`)】按规则处理后,向不同方向【流出`(outbounds)`】:
- 1. 因为已经在防火墙之外,所以流量默认直连,你就可以访问到不存在网站们了(`direct`)
- 2. 如果需要在不同的 VPS 之间做链式转发,就可以继续配置转发规则(`proxy`)
- 3. 你可以在服务器端继续禁用各种你想禁用的流量,如广告、BT 下载等(`block`)
+4. After traffic enters the server-side, just like on the client, it is processed by the **[Server Routing (`routing`)]** according to rules, and then sent to **[flow out (`outbounds`)]** in different directions:
+ 1. Since it is already outside the firewall, traffic connects directly by default, allowing you to access those "non-existent" websites (`direct`).
+ 2. If you need to perform chained forwarding between different VPSs, you can continue to configure forwarding rules (`proxy`).
+ 3. You can continue to disable various traffic you want to ban on the server side, such as ads, BitTorrent downloads, etc. (`block`).
-:::warning 注意
+:::warning Note
-请务必记得,`Xray` 的路由配置非常灵活,上面的说明只是无限可能性中的一种。
+Please remember that `Xray`'s routing configuration is extremely flexible. The explanation above is just one of infinite possibilities.
-借助 `geosite.dat` 和 `geoip.dat` 这两个文件,可以很灵活的从【域名】和【IP】这两个角度、不留死角的控制流量流出的方向。这比曾经单一笼统的 `GFWList` 强大很多很多,可以做到非常细致的微调:比如可以指定 Apple 域名直连或转发、指定亚马逊域名代理或转发,百度的域名屏蔽等等。。。)
+With the help of the `geosite.dat` and `geoip.dat` files, you can flexibly control the direction of traffic outflow from the perspectives of [Domain Name] and [IP], leaving no blind spots. This is much, much more powerful than the old, singular, and generalized `GFWList`, allowing for very fine-grained tuning: for example, you can specify Apple domains to connect directly or be forwarded, Amazon domains to be proxied or forwarded, Baidu domains to be blocked, etc...
-现在,[《路由 (routing) 功能简析》](../level-1/routing-lv1-part1.md) 已经上线,我建议对路由功能有兴趣的同学,先继续跟着本文完成客户端的基础配置,之后再去这里详细学习。
+Now, [《Analysis of the Routing Feature》](../level-1/routing-lv1-part1.md) is online. I suggest that students interested in routing functions continue to follow this article to complete the basic client configuration first, and then go there for detailed learning.
:::
-## 8.2 客户端与服务器端正确连接
+## 8.2 Connecting Client and Server Correctly
-现在你已经理解了 `Xray` 的工作原理,那么接下来的配置,其实就是【告诉你的客户端如何连接 VPS 服务器】。这和你已经很熟悉的、告诉`PuTTY`如何远程连接服务器是一样的。只不过 Xray 连接时的要素不止是【IP 地址】+【端口】+【用户名】+【密码】这四要素了。
+Now that you understand how `Xray` works, the next configuration step is simply **[telling your client how to connect to the VPS server]**. This is exactly the same as what you are already familiar with: telling `PuTTY` how to remotely connect to a server. The only difference is that the connection elements for Xray are more than just the four elements of [IP Address] + [Port] + [Username] + [Password].
-实际上,`Xray`的连接要素是由不同的[协议](../../config/inbounds/)决定的。本文在第 7 章的配置文件 `config.json` 里,我们使用 `Xray` 下独特而强大的 `VLESS` 协议 + `XTLS` 流控。所以看看那个配置文件的内容就能知道,这个协议组合的连接要素有:
+In fact, `Xray`'s connection elements are determined by different [protocols](../../config/inbounds/). In the `config.json` configuration file in Chapter 7, we used the unique and powerful `VLESS` protocol + `XTLS` flow control found in `Xray`. So, looking at the content of that configuration file, we know the connection elements for this protocol combination are:
-- 服务器【地址】: `a-name.yourdomain.com`
-- 服务器【端口】: `443`
-- 连接的【协议】: `vless`
-- 连接的【流控】: `xtls-rprx-vision` (vision 模式适合全平台)
-- 连接的【验证】: `uuiduuid-uuid-uuid-uuiduuiduuid`
-- 连接的【安全】: `"allowInsecure": false`
+- Server [Address]: `a-name.yourdomain.com`
+- Server [Port]: `443`
+- Connection [Protocol]: `vless`
+- Connection [Flow]: `xtls-rprx-vision` (vision mode is suitable for all platforms)
+- Connection [Authentication]: `uuiduuid-uuid-uuid-uuiduuiduuid`
+- Connection [Security]: `"allowInsecure": false`
-鉴于新人一般都会使用手机 APP 或者电脑的 GUI 客户端,我就把常用的客户端罗列在下面。每个客户端都有自己独特的配置界面,逐一截图展示并不现实,所以请你务必仔细阅读这些客户端的说明、然后把上述要素填入合适的地方即可。
+Given that newcomers generally use mobile apps or GUI clients on computers, I have listed common clients below. Each client has its own unique configuration interface, and it is not realistic to take screenshots of each one. Therefore, please be sure to read the instructions for these clients carefully, and then fill in the above elements in the appropriate places.
-:::warning 注意
-许多工具其实是同时支持 `xray-core` 和 `v2fly-core` 的,但默认内置的不一定是哪个,所以别忘记检查一下是否是你想要的那个在工作哦!
+:::warning Note
+Many tools actually support both `xray-core` and `v2fly-core` simultaneously, but the default built-in core may vary. Don't forget to check if the one you want is the one working!
:::
-- **v2rayN - 适用于 Windows 平台**
- - 请从它的[GitHub 仓库 Release 页面](https://github.com/2dust/v2rayN/releases)获取最新版
- - 请根据该客户端的说明进行设置
+- **v2rayN - Suitable for Windows Platform**
+ - Please get the latest version from its [GitHub Repository Release Page](https://github.com/2dust/v2rayN/releases)
+ - Please configure according to the client's instructions
-- **v2rayNG - 适用于 Android 平台**
- - 请从它的[GitHub 仓库 Release 页面](https://github.com/2dust/v2rayNG/releases)获取最新版
- - 请根据该客户端的说明进行设置
+- **v2rayNG - Suitable for Android Platform**
+ - Please get the latest version from its [GitHub Repository Release Page](https://github.com/2dust/v2rayNG/releases)
+ - Please configure according to the client's instructions
-- **Shadowrocket - 适用于 iOS, 基于苹果 M 芯片的 macOS**
- - 你需要注册一个【非中国区】的 iCloud 账户
- - 你需要通过 App Store 搜索并购买
- - 请根据该客户端的说明进行设置
+- **Shadowrocket - Suitable for iOS, and macOS with Apple M chips**
+ - You need to register a [Non-Mainland China] iCloud account
+ - You need to search for and purchase it in the App Store
+ - Please configure according to the client's instructions
-- **Qv2ray - 跨平台图形界面,适用于 Linux, Windows, macOS**
- - 请从它的[GitHub 仓库 Release 页面](https://github.com/Qv2ray/Qv2ray/releases)获取最新版(还可以从它的[GitHub 自动构建仓库](https://github.com/Qv2ray/Qv2ray/actions)寻找更新的版本)
- - 请从它的[项目主页](https://qv2ray.net/)学习文档
- - 请根据该客户端的说明进行设置
+- **Qv2ray - Cross-platform GUI, suitable for Linux, Windows, macOS**
+ - Please get the latest version from its [GitHub Repository Release Page](https://github.com/Qv2ray/Qv2ray/releases) (You can also find newer versions from its [GitHub Actions builds](https://github.com/Qv2ray/Qv2ray/actions))
+ - Please study the documentation from its [Project Homepage](https://qv2ray.net/)
+ - Please configure according to the client's instructions
-- **V2RayXS - 基于 V2RayX 开发的一款使用 xray-core 的 macOS 客户端**
- - 请从它的 [GitHub 仓库 Release 页面](https://github.com/tzmax/v2rayXS/releases) 获取最新版
- - 支持一键导入 [VMessAEAD / VLESS 分享链接标准提案](https://github.com/XTLS/Xray-core/issues/91) 为标准的分享链接
- - 请根据该客户端的说明进行设置
+- **V2RayXS - A macOS client using xray-core, based on V2RayX**
+ - Please get the latest version from its [GitHub Repository Release Page](https://github.com/tzmax/v2rayXS/releases)
+ - Supports one-click import of [VMessAEAD / VLESS Share Link Standard Proposal](https://github.com/XTLS/Xray-core/issues/91) as standard share links
+ - Please configure according to the client's instructions
-到这一步,你的全套配置就已经可以正常使用啦!
+At this step, your full set of configurations is ready for normal use!
-## 8.3 附加题 1:在 PC 端手工配置 `xray-core`
+## 8.3 Bonus Task 1: Manually Configuring `xray-core` on PC
-虽然到上面一步已经可以结束了,但是如果你是个好奇心强、记忆力好的的同学,一定会想起来我在上一章说过,你把`xray-core` 的二进制文件“放在服务器运行,它就是服务器端;你把它下载到本地电脑运行,它就是客户端。” 那究竟要怎样直接使用 `xray-core` 做客户端呢?
+Although you could stop at the previous step, if you are a student with strong curiosity and a good memory, you will definitely recall that I said in the previous chapter: "Put the `xray-core` binary on the server and run it, and it is the server-side; download it to your local computer and run it, and it is the client." So, how exactly do you use `xray-core` directly as a client?
-为了回答这个问题,我加入了附加题章节,有一点点超纲,有一点点麻烦,但费这个笔墨是因为这个方式有它的优势:
+To answer this question, I added this bonus chapter. It's a bit beyond the syllabus and a bit troublesome, but I spent the ink on this because this method has its advantages:
-- 第一时间获得最新版而无需等待 APP 升级适配
+- Get the latest version immediately without waiting for APP updates and adaptations.
+- Flexible and free routing configuration capabilities (Of course, the advanced routing editor in the GUI client Qv2ray is also very powerful and can fully implement xray-core's routing configuration functions).
+- Save system resources (GUI interfaces will inevitably consume resources; the amount depends on the client's implementation).
-- 灵活自由的路由配置能力(当然 GUI 客户端中 Qv2ray 的高级路由编辑器非常强大,也可以完整实现 xray-core 的路由配置功能)
+Its disadvantage is probably that [hand-writing configuration files] is a bit troublesome. But actually, think about it, you have already successfully written it once on the server, so what is the difference now? Next, as usual, let's break down the steps:
-- 节约系统资源 (GUI 界面一定会有资源消耗,消耗的多少则取决于客户端的实现)
-
-它的劣势应该就是【需要手写配置文件】有点麻烦了。但其实,你想想,服务器上你已经成功的写过一次了,现在又有什么区别呢?接下来,还是老样子,我们分解一下步骤:
-
-1. 首先请从 Xray 官方的 [GitHub 仓库 Release 页面](https://github.com/XTLS/Xray-core/releases) 获取对应平台的版本,并解压缩到合适的文件夹
-2. 在合适的文件夹建立空白配置文件:`config.json` (自己常用平台下新建文件大家肯定都会,这就真不用啰嗦了)
-3. 至于什么是“合适的文件夹”?这就取决于具体的平台了~
-4. 填写客户端配置
- - 我就以 `8.1` 原理说明里展示的基本三类分流(国内流量直连、国际流量转发 VPS、广告流量屏蔽),结合 `8.2` 的连接要素,写成一个配置文件
- - 请将 `uuid` 替换成与你服务器一致的 `uuid`
- - 请将 `address` 替换成你的真实域名
- - 请将 `serverName` 替换成你的真实域名
- - 各个配置模块的说明我都已经(很啰嗦的)放在对应的配置点上了
+1. First, please get the version for your platform from the official Xray [GitHub Repository Release Page](https://github.com/XTLS/Xray-core/releases) and unzip it to a suitable folder.
+2. Create a blank configuration file in that folder: `config.json`. (I surely don't need to nag about how to create a new file on your OS).
+3. As for what constitutes a "suitable folder"? That depends on the specific platform~
+4. Fill in the client configuration.
+ - I will use the three basic categories of traffic splitting demonstrated in the `8.1` principle explanation (Domestic traffic direct, International traffic forwarded to VPS, Ad traffic blocked), combined with the connection elements from `8.2`, to write a configuration file.
+ - Please replace `uuid` with the `uuid` consistent with your server.
+ - Please replace `address` with your real domain name.
+ - Please replace `serverName` with your real domain name.
+ - Explanations for each configuration module have been (very verbosely) placed on the corresponding configuration points.
```json
// REFERENCE:
// https://github.com/XTLS/Xray-examples
// https://xtls.github.io/config/
- // 常用的config文件,不论服务器端还是客户端,都有5个部分。外加小小白解读:
- // ┌─ 1_log 日志设置 - 日志写什么,写哪里(出错时有据可查)
- // ├─ 2_dns DNS-设置 - DNS怎么查(防DNS污染、防偷窥、避免国内外站匹配到国外服务器等)
- // ├─ 3_routing 分流设置 - 流量怎么分类处理(是否过滤广告、是否国内外分流)
- // ├─ 4_inbounds 入站设置 - 什么流量可以流入Xray
- // └─ 5_outbounds 出站设置 - 流出Xray的流量往哪里去
+ // A common config file, whether for server or client, has 5 parts. plus Newbie interpretation:
+ // ┌─ 1_log Log Settings - What to write, where to write (evidence for troubleshooting)
+ // ├─ 2_dns DNS Settings - How to query DNS (prevent DNS pollution, prevent snooping, avoid matching domestic/foreign sites to foreign servers, etc.)
+ // ├─ 3_routing Routing Settings - How to classify and process traffic (filter ads? split domestic/foreign traffic?)
+ // ├─ 4_inbounds Inbound Settings - What traffic can flow into Xray
+ // └─ 5_outbounds Outbound Settings - Where the traffic flowing out of Xray goes
{
- // 1_日志设置
- // 注意,本例中我默认注释掉了日志文件,因为windows, macOS, Linux 需要写不同的路径,请自行配置
+ // 1_Log Settings
+ // Note: In this example, I commented out the log file by default because windows, macOS, and Linux require different paths. Please configure it yourself.
"log": {
- // "access": "/home/local/xray_log/access.log", // 访问记录
- // "error": "/home/local/xray_log/error.log", // 错误记录
- "loglevel": "warning" // 内容从少到多: "none", "error", "warning", "info", "debug"
+ // "access": "/home/local/xray_log/access.log", // Access record
+ // "error": "/home/local/xray_log/error.log", // Error record
+ "loglevel": "warning" // Content from least to most: "none", "error", "warning", "info", "debug"
},
- // 2_DNS设置
+ // 2_DNS Settings
"dns": {
"servers": [
- // 2.1 国外域名使用国外DNS查询
+ // 2.1 Foreign domains use foreign DNS queries
{
"address": "1.1.1.1",
"domains": ["geosite:geolocation-!cn"]
},
- // 2.2 国内域名使用国内DNS查询,并期待返回国内的IP,若不是国内IP则舍弃,用下一个查询
+ // 2.2 Domestic domains use domestic DNS queries, expecting a domestic IP return. If not a domestic IP, discard and use the next query.
{
"address": "223.5.5.5",
"domains": ["geosite:cn"],
"expectIPs": ["geoip:cn"]
},
- // 2.3 作为2.2的备份,对国内网站进行二次查询
+ // 2.3 As a backup for 2.2, perform a secondary query for domestic websites
{
"address": "114.114.114.114",
"domains": ["geosite:cn"]
},
- // 2.4 最后的备份,上面全部失败时,用本机DNS查询
+ // 2.4 Final backup: if all above fail, use local machine DNS
"localhost"
]
},
- // 3_分流设置
- // 所谓分流,就是将符合否个条件的流量,用指定`tag`的出站协议去处理(对应配置的5.x内容)
+ // 3_Routing Settings
+ // Traffic splitting means traffic meeting certain conditions is processed by the outbound protocol with a specific `tag` (corresponding to content in 5.x)
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
- // 3.1 广告域名屏蔽
+ // 3.1 Ad domain blocking
{
"domain": ["geosite:category-ads-all"],
"outboundTag": "block"
},
- // 3.2 国内域名直连
+ // 3.2 Domestic domains direct connection
{
"domain": ["geosite:cn"],
"outboundTag": "direct"
},
- // 3.3 国外域名代理
+ // 3.3 Foreign domains proxy
{
"domain": ["geosite:geolocation-!cn"],
"outboundTag": "proxy"
},
- // 3.4 走国内"223.5.5.5"的DNS查询流量分流走direct出站
+ // 3.4 Traffic for domestic DNS query "223.5.5.5" is split to go through direct outbound
{
"ip": ["223.5.5.5"],
"outboundTag": "direct"
},
- // 3.5 国内IP直连
+ // 3.5 Domestic IPs direct connection
{
"ip": ["geoip:cn", "geoip:private"],
"outboundTag": "direct"
}
- // 3.6 默认规则
- // 在Xray中,任何不符合上述路由规则的流量,都会默认使用【第一个outbound(5.1)】的设置,所以一定要把转发VPS的outbound放第一个
+ // 3.6 Default Rule
+ // In Xray, any traffic that does not match the above routing rules will default to using the setting of the [First Outbound (5.1)]. So be sure to put the VPS forwarding outbound first.
]
},
- // 4_入站设置
+ // 4_Inbound Settings
"inbounds": [
- // 4.1 一般都默认使用socks5协议作本地转发
+ // 4.1 Generally, socks5 protocol is used by default for local forwarding
{
"tag": "socks-in",
"protocol": "socks",
- "listen": "127.0.0.1", // 这个是通过socks5协议做本地转发的地址
- "port": 10800, // 这个是通过socks5协议做本地转发的端口
+ "listen": "127.0.0.1", // This is the address for local forwarding via socks5
+ "port": 10800, // This is the port for local forwarding via socks5
"settings": {
"udp": true
}
},
- // 4.2 有少数APP不兼容socks协议,需要用http协议做转发,则可以用下面的端口
+ // 4.2 A few APPs are incompatible with socks protocol and need http protocol for forwarding, use the port below
{
"tag": "http-in",
"protocol": "http",
- "listen": "127.0.0.1", // 这个是通过http协议做本地转发的地址
- "port": 10801 // 这个是通过http协议做本地转发的端口
+ "listen": "127.0.0.1", // This is the address for local forwarding via http
+ "port": 10801 // This is the port for local forwarding via http
}
],
- // 5_出站设置
+ // 5_Outbound Settings
"outbounds": [
- // 5.1 默认转发VPS
- // 一定放在第一个,在routing 3.6 里面已经说明了,这等于是默认规则,所有不符合任何规则的流量都走这个
+ // 5.1 Default forwarding to VPS
+ // Must be placed first. As explained in routing 3.6, this acts as the default rule; all unmatched traffic goes here.
{
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
- "address": "a-name.yourdomain.com", // 替换成你的真实域名
+ "address": "a-name.yourdomain.com", // Replace with your real domain
"port": 443,
"users": [
{
- "id": "uuiduuid-uuid-uuid-uuid-uuiduuiduuid", // 和服务器端的一致
+ "id": "uuiduuid-uuid-uuid-uuid-uuiduuiduuid", // Consistent with server-side
"flow": "xtls-rprx-vision",
"encryption": "none",
"level": 0
@@ -227,18 +225,18 @@
"network": "tcp",
"security": "tls",
"tlsSettings": {
- "serverName": "a-name.yourdomain.com", // 替换成你的真实域名
- "allowInsecure": false, // 禁止不安全证书
- "fingerprint": "chrome" // 通过 uTLS 库 模拟 Chrome / Firefox / Safari 或随机生成的指纹
+ "serverName": "a-name.yourdomain.com", // Replace with your real domain
+ "allowInsecure": false, // Disallow insecure certificates
+ "fingerprint": "chrome" // Use uTLS library to simulate Chrome / Firefox / Safari or randomized fingerprint
}
}
},
- // 5.2 用`freedom`协议直连出站,即当routing中指定'direct'流出时,调用这个协议做处理
+ // 5.2 Direct outbound using `freedom` protocol. Called when routing specifies 'direct'.
{
"tag": "direct",
"protocol": "freedom"
},
- // 5.3 用`blackhole`协议屏蔽流量,即当routing中指定'block'时,调用这个协议做处理
+ // 5.3 Block traffic using `blackhole` protocol. Called when routing specifies 'block'.
{
"tag": "block",
"protocol": "blackhole"
@@ -247,76 +245,76 @@
}
```
-## 8.4 附加题 2:在 PC 端手工运行 `xray-core`
+## 8.4 Bonus Task 2: Manually Running `xray-core` on PC
-写好了配置文件该,要怎么让 `xray-core` 运行起来呢?双击好像并没有反应啊?
+After writing the configuration file, how do you make `xray-core` run? Double-clicking seems to have no reaction?
-首先,你要找到电脑上的【命令行界面】。
+First, you need to find the [Command Line Interface] on your computer.
-1. Linux 桌面、macOS 系统的同学肯定已经比较熟悉了,搜索 `Console` 或者 `Terminal` 就可以
-2. Windows 就可以搜索使用 `Cmd` 或者 `Powershell` 等程序(WSL 的同学你坐下,你的 `Console` 当然也可以)
+1. Linux desktop and macOS users are certainly familiar with this; just search for `Console` or `Terminal`.
+2. Windows users can search for and use `Cmd` or `Powershell` programs (WSL users, sit down, your `Console` works too, of course).
-其次,我们要做的事情是【让 `xray` 找到并读取配置文件 `config.json`,然后运行】,所以:
+Secondly, what we need to do is [make `xray` find and read the configuration file `config.json`, and then run]. So:
-1. 在 Windows 下,假设你的 `Xray` 程序位置是 `C:\Xray-windows-64\xray.exe`,配置文件位置是`C:\Xray-windows-64\config.json`,那么正确的启动命令就是:
+1. On Windows, assuming your `Xray` program location is `C:\Xray-windows-64\xray.exe` and the configuration file location is `C:\Xray-windows-64\config.json`, the correct startup command is:
- ```shell
- C:\Xray-windows-64\xray.exe -c C:\Xray-windows-64\config.json
- ```
+ ```shell
+ C:\Xray-windows-64\xray.exe -c C:\Xray-windows-64\config.json
+ ```
- :::tip 说明
- 这里的 `-c` 就是指定配置文件路径的参数,告诉 `xray` 去后面的位置找配置文件
- :::
+ :::tip Explanation
+ The `-c` here is the parameter to specify the configuration file path, telling `xray` to look for the configuration file at the location following it.
+ :::
-2. 相似的,在 Linux 和 macOS 下,假设你的 `Xray` 程序位置是 `/usr/local/bin/xray`,配置文件位置是`/usr/local/etc/xray/config.json`,那么正确的启动命令就是
+2. Similarly, on Linux and macOS, assuming your `Xray` program location is `/usr/local/bin/xray` and the configuration file location is `/usr/local/etc/xray/config.json`, the correct startup command is:
- ```shell
- /usr/local/bin/xray -c /usr/local/etc/xray/config.json
- ```
+ ```shell
+ /usr/local/bin/xray -c /usr/local/etc/xray/config.json
+ ```
- :::tip 说明
- 每个系统都有系统路径变量,所以写 `Xray` 程序时不一定要写绝对路径。但是写了肯定没错,所以我就如此演示了。
- :::
+ :::tip Explanation
+ Every system has system path variables, so you don't necessarily have to write the absolute path when typing the `Xray` program. But writing it is definitely not wrong, so I demonstrated it that way.
+ :::
-## 8.5 附加题 3:在 PC 端开机自动运行 `xray-core`
+## 8.5 Bonus Task 3: Auto-start `xray-core` on PC Boot
-如果你真的尝试了手动运行 `xray-core`,你一定会发现这个方式还有点小问题:
+If you really tried running `xray-core` manually, you must have found a small problem with this method:
-1. 每次运行 `Xray` 都要出现一个黑乎乎的窗口,很丑
-2. 不能开机自动运行,每次都要手工输入,十分不方便
+1. Every time `Xray` runs, a dark window appears, which is ugly.
+2. It cannot run automatically at startup; manually typing it every time is very inconvenient.
-我可以肯定的告诉你:**完全可以解决**。但是具体的解决方式,就当作课外作业留给大家吧!(友情提示,文档站的问答区有线索哦)
+I can tell you with certainty: **It is completely solvable**. But as for the specific solution, let's leave it as homework for everyone! (Friendly hint: there are clues in the Q&A section of the documentation site).
-## 8.6 圆满完成!
+## 8.6 Mission Accomplished
-我相信,有耐心看到这里的同学,都是兼具好奇心和行动力的学习派!我现在要郑重的恭喜你,因为到了这里,你已经完完整整的【**从第一条命令开始,完成了 VPS 服务器部署,并成功的在客户端配置使用 Xray**】了!这毫无疑问是一个巨大的胜利!
+I believe that students who have the patience to read this far are learners with both curiosity and the ability to take action! I want to solemnly congratulate you now, because by this point, you have completely **[started from the first command, completed the VPS server deployment, and successfully configured and used Xray on the client]**! This is undoubtedly a huge victory!
-我相信,你现在一定对`Linux`不再恐惧,对`Xray`不再陌生了吧!
+I believe you are no longer afraid of `Linux` and no longer unfamiliar with `Xray`!
-**至此,小小白白话文圆满结束!**
+**Here, the Absolute Beginner's Plain Guide concludes successfully!**
> ⬛⬛⬛⬛⬛⬛⬛⬛ 100%
-## 8.7 TO INFINITY AND BEYOND!
+## 8.7 TO INFINITY AND BEYOND
-**但现在你看到的,远远不是 Xray 的全貌。**
+**But what you see now is far from the full picture of Xray.**
-`Xray`是一个强大而丰富的网络工具集合,平台化的提供了众多模块,可以像瑞士军刀一样,通过灵活的配置组合解决各种不同的问题。而本文,仅仅蜻蜓点水的用了**最简单**、**最直观**的配置来做**基础演示**。
+`Xray` is a powerful and rich collection of network tools. It provides numerous modules as a platform, which can solve various problems through flexible configuration combinations like a Swiss Army knife. This article only skimmed the surface using the **simplest** and **most intuitive** configuration for a **basic demonstration**.
-如果你觉得现在已经完全够用了,那就好好的享受它给你带来的信息自由。但如果你的好奇心依然不能停歇,那就去继续挖掘它无限的可能性吧!
+If you feel that it is completely sufficient now, then enjoy the information freedom it brings you. But if your curiosity still cannot rest, then go ahead and continue to dig into its infinite possibilities!
-需要更多信息,可以到这里寻找:
+For more information, you can find it here:
-1. [xtls.github.io](https://xtls.github.io/) - 官方文档站
-2. [官方 Telegram 群组](https://t.me/projectXray) - 活跃而友善的官方讨论社区
+1. [xtls.github.io](https://xtls.github.io/) - Official Documentation Site
+2. [Official Telegram Group](https://t.me/projectXray) - Active and friendly official discussion community

-:::tip 不算后记的后记
+:::tip A Postscript that isn't really a Postscript
-希望我陪你走过的这一段小小的旅程,可以成为你网络生活中的一份小小助力。
+I hope this small journey I accompanied you on can become a small boost in your online life.
-这篇文章里的工具和信息难免会一点点的陈旧过时,但你一定会逐渐成长为大佬。未来的某个时间,若你能偶尔想起这篇教程、想起我写下本文的初衷,那我衷心希望你能够薪火相传、把最新的知识分享给后来人,让这一份小小的助力在社区里坚定的传递下去。
+The tools and information in this article will inevitably become slightly outdated, but you will surely grow into an expert. Sometime in the future, if you occasionally recall this tutorial and the original intention with which I wrote it, I sincerely hope you can pass on the torch, share the latest knowledge with newcomers, and let this small boost continue to be passed down firmly in the community.
-这是个大雪封山乌云密布的世界,人们孤独的走在各自的路上试图寻找阳光,如果大家偶尔交汇时不能守望相助互相鼓励,那最终剩下的,恐怕只有【千山鸟飞绝 万径人踪灭】的凄凉了吧。
+This is a world where heavy snow seals the mountains and dark clouds loom. People walk lonely on their respective paths trying to find sunlight. If we cannot watch out for and encourage each other when we occasionally cross paths, then ultimately, I fear only the desolation of "a thousand mountains with no birds flying, ten thousand paths with no human footprints" will remain.
:::
diff --git a/docs/en/document/level-0/ch09-appendix.md b/docs/en/document/level-0/ch09-appendix.md
index 1967239a..1b50ea5f 100644
--- a/docs/en/document/level-0/ch09-appendix.md
+++ b/docs/en/document/level-0/ch09-appendix.md
@@ -1,46 +1,46 @@
-# 【第 9 章】附录
+# [Chapter 9] Appendix
-## 1. 小小白白 Linux 基础命令索引
+## 1. Index of Basic Linux Commands for Beginners
-| 编号 | 命令名称 | 命令说明 | 出现篇章 |
-| :------: | :------------------ | :--------------------------- | :----------------------------------------: |
-| `cmd-01` | `apt update` | 查询软件更新 | [《远程登录篇》](./ch03-ssh.md) |
-| `cmd-02` | `apt upgrade` | 执行软件更新 | [《远程登录篇》](./ch03-ssh.md) |
-| `cmd-03` | `nano` | 文本编辑器 | [《安全防护篇》](./ch04-security.md) |
-| `cmd-04` | `systemctl restart` | 重启某个服务 | [《安全防护篇》](./ch04-security.md) |
-| `cmd-05` | `adduser` | 给系统新增用户 | [《安全防护篇》](./ch04-security.md) |
-| `cmd-06` | `apt install` | 安装某个软件 | [《安全防护篇》](./ch04-security.md) |
-| `cmd-07` | `visudo` | 修改 sudo 权限设置专用编辑器 | [《安全防护篇》](./ch04-security.md) |
-| `cmd-08` | `sudo` | 用`root`权限运行某个命令 | [《安全防护篇》](./ch04-security.md) |
-| `cmd-09` | `chmod` | 修改目标文件/文件夹的权限 | [《安全防护篇》](./ch04-security.md) |
-| `cmd-10` | `mkdir` | 新建文件夹 | [《网站建设篇》](./ch05-webpage.md) |
-| `cmd-11` | `systemctl reload` | 重新加载某个服务 | [《网站建设篇》](./ch05-webpage.md) |
-| `cmd-12` | `wget` | 访问(或下载)某个网页文件 | [《证书管理篇》](./ch06-certificates.md) |
-| `cmd-13` | `acme.sh` | acme.sh 证书管理相关的命令 | [《证书管理篇》](./ch06-certificates.md) |
-| `cmd-14` | `rm` | 删除命令 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `cmd-15` | `crontab -e` | 编辑当前用户的定时任务 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `cmd-16` | `touch` | 建立空白文件 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `cmd-17` | `systemctl` | `systemd`基本服务管理命令 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `cmd-18` | `reboot` | 重启 Linux 系统 | [《Xray 服务器篇》](./ch07-xray-server.md) |
+| ID | Command Name | Description | Featured Chapter |
+| :----: | :------------------ | :--------------------------- | :------------------------------------------: |
+| `cmd-01` | `apt update` | Check for software updates | [[Chapter 3: Remote Login]](./ch03-ssh.md) |
+| `cmd-02` | `apt upgrade` | Execute software updates | [[Chapter 3: Remote Login]](./ch03-ssh.md) |
+| `cmd-03` | `nano` | Text editor | [[Chapter 4: Security Protection]](./ch04-security.md) |
+| `cmd-04` | `systemctl restart` | Restart a service | [[Chapter 4: Security Protection]](./ch04-security.md) |
+| `cmd-05` | `adduser` | Add a new user to the system | [[Chapter 4: Security Protection]](./ch04-security.md) |
+| `cmd-06` | `apt install` | Install a software package | [[Chapter 4: Security Protection]](./ch04-security.md) |
+| `cmd-07` | `visudo` | Dedicated editor for sudo privileges | [[Chapter 4: Security Protection]](./ch04-security.md) |
+| `cmd-08` | `sudo` | Run a command with `root` privileges | [[Chapter 4: Security Protection]](./ch04-security.md) |
+| `cmd-09` | `chmod` | Change permissions of a file/folder | [[Chapter 4: Security Protection]](./ch04-security.md) |
+| `cmd-10` | `mkdir` | Create a new directory (folder) | [[Chapter 5: Website Building]](./ch05-webpage.md) |
+| `cmd-11` | `systemctl reload` | Reload a service | [[Chapter 5: Website Building]](./ch05-webpage.md) |
+| `cmd-12` | `wget` | Access (or download) a web file | [[Chapter 6: Certificate Management]](./ch06-certificates.md) |
+| `cmd-13` | `acme.sh` | Commands related to acme.sh certificate management | [[Chapter 6: Certificate Management]](./ch06-certificates.md) |
+| `cmd-14` | `rm` | Remove (delete) command | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `cmd-15` | `crontab -e` | Edit current user's scheduled tasks | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `cmd-16` | `touch` | Create an empty file | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `cmd-17` | `systemctl` | Basic `systemd` service management command | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `cmd-18` | `reboot` | Reboot the Linux system | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
-## 2. 小小白白 Linux 重要配置文件索引
+## 2. Index of Important Linux Configuration Files for Beginners
-| 编号 | 配置文件位置 | 文件说明 | 出现篇章 |
-| :-------: | :-------------------------------------- | :----------------------------- | :----------------------------------------: |
-| `conf-01` | `/etc/ssh/sshd_config` | SSH 远程登录程序设置 | [《远程登录篇》](./ch03-ssh.md) |
-| `conf-02` | `/etc/nginx/nginx.conf` | Nginx 程序设置 | [《网站建设篇》](./ch05-webpage.md) |
-| `conf-03` | `/etc/apt/sources.list` | apt 软件源列表 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `conf-04` | `/etc/apt/sources.list.d/vpsadmin.list` | 用户自定义软件源列表列表 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `conf-05` | `crontab -e` | 当前用户的定时任务 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `conf-06` | `/etc/sysctl.conf` | 手动设置 kernel 参数 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `conf-07` | `/etc/sysctl.d/vpsadmin.conf` | 用户自定义 kernel 参数配置文件 | [《Xray 服务器篇》](./ch07-xray-server.md) |
+| ID | Config File Location | File Description | Featured Chapter |
+| :-------: | :-------------------------------------- | :----------------------------- | :------------------------------------------: |
+| `conf-01` | `/etc/ssh/sshd_config` | SSH remote login program settings | [[Chapter 3: Remote Login]](./ch03-ssh.md) |
+| `conf-02` | `/etc/nginx/nginx.conf` | Nginx program settings | [[Chapter 5: Website Building]](./ch05-webpage.md) |
+| `conf-03` | `/etc/apt/sources.list` | apt software source list | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `conf-04` | `/etc/apt/sources.list.d/vpsadmin.list` | User-defined software source list | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `conf-05` | `crontab -e` | Current user's scheduled tasks | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `conf-06` | `/etc/sysctl.conf` | Manual kernel parameter settings | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `conf-07` | `/etc/sysctl.d/vpsadmin.conf` | User-defined kernel parameter config file | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
-## 3. 小小白白 Xray 重要文件索引
+## 3. Index of Important Xray Files for Beginners
-| 编号 | 配置文件位置 | 文件说明 | 出现篇章 |
-| :-------: | :----------------------------------- | :------------ | :----------------------------------------: |
-| `xray-01` | `/usr/local/etc/xray/config.json` | Xray 程序设置 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `xray-02` | `/home/vpsadmin/xray_cert/xray.cert` | TLS 证书 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `xray-03` | `/home/vpsadmin/xray_cert/xray.key` | TLS 私钥 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `xray-04` | `/home/vpsadmin/xray_log/access.log` | Xray 访问日志 | [《Xray 服务器篇》](./ch07-xray-server.md) |
-| `xray-05` | `/home/vpsadmin/xray_log/error.log` | Xray 错误日志 | [《Xray 服务器篇》](./ch07-xray-server.md) |
+| ID | Config File Location | File Description | Featured Chapter |
+| :-------: | :----------------------------------- | :--------------- | :------------------------------------------: |
+| `xray-01` | `/usr/local/etc/xray/config.json` | Xray program settings | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `xray-02` | `/home/vpsadmin/xray_cert/xray.cert` | TLS Certificate | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `xray-03` | `/home/vpsadmin/xray_cert/xray.key` | TLS Private Key | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `xray-04` | `/home/vpsadmin/xray_log/access.log` | Xray Access Log | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
+| `xray-05` | `/home/vpsadmin/xray_log/error.log` | Xray Error Log | [[Chapter 7: Xray Server]](./ch07-xray-server.md) |
diff --git a/docs/en/document/level-0/index.md b/docs/en/document/level-0/index.md
index a18856c2..a5a6c2d0 100644
--- a/docs/en/document/level-0/index.md
+++ b/docs/en/document/level-0/index.md
@@ -1,25 +1,25 @@
-# Plain and Simple Language
+# Absolute Beginner's Plain Guide
-**This chapter is a basic lesson of [Starting from Scratch]. New students, please watch and learn carefully.**
+**This section is a [From Scratch] foundation course. Newcomers, please read and study carefully!**
::: tip
Made with ❤️ by [@ricuhkaen](https://github.com/ricuhkaen)
:::
-[【Chapter 1】 Preface: Rambling](./ch01-preface.md) - Airport or Self-built? That is the question.
+[[Chapter 1] Preface](./ch01-preface.md) - Commercial Provider or Self-Hosted? That Is the Question
-[Chapter 2: Preparation of Raw Materials](./ch02-preparation.md) - Tools must be sharpened before they can be used proficiently.
+[[Chapter 2] Preparation](./ch02-preparation.md) - To Do a Good Job, One Must First Sharpen One's Tools
-[Chapter 3: Remote Login](./ch03-ssh.md) - A bridge connecting the north and south, turning a natural obstacle into a thoroughfare.
+[[Chapter 3] Remote Login (SSH)](./ch03-ssh.md) - Bridging the Gap
-[【Chapter 4】Security Protection](./ch04-security.md) - If you don't pay attention to security, you will shed tears for your loved ones.
+[[Chapter 4] Security](./ch04-security.md) - Safety First, or Regret Later
-[【Chapter 5】Website Construction] - Show Your Beauty (Link to webpage.md file)
+[[Chapter 5] Website Setup](./ch05-webpage.md) - Show Your Style
-[Chapter 6: Certificate Management](./ch06-certificates.md) - Only those who obtain certificates are considered legitimate.
+[[Chapter 6] Certificates](./ch06-certificates.md) - It's Only Legal with a License
-[Chapter 7: Xray Server](./ch07-xray-server.md) - Finally, waited for you.
+[[Chapter 7] Xray Server](./ch07-xray-server.md) - The Moment You've Been Waiting For
-[Chapter 8: Xray Client](./ch08-xray-clients.md) - A New Beginning.
+[[Chapter 8] Xray Clients](./ch08-xray-clients.md) - A New Beginning
-[Chapter 9] Appendix - All the exam points are here.
+[[Chapter 9] Appendix](./ch09-appendix.md) - Key Takeaways Are Here
diff --git a/docs/en/document/level-1/fallbacks-lv1.md b/docs/en/document/level-1/fallbacks-lv1.md
index e71b6573..d7fd67ec 100644
--- a/docs/en/document/level-1/fallbacks-lv1.md
+++ b/docs/en/document/level-1/fallbacks-lv1.md
@@ -1,10 +1,10 @@
-# 回落 (fallbacks) 功能简析
+# A Brief Analysis of Fallbacks
-在使用 Xray 的过程中,你一定无数次的听说了【回落】这个功能。本文就稍微说明一下这个功能的逻辑以及使用方式。
+In the process of using Xray, you must have heard about the **[Fallback]** function countless times. This article will briefly explain the logic and usage of this function.
-## 1. 回顾《小小白白话文》中的回落
+## 1. Reviewing Fallbacks in the "Beginner's Guide"
-如果你用了《小小白白话文》中的[Xray 配置](../level-0/ch07-xray-server.md#_7-4-配置xray),并完成了[HTTP 自动跳转 HTTPS 优化](../level-0/ch07-xray-server.md#_7-8-服务器优化之二-开启http自动跳转https),那么你已经有了基于 `VLESS` 协议的简易回落:
+If you used the [Xray Configuration](../level-0/ch07-xray-server.md#_7-4-configuration-xray) from the *Beginner's Guide* and completed the [HTTP to HTTPS Redirection Optimization](../level-0/ch07-xray-server.md#_7-8-server-optimization-part-2-enable-http-automatic-jump-to-https), then you already have a simple fallback based on the `VLESS` protocol:
```json
{
@@ -19,7 +19,7 @@
"decryption": "none",
"fallbacks": [
{
- "dest": 8080 // 默认回落到防探测的代理
+ "dest": 8080 // Default fallback to the probe-resistant proxy/service
}
]
},
@@ -31,109 +31,109 @@
}
```
-这一段配置用人话要怎么解释呢?
+How do we explain this configuration in plain language?
-1. **`Xray` 的入站端口 `[inbound port]` 是 `443`**
+1. **Xray's `[inbound port]` is `443`**
- 即由 `Xray` 负责监听 `443` 端口的 `HTTPS` 流量
+ This means `Xray` is responsible for listening to `HTTPS` traffic on port `443`.
-2. **`Xray` 的入站协议 `[inbound protocol]` 是 `vless`**
+2. **Xray's `[inbound protocol]` is `vless`**
- 只有 `vless` 协议的流量才会流入 `Xray` 中做后续处理。
+ Only traffic using the `vless` protocol will flow into `Xray` for further processing.
- ::: warning
- **注:** `VLESS` 这个轻量协议开发的初衷就是给 `xray` 及 `v2fly` 等核心引入回落功能、并同时减少冗余校验/加密。(当然,到目前为止,`xray` 中的 `trojan` 协议也已完整支持回落功能。)
- :::
+ ::: warning
+ **Note:** The `VLESS` lightweight protocol was originally developed to introduce the fallback function to cores like `xray` and `v2fly`, while reducing redundant verification/encryption. (Of course, as of now, the `trojan` protocol in `xray` also fully supports the fallback function.)
+ :::
-3. **回落目标端口 `[fallback dest]` 是 `8080`**
+3. **The `[fallback dest]` is `8080`**
- `Xray` 接受 `443` 端口的访问流量后,属于 `vless` 协议的流量、由 `Xray` 进行内部处理并转发至出站模块。而其他非 `vless` 协议的流量,则转发至 `8080` 端口。
+ After `Xray` accepts traffic on port `443`, traffic belonging to the `vless` protocol is processed internally by `Xray` and forwarded to the outbound module. Traffic that is *not* `vless` protocol is forwarded to port `8080`.
- ::: warning
- **问:到底是单数还是复数?**
+ ::: warning
+ **Q: Is it singular or plural?**
- 答:一定有聪明的同学发现,配置文件中,明明是复数 `inbounds`, `fallbacks`,为什么我解释的时候都是单数:`inbound`, `fallback` 呢?
+ A: Some sharp students may have noticed that in the configuration file, the keys are plural (`inbounds`, `fallbacks`), but when I explain them, I use the singular (`inbound`, `fallback`). Why?
- 因为,配置文件中用复数,说明 `xray` 支持 N 个同等级的元素(即 N 个入站,M 个回落等等),上面的示例解析中仅仅是其中一个,所以我用了单数。
- :::
+ Because the plural form in the configuration file indicates that `xray` supports N elements of the same level (i.e., N inbounds, M fallbacks, etc.). In the example analysis above, we are referring to just one of them, so I used the singular.
+ :::
-4. **回落给 `8080` 端口的流量,由后续程序处理**
+4. **Traffic falling back to port `8080` is handled by a subsequent program**
- 小小白白话文中的示例,就是 `8080` 端口由 `Nginx` 处理,根据配置找到并展示小熊猫的网页。
+ In the example from the *Beginner's Guide*, port `8080` is handled by `Nginx`, which finds and displays the Red Panda webpage based on its configuration.
-5. **总结,小小白白话文示例中的最简单回落,完整数据路线如下:**
+5. **Summary: The complete data route for the simplest fallback in the Beginner's Guide is as follows:**
- ```mermaid
- graph LR;
+ ```mermaid
+ graph LR;
- W(外部 HTTP:80 请求) --> N80(HTTP:80)
+ W(External HTTP:80 Request) --> N80(HTTP:80)
- subgraph Nginx 外部监听
- N80 -.- N301(301转写) -.- N443(HTTPS:443)
- end
+ subgraph Nginx External Listener
+ N80 -.- N301(301 Redirect) -.- N443(HTTPS:443)
+ end
- N443 --> X(Xray 监听 443) .- X1{入站判断}
- X1 --> |接收 VLESS 流量| X2(Xray内部规则)
- X2 --> O(Xray Outbounds 出站)
- X1 ==> |回落 非VLESS 流量| N8080(Nginx:8080)
- N8080:::nginxclass ==> H(index.html)
+ N443 --> X(Xray Listener 443) .- X1{Inbound Judgment}
+ X1 --> |Receive VLESS Traffic| X2(Xray Internal Rules)
+ X2 --> O(Xray Outbounds)
+ X1 ==> |Fallback Non-VLESS Traffic| N8080(Nginx:8080)
+ N8080:::nginxclass ==> H(index.html)
- H:::nginxclass
- classDef nginxclass fill:#FFFFDE
+ H:::nginxclass
+ classDef nginxclass fill:#FFFFDE
- ```
+ ```
-## 2. 重新认识回落 (WHAT, HOW `v1`)
+## 2. Re-understanding Fallbacks (WHAT, HOW `v1`)
-基于上面的示例,你应该就可以明白什么是回落(What)和怎么回落(How)了,简单地说就是下面这几个要素:
+Based on the example above, you should understand what a fallback is (What) and how it works (How). Simply put, it involves these elements:
-1. 回落的时间是流量进入 `Xray监听端口` 后
-2. 回落的依据是 `协议类型` 等流量特征
-3. 回落的目标是某个 `端口`
-4. 被回落的流量由监听 `回落端口` 的后续程序接手
+1. The **Time** of fallback is after traffic enters the `Xray Listening Port`.
+2. The **Basis** for fallback is traffic characteristics like `Protocol Type`.
+3. The **Target** of fallback is a specific `Port`.
+4. The traffic being fallen back is taken over by a subsequent program listening on the `Fallback Port`.
-## 3. 为什么要回落 (WHY `v1`)
+## 3. Why Use Fallbacks (WHY `v1`)
-最初,是为了防御 **【主动探测】** (Active Probing)
+Initially, it was to defend against **[Active Probing]**.
-**主动探测:** 简单粗暴的理解,就是指外部通过发送特定的网络请求,并解读服务器的回应内容,来推测服务器端是否运行了 `xray`, `v2fly`, `shadowsocks` 等代理工具。一旦可以准确认定,则服务器可能受到干扰或阻断。
+**Active Probing:** To put it simply and crudely, this refers to external parties sending specific network requests and interpreting the server's response to guess whether the server is running proxy tools like `xray`, `v2fly`, or `shadowsocks`. Once accurately identified, the server may be interfered with or blocked.
-之所以可以根据服务器回应内容进行解读,就是因为一次完整的数据请求,其实有很多数据交换的步骤,每一个步骤,都会产生一些软件特征。用大白话说就是:
+The reason interpretation is possible based on server responses is that a complete data request involves many steps of data exchange, and each step produces certain software signatures. In plain English:
-- 正常的网站的回应,一定【会有】类似 `Nginx`, `Apache`, `MySQL` 的 Web 服务、数据库等工具的特征
-- 正常的网站的回应,一定【不会有】类似 `xray`, `v2fly`, `shadowsocks` 等代理工具的特征
+- A normal website response will definitely **[HAVE]** signatures of Web services/databases like `Nginx`, `Apache`, `MySQL`, etc.
+- A normal website response will definitely **[NOT HAVE]** signatures of proxy tools like `xray`, `v2fly`, `shadowsocks`, etc.
-于是,当我们给 `Xray` 提供了【回落】功能后(如上例,回落给 `Nginx`),面对任何用来探测的请求,产生的结果是:
+Therefore, when we provide the **[Fallback]** function to `Xray` (as in the example above, falling back to `Nginx`), the result when facing any probing request is:
-- 探测流量无法掌握你的 `VLESS` 要素,故都会被回落至 `Nginx`
-- 探测流量全都回落进入 `Nginx` ,故 VPS 服务器的回应一定【会有】 `Nginx` 的特征
-- 因为 `Xray` 本身不对探测流量做任何回应 ,所以 VPS 的回应一定【不会有】 `Xray` 的特征
+- Probing traffic cannot master your `VLESS` secrets/elements, so it will all fall back to `Nginx`.
+- Since probing traffic falls back into `Nginx`, the VPS server's response will definitely **[HAVE]** `Nginx` signatures.
+- Because `Xray` itself does not respond to probing traffic, the VPS response will definitely **[NOT HAVE]** `Xray` signatures.
-至此,【回落】功能就从数据交互逻辑上解决了服务器被 **【主动探测】** 的安全隐患。
+Thus, the **[Fallback]** function solves the security risk of the server being **[Actively Probed]** from the logic of data interaction.
-## 4. 重新认识【回落の完全体】 (WHAT, WHY, HOW `v2`)
+## 4. Re-understanding the [Perfect Form of Fallback] (WHAT, WHY, HOW `v2`)
-为什么又要再次认识回落呢? 因为,上面仅仅说清楚了基于“协议”的、抵抗【主动探测】的初版回落。
+Why do we need to understand fallbacks again? Because the above only explains the initial version of fallbacks based on "protocols" for resisting [Active Probing].
-在 [RPRX](https://github.com/rprx) 不断开发迭代 `VLESS` 协议及 `fallback` 功能的过程中,逐渐发现,回落完全可以更加灵活强大,只要在保证抵抗【主动探测】的前提下,充分利用数据首包中的信息,其实可以做到多元素、多层次的回落。(如 `path`, `alpn` 等)
+During the continuous development and iteration of the `VLESS` protocol and `fallback` function by [RPRX](https://github.com/rprx), it was discovered that fallbacks could be much more flexible and powerful. As long as the premise of resisting [Active Probing] is met, by fully utilizing the information in the first data packet, multi-element and multi-level fallbacks (such as `path`, `alpn`, etc.) can be achieved.
-基于这个开发理念,【回落】功能才逐渐成长为现在的完全体,即完成了 `纯伪装 --> ws分流 --> 多协议多特征分流` 的进化。最终版甚至完全替代了以前要用 Web 服务器、其他工具才能完成的分流的功能。且由于上述的【回落/分流】处理都在首包判断阶段以毫秒级的速度完成、不涉及任何数据操作,所以几乎没有任何过程损耗。
+Based on this development philosophy, the **[Fallback]** function has gradually grown into its current "Perfect Form," completing the evolution from `Pure Camouflage --> WS Shunting --> Multi-protocol Multi-feature Shunting`. The final version has even completely replaced the shunting functions that previously required Web servers or other tools. Moreover, since the aforementioned [Fallback/Shunting] processing is completed at the first packet judgment stage with millisecond-level speed and does not involve any data manipulation, there is almost no process loss.
-**因此,现在 `Xray` 中【完整体的回落功能】,同时具备下述属性:**
+**Therefore, the [Complete Fallback Function] in `Xray` now possesses the following attributes:**
-- **安全:** 充分抵御主动探测攻击
-- **高效:** 几乎毫无性能损失
-- **灵活:** 数据灵活分流、常用端口复用(如 443)
+- **Secure:** Fully resists active probing attacks.
+- **Efficient:** Almost zero performance loss.
+- **Flexible:** Flexible data shunting, reuse of common ports (like 443).
-::: tip 啰嗦君
-这样多轮介绍虽然略显繁琐,但只有这样层层深入展开,才能充分的说明【回落の完全体】独有的强大!
+::: tip Mr. Wordy
+Although explaining it in multiple rounds seems tedious, only by peeling it back layer by layer can we fully demonstrate the unique power of the [Perfect Form of Fallback]!
:::
-## 5. 多层回落示例及解读
+## 5. Multi-layer Fallback Example and Interpretation
-理解了【回落の完全体】是什么,那就可以动手操作配置多层回落了。其实,项目已经提供了非常完整的示例,即官方模板中的 [VLESS-TCP-XTLS-WHATEVER](https://github.com/XTLS/Xray-examples/blob/main/VLESS-TCP-XTLS-WHATEVER/)。
+Now that you understand what the [Perfect Form of Fallback] is, you can get your hands dirty configuring multi-layer fallbacks.
-### 5.1 首先,我将服务器端配置的 443 监听段摘抄如下:
+### 5.1 First, I will extract the server-side configuration for port 443 as follows
```json
{
@@ -142,7 +142,7 @@
"settings": {
"clients": [
{
- "id": "", // 填写你的 UUID
+ "id": "", // Fill in your UUID
"flow": "xtls-rprx-vision",
"level": 0,
"email": "love@example.com"
@@ -151,21 +151,21 @@
"decryption": "none",
"fallbacks": [
{
- "dest": 1310, // 默认回落到 Xray 的 Trojan 协议
+ "dest": 1310, // Default fallback to Xray's Trojan protocol
"xver": 1
},
{
- "path": "/websocket", // 必须换成自定义的 PATH
+ "path": "/websocket", // Must be changed to your custom PATH
"dest": 1234,
"xver": 1
},
{
- "path": "/vmesstcp", // 必须换成自定义的 PATH
+ "path": "/vmesstcp", // Must be changed to your custom PATH
"dest": 2345,
"xver": 1
},
{
- "path": "/vmessws", // 必须换成自定义的 PATH
+ "path": "/vmessws", // Must be changed to your custom PATH
"dest": 3456,
"xver": 1
}
@@ -178,8 +178,8 @@
"alpn": ["http/1.1"],
"certificates": [
{
- "certificateFile": "/path/to/fullchain.crt", // 换成你的证书,绝对路径
- "keyFile": "/path/to/private.key" // 换成你的私钥,绝对路径
+ "certificateFile": "/path/to/fullchain.crt", // Absolute path to your certificate
+ "keyFile": "/path/to/private.key" // Absolute path to your private key
}
]
}
@@ -187,194 +187,194 @@
}
```
-这一段配置用人话要怎么解释呢?
+How do we explain this configuration in plain language?
-1. **`Xray` 的入站端口 (`inbound port`) 是 `443`**
+1. **Xray's `[inbound port]` is `443`**
- 即由 `Xray` 负责监听 `443` 端口的 `HTTPS` 流量,并使用 `certificates` 项下设定的 `TLS` 证书来进行验证
+ This means `Xray` is responsible for listening to `HTTPS` traffic on port `443` and uses the `TLS` certificate set under `certificates` for verification.
-2. **`Xray` 的入站协议 (`inbound protocol`) 是 `vless`**
+2. **Xray's `[inbound protocol]` is `vless`**
- `vless` 协议流量直接流入 `Xray` 中做后续处理
+ `vless` protocol traffic flows directly into `Xray` for subsequent processing.
-3. **非 `VLESS` 协议流量有 4 个不同的回落目标:**
- 1. `path` 为 `websocket` 的流量,回落给端口 `1234` 后续处理
- 2. `path` 为 `vmesstcp` 的流量,回落给端口 `2345` 后续处理
- 3. `path` 为 `vmessws` 的流量,回落给端口 `3456` 后续处理
- 4. 其它所有流量,回落给端口 `1310` 后续处理
+3. **Non-`VLESS` protocol traffic has 4 different fallback targets:**
+ 1. Traffic with `path` as `/websocket` falls back to port `1234` for processing.
+ 2. Traffic with `path` as `/vmesstcp` falls back to port `2345` for processing.
+ 3. Traffic with `path` as `/vmessws` falls back to port `3456` for processing.
+ 4. All other traffic falls back to port `1310` for processing.
-4. **`xver` 为 `1` 表示开启 `proxy protocol` 功能,向后传递来源真实 IP**
+4. **`xver` set to `1` means enabling the `proxy protocol` function to pass the real source IP backwards.**
-5. **上述回落结构如下图所示:**
+5. **The fallback structure described above is shown in the diagram below:**
- ```mermaid
- graph LR;
+ ```mermaid
+ graph LR;
- W443(外部 HTTP:443 请求) --> X443(Xray-inbound: 443) .- X1{入站判断}
- X1 --> |协议 = VLESS 的流量| X2(Xray内部规则)
- X2 --> O(Xray Outbounds 出站)
+ W443(External HTTP:443 Request) --> X443(Xray-inbound: 443) .- X1{Inbound Judgment}
+ X1 --> |Protocol = VLESS Traffic| X2(Xray Internal Rules)
+ X2 --> O(Xray Outbounds)
- X1 --> |path = /websocket 的流量| X1234(Xray-inbound:1234)
- X1 --> |path = /vmesstcp 的流量| X2345(Xray-inbound:2345)
- X1 --> |path = /vmessws 的流量| X3456(Xray-inbound:3456)
- X1 --> |其它所有流量| X1310(Xray-inbound:1310)
+ X1 --> |path = /websocket Traffic| X1234(Xray-inbound:1234)
+ X1 --> |path = /vmesstcp Traffic| X2345(Xray-inbound:2345)
+ X1 --> |path = /vmessws Traffic| X3456(Xray-inbound:3456)
+ X1 --> |All Other Traffic| X1310(Xray-inbound:1310)
- ```
+ ```
-6. **网页回落不见了!**
+6. **The Web Page Fallback is missing!**
- 没错,聪明的同学应该发现了,防御【主动探测】的 `nginx回落` 不见了!!!这是为什么呢?会不会不安全?别急,我们继续分析:
+ That's right, clever students must have noticed that the `nginx fallback` for defending against [Active Probing] is gone!!! Why is that? Is it insecure? Don't worry, let's continue analyzing:
-### 5.2 后续监听处理的配置段摘抄如下:
+### 5.2 The configuration segments for subsequent listening processing are as follows
-1. 后续处理回落至 `1310` 端口的流量,按照下面的配置验证、处理:
+1. Traffic falling back to port `1310` is verified and processed according to the configuration below:
- ```json
- {
- "port": 1310,
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [
- {
- "password": "", // 填写你的密码
- "level": 0,
- "email": "love@example.com"
- }
- ],
- "fallbacks": [
- {
- "dest": 80 // 或者回落到其它也防探测的代理
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
- }
- ```
+ ```json
+ {
+ "port": 1310,
+ "listen": "127.0.0.1",
+ "protocol": "trojan",
+ "settings": {
+ "clients": [
+ {
+ "password": "", // Fill in your password
+ "level": 0,
+ "email": "love@example.com"
+ }
+ ],
+ "fallbacks": [
+ {
+ "dest": 80 // Or fallback to another probe-resistant proxy
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "tcp",
+ "security": "none",
+ "tcpSettings": {
+ "acceptProxyProtocol": true
+ }
+ }
+ }
+ ```
- 看,神奇的事情发生了, `trojan` 协议这里又出现了一个新的 `fallbacks`。前面已经说过,`xray` 中的 `trojan` 协议也具有完整的回落能力,所以,此时 `trojan` 协议可以再次做判断和回落(这也就是传说中的套娃回落了):
- - 所有 `trojan` 协议的流量,流入 `Xray` 中做后续处理
- - 所有非 `trojan` 协议的流量,转发至 `80` 端口,【主动探测】的防御,完成!
+ Look, something magical happened. A new `fallbacks` section appeared here in the `trojan` protocol. As mentioned before, the `trojan` protocol in `xray` also has full fallback capabilities. So, at this point, the `trojan` protocol can perform judgment and fallback again (this is the legendary "Nested/Matryoshka" fallback):
+ - All `trojan` protocol traffic flows into `Xray` for subsequent processing.
+ - All non-`trojan` protocol traffic is forwarded to port `80`. The defense against [Active Probing] is complete!
-2. 后续处理回落至 `1234` 端口的流量,仔细看!它其实是 `vless+ws`:
+2. Traffic falling back to port `1234`. Look closely! It is actually `vless+ws`:
- ```json
- {
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": "", // 填写你的 UUID
- "level": 0,
- "email": "love@example.com"
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true, // 提醒:若你用 Nginx/Caddy 等反代 WS,需要删掉这行
- "path": "/websocket" // 必须换成自定义的 PATH,需要和分流的一致
- }
- }
- }
- ```
+ ```json
+ {
+ "port": 1234,
+ "listen": "127.0.0.1",
+ "protocol": "vless",
+ "settings": {
+ "clients": [
+ {
+ "id": "", // Fill in your UUID
+ "level": 0,
+ "email": "love@example.com"
+ }
+ ],
+ "decryption": "none"
+ },
+ "streamSettings": {
+ "network": "ws",
+ "security": "none",
+ "wsSettings": {
+ "acceptProxyProtocol": true, // Reminder: Delete this line if using Nginx/Caddy to reverse proxy WS
+ "path": "/websocket" // Must be changed to custom PATH, matching the shunting path
+ }
+ }
+ }
+ ```
-3. 后续处理回落至 `2345` 端口的流量,仔细看!它其实是 `vmess直连`:
+3. Traffic falling back to port `2345`. Look closely! It is actually `vmess direct connection`:
- ```json
- {
- "port": 2345,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": "", // 填写你的 UUID
- "level": 0,
- "email": "love@example.com"
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true,
- "header": {
- "type": "http",
- "request": {
- "path": [
- "/vmesstcp" // 必须换成自定义的 PATH,需要和分流的一致
- ]
- }
- }
- }
- }
- }
- ```
+ ```json
+ {
+ "port": 2345,
+ "listen": "127.0.0.1",
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": "", // Fill in your UUID
+ "level": 0,
+ "email": "love@example.com"
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "tcp",
+ "security": "none",
+ "tcpSettings": {
+ "acceptProxyProtocol": true,
+ "header": {
+ "type": "http",
+ "request": {
+ "path": [
+ "/vmesstcp" // Must be changed to custom PATH, matching the shunting path
+ ]
+ }
+ }
+ }
+ }
+ }
+ ```
-4. 后续处理回落至 `3456` 端口的流量,再仔细看!它其实是是 `vmess+ws(+cdn)`。
+4. Traffic falling back to port `3456`. Look closely again! It is actually `vmess+ws(+cdn)`.
- ::: warning 说明
- 你没看错,这就是 v2fly 曾经推荐的组合之一,并可完整支持 `CDN`。现已加入完美回落套餐哦!
- :::
+ ::: warning Explanation
+ You read that right. This is one of the combinations previously recommended by v2fly, and it fully supports `CDN`. It is now included in the perfect fallback package!
+ :::
- ```json
- {
- "port": 3456,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": "", // 填写你的 UUID
- "level": 0,
- "email": "love@example.com"
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true, // 提醒:若你用 Nginx/Caddy 等反代 WS,需要删掉这行
- "path": "/vmessws" // 必须换成自定义的 PATH,需要和分流的一致
- }
- }
- }
- ```
+ ```json
+ {
+ "port": 3456,
+ "listen": "127.0.0.1",
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": "", // Fill in your UUID
+ "level": 0,
+ "email": "love@example.com"
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "ws",
+ "security": "none",
+ "wsSettings": {
+ "acceptProxyProtocol": true, // Reminder: Delete this line if using Nginx/Caddy to reverse proxy WS
+ "path": "/vmessws" // Must be changed to custom PATH, matching the shunting path
+ }
+ }
+ }
+ ```
-5. 至此,我们就能够完整的画出模板的回落路线了:
+5. **With this, we can draw the complete fallback route for the template:**
```mermaid
graph LR;
- W443(外部 HTTP:443 请求) --> X443(Xray-inbound: 443) .- X1{入站判断}
- X1 --> |协议 = VLESS 的流量| X2(Xray内部规则)
- X2 --> XO(Xray Outbounds 出站)
+ W443(External HTTP:443 Request) --> X443(Xray-inbound: 443) .- X1{Inbound Judgment}
+ X1 --> |Protocol = VLESS Traffic| X2(Xray Internal Rules)
+ X2 --> XO(Xray Outbounds)
- X1 --> |path = /websocket 的流量| X1234(Xray-inbound:1234)
- X1 --> |path = /vmesstcp 的流量| X2345(Xray-inbound:2345)
- X1 --> |path = /vmessws 的流量| X3456(Xray-inbound:3456)
- X1 --> |其它所有流量| X1310(Xray-inbound:1310)
+ X1 --> |path = /websocket Traffic| X1234(Xray-inbound:1234)
+ X1 --> |path = /vmesstcp Traffic| X2345(Xray-inbound:2345)
+ X1 --> |path = /vmessws Traffic| X3456(Xray-inbound:3456)
+ X1 --> |All Other Traffic| X1310(Xray-inbound:1310)
X1234 --> X2
X2345 --> X2
X3456 --> X2
- X1310 --> |协议 = trojan 的流量| X2
- X1310 --> |其他所有流量| N80(Nginx:80)
+ X1310 --> |Protocol = trojan Traffic| X2
+ X1310 --> |All Other Traffic| N80(Nginx:80)
N80:::nginxclass --> H(index.html)
@@ -382,12 +382,12 @@
classDef nginxclass fill:#FFFFDE
```
-## 6. 结语
+## 6. Conclusion
-至此,`Xray` 的【回落】功能就介绍完了。希望本文能够对你理解 `Xray` 的强大有所帮助。
+This concludes the introduction to `Xray`'s **[Fallback]** function. I hope this article helps you understand the power of `Xray`.
-## 7. 附加题
+## 7. Bonus Question
-我再无耻的留一个附加题:本文详解的 [VLESS-TCP-XTLS-WHATEVER](https://github.com/XTLS/Xray-examples/blob/main/VLESS-TCP-XTLS-WHATEVER/) 模板?是否有可以优化的地方?
+I will shamelessly leave a bonus question: Is there any room for optimization in the [VLESS-TCP-XTLS-WHATEVER](https://github.com/XTLS/Xray-examples/blob/main/VLESS-TCP-XTLS-WHATEVER/) template detailed in this article?
-提示:HTTP 自动跳转 HTTPS
+Hint: HTTP automatic redirection to HTTPS.
diff --git a/docs/en/document/level-1/fallbacks-with-sni.md b/docs/en/document/level-1/fallbacks-with-sni.md
index 6a4d3b6d..081ab5fb 100644
--- a/docs/en/document/level-1/fallbacks-with-sni.md
+++ b/docs/en/document/level-1/fallbacks-with-sni.md
@@ -1,77 +1,75 @@
---
-title: SNI fallback
+title: SNI Fallback
---
-# Implementing camouflage and domain-based routing through SNI fallback function
+# Camouflage and Routing by Domain via SNI Fallback
-VLESS is a lightweight protocol that, like Trojan, does not perform complex encryption and obfuscation on traffic. Instead, it is encrypted through the TLS protocol and mixed in with other HTTPS traffic, making it difficult to detect. In order to better disguise itself and respond to active probing, the fallback function appeared with VLESS at the same time. This tutorial will demonstrate how to use the fallback function of VLESS inbound protocol in Xray, combined with Nginx or Caddy, to achieve domain name-based traffic routing while ensuring complete disguise.
+VLESS is a lightweight protocol. Like Trojan, it does not perform complex encryption and obfuscation on traffic. Instead, it "hides in plain sight" by using the TLS protocol for encryption, blending in with other HTTPS traffic to pass in and out of the firewall. To better camouflage against active probing, the **Fallbacks** feature was introduced alongside VLESS. This tutorial will demonstrate how to use the fallback function of the VLESS inbound protocol in Xray, combined with Nginx or Caddy, to achieve routing based on domain names while ensuring complete camouflage.
-## Application Scenarios
+## Scenarios
-Due to XTLS, Xray needs to listen on port 443, which means that if there is a website running on the server, it cannot run or needs to run on another port, which is obviously unreasonable. There are three solutions to this problem:
+Due to XTLS, Xray needs to listen on port 443. If a website was previously running on the server, it would no longer be able to run, or would have to run on a different port, which is obviously unreasonable. There are three solutions to this problem:
-- Xray monitors other commonly used ports (such as 22, 3389, 8443).
+- **Xray listens on other common ports (e.g., 22, 3389, 8443)**
-This plan is the simplest, but not perfect enough.
+ This solution is the simplest, but not perfect.
-- Nginx or HAProxy listens on port 443, uses SNI for L4 load balancing, and achieves port multiplexing through reverse proxy.
+- **Nginx or HAProxy listens on port 443 and uses SNI routing for L4 reverse proxying to achieve port reuse**
-This plan is relatively complicated and requires some understanding of using Nginx or HAProxy. We will not explain it in too much detail here.
+ This solution is relatively complex and requires a certain understanding of Nginx or HAProxy, so it will not be explained in detail here.
-- Xray listens on port 443, and uses Fallbacks feature to split website traffic based on SNI and fallbacks it to Nginx or Caddy.
+- **Xray listens on port 443 and uses the Fallbacks function for SNI routing to fallback website traffic to Nginx or Caddy**
-This plan has a moderate level of difficulty and is the scheme that this tutorial will demonstrate next.
+ This solution is of moderate difficulty and is the method this tutorial intends to demonstrate.
## Introduction to SNI
-Server Name Indication (SNI) is an extension protocol of TLS. Friends who are familiar with reverse proxies know that the following configuration is required if you want to proxy traffic to the correct content through a domain name:
+Server Name Indication (**SNI**) is an extension of the TLS protocol. Friends familiar with reverse proxies know that to proxy traffic to the correct content based on the domain name, the following configuration is needed:
```nginx
proxy_set_header Host hostname;
```
-(Note: "hostname" should be replaced with the actual hostname.)
+This line sets the HTTP Header named "Host" to a specific hostname. Why do this? Generally, one server corresponds to one IP but runs multiple websites. Visitors query the IP via the domain name to access the server. The question arises: how does the server determine which website the visitor wants to access? This requires "Name-based Virtual Hosting."
-This sentence sets the HTTP Header named "Host" to a certain hostname. Why do we need to do this? Generally, one server corresponds to one IP address, but it runs multiple websites. Visitors access the server by querying the IP address via domain name to visit the website. Then the question arises, how to determine which website the visitor wants to access? This requires "name-based virtual hosting".
+When a Web server receives a request, it looks at the requested Host header to serve the correct website. However, when the HTTP protocol is encrypted by the TLS protocol, this simple method becomes impossible. Because the TLS handshake happens before the server sees any HTTP headers, the server cannot use the information in the HTTP Host header to decide which certificate to present, nor can it determine the visitor's target.
-When a Web server receives a request, it looks at the host header to direct the visitor to the correct website. However, this simple method cannot be used when HTTP protocol is encrypted by TLS protocol. This is because the TLS handshake occurs before the server sees any HTTP headers, so the server cannot use the information in the HTTP host header to determine which certificate to present or which destination the visitor wants to access.
+The principle of SNI is simple: it solves this problem by having the client send the hostname as part of the TLS negotiation. Therefore, when using Nginx for reverse proxying HTTPS, you need to add `proxy_ssl_server_name on;` to the configuration. At this point, Nginx will send SNI information to the proxied server, solving the issue of virtual hosts failing under HTTPS. Additionally, when using SNI, the website can be accessed correctly even without specifying the Host header.
-The principle of SNI is also very simple. It solves the problem by allowing the client to send the hostname as part of the TLS negotiation. Therefore, when using Nginx to reverse proxy the HTTPS protocol, you need to add `proxy_ssl_server_name on;` to the configuration. At this time, Nginx will send SNI information to the proxied server, solving the problem of virtual host failure under the HTTPS protocol. In addition, when using SNI, even if the host header is not specified, the website can be accessed correctly.
+## The Logic
-## Idea
+
-
+After receiving traffic on port 443, Xray decrypts the TLS. If the first packet length is < 18, the protocol version is invalid, or authentication fails, the traffic is forwarded to the address specified in `dest` by matching `name`, `path`, and `alpn`.
-After receiving traffic from port 443, Xray will decrypt the TLS and forward the traffic that has a first packet length < 18, invalid protocol version, or failed authentication through matching name, path, and alpn to the address specified by dest.
-
-## Adding DNS Records
+## Add DNS Records

-Please modify the domain name and IP according to the actual situation.
+Please modify the domain name and IP according to your actual situation.
-## Applying for TLS Certificate
+## Apply for TLS Certificates
-As it is necessary to route traffic to different domain name prefixes, but a wildcard certificate is only valid between two dots (for example, applying for `*.example.com`, the certificate cannot be used for `example.com` and `*.*.example.com`), it is necessary to apply for a [SAN](https://en.wikipedia.org/wiki/Subject_Alternative_Name) (Subject Alternative Name) wildcard certificate. According to the information on the Let's Encrypt official website, applying for a wildcard certificate requires DNS-01 verification. Here, we demonstrate how to apply for a free TLS certificate from Let's Encrypt using [acme.sh](https://acme.sh) for a domain with NS records hosted on Cloudflare. For the application method using other domain name hosting providers, please refer to [dnsapi · acmesh-official/acme.sh Wiki](https://github.com/acmesh-official/acme.sh/wiki/dnsapi).
+Since we need to route traffic for domains with different prefixes, and a wildcard certificate is limited to the scope between two dots (e.g., applying for `*.example.com` covers `example.com` but not `*.*.example.com`), we need to apply for a [SAN](https://en.wikipedia.org/wiki/Subject_Alternative_Name) wildcard certificate. According to Let's Encrypt's official site[^1], applying for a wildcard certificate requires DNS-01 validation. Here, we demonstrate using [acme.sh](https://acme.sh) to apply for a free Let's Encrypt TLS certificate for a domain with NS records managed by Cloudflare. For methods using other domain registrars, please read [dnsapi · acmesh-official/acme.sh Wiki](https://github.com/acmesh-official/acme.sh/wiki/dnsapi).
-First, you need to go to the [Cloudflare dashboard](https://dash.cloudflare.com/profile/api-tokens) to create an API token. The parameters are as follows:
+First, go to the [Cloudflare Dashboard](https://dash.cloudflare.com/profile/api-tokens) to create an API Token. The parameters are as follows:
-
+
-The permission part is crucial, while other parts are optional.
+The permissions section is crucial; other sections can be arbitrary.
-After creating, you will receive a mysterious string of characters. Please keep it safe in a secure and non-losing place, as it will not be displayed again. This string of characters is the `CF_Token` that will be used soon.
+After creation, you will get a mysterious string. Please keep it safe in a secure place where it won't be lost, as it will not be shown again. This string is the `CF_Token` used below.
::: tip Note
-The following operations need to be performed under the root user. Using sudo will result in errors.
+The following operations need to be performed as the root user; using sudo may cause errors.
:::
```bash
-curl https://get.acme.sh | sh # Install acme.sh
+curl [https://get.acme.sh](https://get.acme.sh) | sh # Install acme.sh
export CF_Token="sdfsdfsdfljlbjkljlkjsdfoiwje" # Set API Token variable
-acme.sh --issue -d example.com -d *.example.com --dns dns_cf # Apply for a certificate using DNS-01 validation method
-mkdir /etc/ssl/xray # Create a directory to store the certificate
-acme.sh --install-cert -d example.com --fullchain-file /etc/ssl/xray/cert.pem --key-file /etc/ssl/xray/privkey.key --reloadcmd "chown nobody:nogroup -R /etc/ssl/xray && systemctl restart xray" # Install the certificate to the specified directory and set the effective command for automatic renewal
+acme.sh --issue -d example.com -d *.example.com --dns dns_cf # Apply for certificate using DNS-01 validation
+mkdir /etc/ssl/xray # Create directory for certificates
+acme.sh --install-cert -d example.com --fullchain-file /etc/ssl/xray/cert.pem --key-file /etc/ssl/xray/privkey.key --reloadcmd "chown nobody:nogroup -R /etc/ssl/xray && systemctl restart xray" # Install certificate to the specified directory and set the command to run after auto-renewal
```
## Xray Configuration
@@ -164,79 +162,65 @@ acme.sh --install-cert -d example.com --fullchain-file /etc/ssl/xray/cert.pem --
}
```
-The above configuration is for Nginx. Here are some details that need to be noted.
+The above configuration is for Nginx. Here are some details to note:
-- About Proxy Protocol
+- **About Proxy Protocol**
-Proxy Protocol is a protocol developed by HaProxy to solve the problem of easily losing client information during proxying. It is often used for chain proxying and reverse proxying. The traditional approach to handling this problem is often complex and has many limitations, while Proxy Protocol simply attaches the original connection quadruple information packet to the transmitted data, solving this problem in a very simple way.
+ Proxy Protocol is a protocol developed by HAProxy designed to solve the problem of losing client information during proxying. It is often used in chained proxies and reverse proxies. Traditional handling methods are often complex and restrictive, while Proxy Protocol simply attaches the original connection 4-tuple information to the data packet during transmission, solving this problem.
-Everything has its advantages and disadvantages, and the same goes for the Proxy Protocol.
+ Everything has its pros and cons, and Proxy Protocol is no exception.
+ - If sent, it must be received; and vice versa.
+ - The same port cannot be compatible with both connections carrying Proxy Protocol data and those without (e.g., Nginx virtual hosts (server) on the same port essentially violate this).[^2][^3]
-- If there is sending, there must be receiving, and vice versa.
-- The same port cannot be compatible with connections that have Proxy Protocol data and those that don't have data (e.g., different virtual hosts (servers) on the same port in Nginx, which is essentially the previous point). [^2][^3]
+ If you encounter exceptions, please consider whether the configuration meets the above conditions.
-Please consider whether the configuration meets the above conditions when encountering exceptions.
+ Here, we use Proxy Protocol to let the fallback target acquire the client's real IP.
-Here, we use the Proxy Protocol to allow the fallback target to obtain the real IP address of the client.
+ Additionally, when `"acceptProxyProtocol": true` exists in an Xray inbound configuration, ReadV will be disabled.
-In addition, when the `"acceptProxyProtocol": true` exists in a certain inbound configuration of Xray, ReadV will be invalidated.
+- **About HTTP/2**
-- Regarding HTTP/2
+ First, the order of `inbounds.streamSettings.tlsSettings.alpn` matters. `h2` should be placed before `http/1.1` to prioritize HTTP/2 while ensuring compatibility; reversing them will cause HTTP/2 to negotiate as HTTP/1.1, making it an ineffective configuration.
-First, `inbounds.streamSettings.tlsSettings.alpn` has an order. `h2` should be placed before `http/1.1` to prioritize the use of HTTP/2 while ensuring compatibility. Placing them in reverse order will cause HTTP/2 to be negotiated as HTTP/1.1, resulting in an invalid configuration.
+ In the above configuration, each fallback rule to Nginx is split into two. This is because `h2` is an HTTP/2 connection with mandatory TLS encryption, which is beneficial for data security over the internet but unnecessary within the server; whereas `h2c` is an unencrypted HTTP/2 connection, suitable for this environment. However, Nginx cannot listen for HTTP/1.1 and h2c on the same port simultaneously. To solve this, the `alpn` item (inside `fallbacks`, not `tlsSettings`) must be specified in the fallback to attempt to match the TLS ALPN negotiation result.
-In the above configuration, each `fallback` configuration that falls back to Nginx needs to be divided into two. This is because h2 is an HTTP/2 connection that requires TLS encryption, which is beneficial for the security of data transmission over the Internet, but is unnecessary within the server. On the other hand, h2c is a non-encrypted HTTP/2 connection that is suitable for this environment. However, Nginx cannot listen for HTTP/1.1 and h2c on the same port at the same time. To solve this problem, the `alpn` option (in `fallbacks` rather than `tlsSettings`) needs to be specified in the fallback to try to match the TLS ALPN negotiation result.
+ It is recommended to use only two types of values for the `alpn` item as needed:[^4]
+ - Omitted
+ - `"h2"`
-Suggestion: Use only two types of fillings for the `alpn` item as needed: [^4]
+ If you use **Caddy**, you don't need to be this complicated because it **can** listen to HTTP/1.1 and h2c on the same port simultaneously. The configuration changes are as follows:
-- Omitted
-- `"h2"`
-
-If you use Caddy, you don't need to be so complicated, because **it can** listen to HTTP/1.1 and h2c on the same port at the same time. The configuration changes are as follows:
-
-```json
-{
- "fallbacks": [
- {
- "name": "example.com",
- "path": "/vmessws",
- "dest": 5000,
- "xver": 1
- },
- {
- "dest": 5001,
- "xver": 1
- },
- {
- "name": "blog.example.com",
- "dest": 5002,
- "xver": 1
- }
- ]
-}
-```
-
-(Note: This is a JSON code block. It describes fallback configurations for a service.)
+ ```json
+ {
+ "fallbacks": [
+ {
+ "name": "example.com",
+ "path": "/vmessws",
+ "dest": 5000,
+ "xver": 1
+ },
+ {
+ "dest": 5001,
+ "xver": 1
+ },
+ {
+ "name": "blog.example.com",
+ "dest": 5002,
+ "xver": 1
+ }
+ ]
+ }
+ ```
## Nginx Configuration
-Nginx will be installed through official sources.
-
-This is a set of Bash commands to install Nginx on Ubuntu.
-
-The first command installs the necessary packages for the installation process.
-
-The second command adds the Nginx repository to the list of sources that Ubuntu uses to find software packages.
-
-The third command downloads the Nginx signing key and adds it to the system's keyring, which verifies the authenticity of the package.
-
-The fourth command updates the package list with the newly added Nginx repository.
+Nginx will be installed via the official repository.
```bash
sudo apt install curl gnupg2 ca-certificates lsb-release
-echo "deb [arch=amd64] http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
+echo "deb [arch=amd64] [http://nginx.org/packages/ubuntu](http://nginx.org/packages/ubuntu) `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
-curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
+curl -fsSL [https://nginx.org/keys/nginx_signing.key](https://nginx.org/keys/nginx_signing.key) | sudo apt-key add -
sudo apt update
sudo apt install nginx
```
@@ -275,37 +259,30 @@ server {
## Caddy Configuration
-Please refer to [Install — Caddy Documentation](https://caddyserver.com/docs/install) for installing Caddy.
+To install Caddy, please refer to [Install — Caddy Documentation](https://caddyserver.com/docs/install).
-To enable Caddy to obtain the real IP address of visitors, it is necessary to compile Caddy with the Proxy Protocol module. It is recommended to compile it directly on the Caddy website.
+To enable Caddy to obtain the visitor's real IP, you need to compile Caddy with the Proxy Protocol module. It is recommended to compile online directly on the Caddy website.
```bash
-sudo curl -o /usr/bin/caddy "https://caddyserver.com/api/download?os=linux&arch=amd64&p=github.com%2Fmastercactapus%2Fcaddy2-proxyprotocol&idempotency=79074247675458"
-
+sudo curl -o /usr/bin/caddy "[https://caddyserver.com/api/download?os=linux&arch=amd64&p=github.com%2Fmastercactapus%2Fcaddy2-proxyprotocol&idempotency=79074247675458](https://caddyserver.com/api/download?os=linux&arch=amd64&p=github.com%2Fmastercactapus%2Fcaddy2-proxyprotocol&idempotency=79074247675458)"
sudo chmod +x /usr/bin/caddy
```
-This is a bash script that downloads the Caddy web server and sets the necessary permissions to run it on a Linux system.
-
Just replace it directly.
::: tip
-It is recommended to install Caddy through the official website documentation first, and then replace the binary file. This way, there is no need to manually set the process management.
+It is recommended to install Caddy via the official documentation first, and then replace the binary file. This way, you don't need to manually configure the daemon process.
:::
Edit `/etc/caddy/Caddyfile`:
-This is a Caddyfile, which is a configuration file used by the Caddy web server.
-
-In this specific configuration, there are two servers defined: one listening on `127.0.0.1:5001` and another on `127.0.0.1:5002`. Both servers have a `listener_wrapper` defined for `proxy_protocol`, which is a protocol used for passing client connection information through a proxy or load balancer. Additionally, both servers have the `allow_h2c` option enabled, which allows clients to connect using HTTP/2 cleartext (h2c) protocol.
-
```Caddyfile
{
servers 127.0.0.1:5001 {
listener_wrappers {
proxy_protocol
}
- protocol {
+ protocol {
allow_h2c
}
}
@@ -313,7 +290,7 @@ In this specific configuration, there are two servers defined: one listening on
listener_wrappers {
proxy_protocol
}
- protocol {
+ protocol {
allow_h2c
}
}
@@ -338,17 +315,17 @@ http://blog.example.com:5002 {
}
```
-## Reference
+## References
-1. [Server Name Indication - Wikipedia, the free encyclopedia](https://en.wikipedia.org/wiki/Server_Name_Indication)
+1. [Server Name Indication - Wikipedia](https://en.wikipedia.org/wiki/Server_Name_Indication)
2. [Home · acmesh-official/acme.sh Wiki](https://github.com/acmesh-official/acme.sh/wiki)
-3. [HTTP/2 - Wikipedia, the free encyclopedia](https://en.wikipedia.org/wiki/HTTP/2)
+3. [HTTP/2 - Wikipedia](https://en.wikipedia.org/wiki/HTTP/2)
-## Quotation
+## Citations
-[^1]: [Frequently Asked Questions - Let's Encrypt - Free SSL/TLS Certificates](https://letsencrypt.org/docs/faq/)
+[^1]: [FAQ - Let's Encrypt](https://letsencrypt.org/docs/faq/)
[^2]: [Proxy Protocol - HAProxy Technologies](https://www.haproxy.com/blog/haproxy/proxy-protocol/)
-[^3]: [Introduction to Proxy Protocol and Nginx Configuration - Jianshu](https://www.jianshu.com/p/cc8d592582c9)
+[^3]: [Proxy protocol introduction and nginx configuration (Chinese)](https://www.jianshu.com/p/cc8d592582c9)
[^4]: [v2fly-github-io/vless.md at master · rprx/v2fly-github-io](https://github.com/rprx/v2fly-github-io/blob/master/docs/config/protocols/vless.md)
diff --git a/docs/en/document/level-1/index.md b/docs/en/document/level-1/index.md
index ded12ebd..3d4b8bb5 100644
--- a/docs/en/document/level-1/index.md
+++ b/docs/en/document/level-1/index.md
@@ -1,13 +1,15 @@
-# Beginner's Tips
+# Beginner Skills
-**This chapter is an introductory level guide on using Xray, mainly sharing the principles of some commonly used functional modules in Xray.**
+**This section shares beginner-level insights on using Xray, focusing primarily on explaining the principles behind some of Xray's commonly used functional modules.**
-[Analysis of Fallbacks Function](./fallbacks-lv1.md)
+[Analysis of the Fallbacks Feature](./fallbacks-lv1.md)
-[Analysis of Routing Function (Part 1)](./routing-lv1-part1.md)
+[Analysis of the Routing Feature (Part 1)](./routing-lv1-part1.md)
-[Analysis of Routing Function (Part 2)](./routing-lv1-part2.md)
+[Analysis of the Routing Feature (Part 2)](./routing-lv1-part2.md)
-[Analysis of Xray's Working Mode](./work.md)
+[Analysis of Xray's Working Modes](./work.md)
-[Fallbacks with SNI for Disguising and Domain-based Routing](./fallbacks-with-sni.md)
+[Camouflage and Routing by Domain via SNI Fallback](./fallbacks-with-sni.md)
+
+[Accurate Traffic Splitting (Domestic/Foreign) via DNS Module](./routing-with-dns.md)
diff --git a/docs/en/document/level-1/routing-lv1-part1.md b/docs/en/document/level-1/routing-lv1-part1.md
index a04edba6..97205766 100644
--- a/docs/en/document/level-1/routing-lv1-part1.md
+++ b/docs/en/document/level-1/routing-lv1-part1.md
@@ -1,34 +1,34 @@
-# 路由 (routing) 功能简析(上)
+# A Brief Analysis of Routing Functionality (Part 1)
-如果说 Xray 的【强大】主要体现在它极致的速度和广泛的兼容性。那么 Xray 的【灵活】,则主要应该归功于它巧妙的【路由】功能。本文就稍微说明一下这个功能的逻辑以及使用方式。
+If Xray's [Power] is mainly reflected in its extreme speed and broad compatibility, then Xray's [Flexibility] should be mainly attributed to its ingenious [Routing] feature. This article will briefly explain the logic and usage of this function.
-## 1. 初识【路由】三兄弟
+## 1. Meeting the "Routing" Trio
-要理解路由,就要理解完整的路由功能需要有三兄弟来合力完成:1. **入站**;2. **路由**;3. **出站**。
+To understand routing, one must understand that the complete routing function requires three "brothers" working together to complete: 1. **Inbound**; 2. **Routing**; 3. **Outbound**.
-
+
-三兄弟桃园结义,不求同年同月同日生,但求同年同月同日死。
+The three brothers took the Oath of the Peach Garden: not asking to be born on the same year, month, and day, but asking to die on the same year, month, and day.
-所以谨记:任何一个元素错误,就可能导致路由功能无法正常工作。
+So bear in mind: An error in any single element may cause the routing function to fail.
-因为路由的灵活性非常高,只看技术文档很容易把自己绕晕,所以本文我们用几个具体的示例来逐层讲解。
+Because the flexibility of routing is very high, just reading the technical documentation can easily make you dizzy. Therefore, this article will use a few specific examples to explain it layer by layer.
-::: warning 啰嗦君
-路由功能实在过于灵活,所以本文的示例,都是为了讲解对应的概念,实际使用时请根据自己的需求进行调整。
+::: warning Verbose Note
+The routing function is indeed overly flexible, so the examples in this article are meant to explain the corresponding concepts. Please adjust them according to your own needs in actual use.
:::
-## 2. 基本功: “兄弟一条心”
+## 2. Basic Skills: "Brothers United"
-下图的示例,就是在客户端的 `Xray` 入站接收 APP 数据、在路由 100%转发给出站,并从出站流向 VPS。
+The example in the chart below shows the client's `Xray` **Inbound** receiving APP data, the **Routing** forwarding it 100% to the **Outbound**, and the data flowing from the Outbound to the VPS.
```mermaid
graph LR;
- S(APP数据) .-> I[入站]
+ S(APP Data) .-> I[Inbound]
subgraph Xray
- I --> R[路由] --> O[出站]
+ I --> R[Routing] --> O[Outbound]
end
O .-> V(VPS)
@@ -41,15 +41,15 @@
```
-下面我们来逐个分析:
+Let's analyze them one by one:
-### 2.1 入站
+### 2.1 Inbound
::: tip
-**入站:** 就是流量如何流入 `Xray`
+**Inbound:** How traffic flows into `Xray`.
:::
-下面的入站配置示例,用大白话说就是:数据按照 `socks` 协议,通过 `10808` 端口,从本机 `127.0.0.1` 流入`Xray`。同时,`Xray` 将这个入站用 `[tag]` 命名为 `inbound-10808`。
+The following inbound configuration example, in plain English, means: Data flows into `Xray` from the local machine `127.0.0.1` via port `10808` using the `socks` protocol. At the same time, `Xray` names this inbound using the `[tag]` `inbound-10808`.
```json
{
@@ -67,13 +67,13 @@
}
```
-**2.2 出站**
+**2.2 Outbound**
::: tip
-**出站:** 就是流量如何流出 `Xray`
+**Outbound:** How traffic flows out of `Xray`.
:::
-下面的出站配置示例,用大白话说就是:数据按照 `VLESS` 协议,以 `tcp + xtls` 的方式、及其他相关设置,把流量发送给对应的 VPS。同时,`Xray` 将这个出站用 `[tag]` 命名为 `proxy-out-vless`:
+The following outbound configuration example, in plain English, means: Data is sent to the corresponding VPS using the `VLESS` protocol, via `tcp + xtls`, and other related settings. At the same time, `Xray` names this outbound using the `[tag]` `proxy-out-vless`:
```json
{
@@ -111,13 +111,13 @@
}
```
-### 2.3 路由
+### 2.3 Routing
::: tip
-**路由:** 就是把【入站】和【出站】之间的通道,用某种【条件】串联起来
+**Routing:** Connecting the path between [Inbound] and [Outbound] using certain [Conditions].
:::
-下面的路由配置示例,用大白话说就是:把所有通过 `[tag]="inbound-10808"` 入站流入 `Xray` 的流量,`100%` 全部流转导入 `[tag]="proxy-out-vless"` 的出站,没有任何分流或其他操作。
+The following routing configuration example, in plain English, means: 100% of the traffic flowing into `Xray` through `[tag]="inbound-10808"` is forwarded to the outbound with `[tag]="proxy-out-vless"`, without any splitting or other operations.
```json
{
@@ -133,46 +133,46 @@
}
```
-至此,我们最开始设计的极简规则【客户端的 `Xray` 入站接收 APP 数据、在路由 100%转发给出站,并从出站流向 VPS】已经完成。
+At this point, our initially designed minimalist rule [Client `Xray` Inbound receives APP data, Routing forwards 100% to Outbound, and flows from Outbound to VPS] is complete.
-### 2.4 路由配置项解析之一:流量筛选的依据
+### 2.4 Analysis of Routing Configuration Items Part 1: Basis for Traffic Filtering
-注意观察路由配置,我们可以看到几个新名词:
+Observing the routing configuration carefully, we can see several new terms:
1. "domainStrategy": "AsIs"
2. “rules”
3. "inboundTag": ["inbound-10808"]
4. "outboundTag": "proxy-out-vless"
-其中 `domainStrategy` 我们暂且按下不表,先简单说明后面几个:
+We will put aside `domainStrategy` for now and briefly explain the latter ones:
-| 配置名称 | 配置值 | 配置说明 |
-| :-------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------- |
-| `“rules”` | | 它的内层就是【路由规则】的明细设置 |
-| `"inboundTag"` | `["inbound-10808"]` | 筛选流量的 **【依据】** 是【入站 Tag】,具体 **【条件】** 现在只有一个:【入站来源是 `inbound-10808`】 |
-| `"outboundTag"` | `"proxy-out-vless"` | 当上面的筛选条件成立时(即入站`[tag]="inbound-10808"`时 ),`Xray` 会将流量导入 `[tag]="proxy-out-vless"` 的出站 |
+| Config Name | Config Value | Config Explanation |
+| :---------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `“rules”` | | Its inner layer contains the detailed settings of [Routing Rules]. |
+| `"inboundTag"` | `["inbound-10808"]` | The **[Basis]** for filtering traffic is the [Inbound Tag]. The specific **[Condition]** right now is only one: [Inbound source is `inbound-10808`]. |
+| `"outboundTag"` | `"proxy-out-vless"` | When the above filtering condition is met (i.e., when inbound `[tag]="inbound-10808"`), `Xray` will import the traffic into the outbound with `[tag]="proxy-out-vless"`. |
-本例中,我们只有一个入站,它的`"inboundTag" = "inbound-10808"` 。我们也只有一个出站,它的 `[tag]="proxy-out-vless"`。所以根据上面这个路由规则,从唯一入站端口 `10808` 流入`Xray`的流量,`100%` 符合筛选条件、会被路由模块选中,然后转发给唯一的出站。
+In this example, we have only one inbound, and its `"inboundTag" = "inbound-10808"`. We also have only one outbound, with `[tag]="proxy-out-vless"`. Therefore, according to this routing rule, traffic flowing into `Xray` from the sole inbound port `10808` matches the filtering condition `100%`, is selected by the routing module, and is then forwarded to the sole outbound.
-至此,**入站**、**路由**、**出站** 三兄弟就已经可以携手工作了。当然,现在这个 100%转发的工作并没有什么特别的意义。那么接下来,我们就看看这种分工合作的机制可以带来什么好处。
+Thus, the trio of **Inbound**, **Routing**, and **Outbound** can now work hand in hand. Of course, this 100% forwarding task doesn't have any special significance yet. Next, let's see what benefits this cooperative mechanism can bring.
-## 3. 小试牛刀: “三分天下” 之 “域名分流”
+## 3. First Try: "Three Kingdoms" of "Domain Routing"
> `[geosite.dat]`
```mermaid
graph LR;
- S(APP数据) .-> I[入站]
+ S(APP Data) .-> I[Inbound]
subgraph Xray
- I --> R[路由] -- "geosite:category-ads-all" --> O1[block]
- R[路由] -- "geosite:cn" --> O2[direct]
- R[路由] -- "geosite:geolocation-!cn" --> O3[proxy]
+ I --> R[Routing] -- "geosite:category-ads-all" --> O1[block]
+ R[Routing] -- "geosite:cn" --> O2[direct]
+ R[Routing] -- "geosite:geolocation-!cn" --> O3[proxy]
end
- O2 .-> D(国内服务器)
+ O2 .-> D(Domestic Server)
O3 .-> V(VPS)
O1:::redclass
@@ -186,23 +186,23 @@
```
-这个配置逻辑,其实就是最简单、最常用的(《小小白白话文》中也在用的)路由配置三件套:
+This configuration logic is actually the simplest and most commonly used routing configuration set (also used in "Little White's Plain English Guide"):
-1. 广告流量屏蔽 `[block]`
-2. 国内流量直连 `[direct]`
-3. 国外流量转发 VPS `[proxy]`
+1. Block ad traffic `[block]`
+2. Direct connection for domestic traffic `[direct]`
+3. Forward foreign traffic to VPS `[proxy]`
-::: warning 注意
-小小白白话文中的直连配置是包括【国内域名】、【国内 IP】、【本机内部 IP】的。这里先讲解【国内域名】。
+::: warning Note
+The direct connection configuration in "Little White's Plain English Guide" includes [Domestic Domains], [Domestic IPs], and [Local Internal IPs]. Here we explain [Domestic Domains] first.
:::
-### 3.1 入站
+### 3.1 Inbound
-保持上例的 `inbound-10808` 不变。
+Keep `inbound-10808` from the previous example unchanged.
-### 3.2 出站
+### 3.2 Outbound
-在上例的基础上,我们已经有了 `[proxy]` 的出站 `"proxy-out-vless"`,所以它保持不变。显而易见,我们需要加入两个新的出站方式:`[block]` 和 `[direct]`,如下:
+Based on the previous example, we already have the `[proxy]` outbound `"proxy-out-vless"`, so it remains unchanged. Obviously, we need to add two new outbound methods: `[block]` and `[direct]`, as follows:
```json
{
@@ -223,15 +223,15 @@
}
```
-上面的配置用大白话翻译如下:
+The above configuration translated into plain English:
-1. 上例中的 `[proxy-out-vless]` 出站配置保持不变
-2. 加入 **`blackhole` 黑洞协议**,通过这个协议出站的流量,其实都被发送到了 `Xray` 内部的黑洞里,再也无法逃脱,于是效果就是屏蔽 `[block]`
-3. 加入 **`freedom` 自由协议**,通过这个协议出站的流量,是自由的离开`Xray`去寻找原定的服务器,就像从没有来过,于是效果就是直连 `[direct]` (我这里起名叫做 `[direct-out]` 是为了强调它是一个出站)
+1. The `[proxy-out-vless]` outbound configuration from the previous example remains unchanged.
+2. Add **`blackhole` protocol**. Traffic exiting through this protocol is actually sent into a black hole inside `Xray` and can never escape, thus achieving the effect of blocking `[block]`.
+3. Add **`freedom` protocol**. Traffic exiting through this protocol leaves `Xray` freely to find the intended server as if it had never been here, thus achieving the effect of direct connection `[direct]` (I named it `[direct-out]` here to emphasize it is an outbound).
-### 3.3 路由
+### 3.3 Routing
-接下来就是见证奇迹的时刻了,我们可以用【路由】的配置把这些连接起来!
+Now is the moment to witness the miracle; we can use the [Routing] configuration to connect these!
```json
{
@@ -255,87 +255,86 @@
}
```
-为了理解这个配置文件,我们要稍微解释一下这里出现的几个新配置项:
+To understand this configuration file, we need to slightly explain the new configuration items appearing here:
- `"domain": ["geosite:category-ads-all"]`
- `"domain": ["geosite:cn"]`
- `"domain": ["geosite:geolocation-!cn"]`
-### 3.4 简析域名文件: `geosite.dat`
+### 3.4 Brief Analysis of Domain File: `geosite.dat`
-其实,聪明的你大概可以通过这些配置项的名称猜出来个大概:
+Actually, the clever you can probably guess the gist from the names of these configuration items:
-- `"domain"`:就是这次筛选流量的 **【依据】** 是 **【域名】** (而不再是入站 tag)
-- `"geosite"`:就是 `Xray` 会去 `geosite.dat` 文件中寻找 **【符合条件的域名】**
-- `"category-ads-all"`:就是该文件中的 **【所有广告类域名】**
-- `"cn"`:就是该文件中的 **【中国域名】**
-- `"geolocation-!cn"`:就是该文件中的 **【非中国域名】**
+- `"domain"`: This means the **[Basis]** for filtering traffic this time is **[Domain Name]** (no longer inbound tag).
+- `"geosite"`: This means `Xray` will look for **[Domains matching the condition]** in the `geosite.dat` file.
+- `"category-ads-all"`: This means **[All advertising domains]** in that file.
+- `"cn"`: This means **[Chinese domains]** in that file.
+- `"geolocation-!cn"`: This means **[Non-Chinese domains]** in that file.
-结合这些说明,3.3 中的配置用大白话翻译就是:
+Combining these explanations, the configuration in 3.3 translates to plain English as:
-1. APP 试图访问国外域名 `"domain": "geolocation-!cn"` 的流量,通过 `[proxy-out-vless]` 出站,转发至 VPS
-2. APP 试图访问国外域名广告域名 `"domain": "geosite:category-ads-all"` 的流量,通过 `[block]` 出站,转发至黑洞进行屏蔽
-3. APP 试图访问国内域名 `"domain": "geosite:cn"` 的流量,通过 `[direct-out]` 出站,自由离开完成直连
+1. Traffic where the APP attempts to access foreign domains `"domain": "geolocation-!cn"` goes through `[proxy-out-vless]` outbound and is forwarded to the VPS.
+2. Traffic where the APP attempts to access foreign advertising domains `"domain": "geosite:category-ads-all"` goes through `[block]` outbound and is forwarded to the black hole for blocking.
+3. Traffic where the APP attempts to access domestic domains `"domain": "geosite:cn"` goes through `[direct-out]` outbound and leaves freely to complete a direct connection.
-这时,才让【路由功能】的好处稍微得到了一些展现。
+At this point, the benefits of the [Routing Function] are finally somewhat revealed.
-### 3.5 所以 `geosite.dat` 到底是什么?不是有个 `GFWList` 吗?
+### 3.5 So what exactly is `geosite.dat`? Wasn't there a `GFWList`?
-你想,这世界上的域名何止千万,如果我们每写一个基于【域名】匹配的路由规则,都要自己收集、手动输入域名,那效率将会何其低下!
+Think about it, there are tens of millions of domains in the world. If we had to collect and manually input domains every time we wrote a routing rule based on [Domain] matching, how inefficient that would be!
-而如果所有的域名都只有一个种类,`[direct], [proxy], [block]` 只能三选其一,那又是多么的不方便!
+And if all domains were just one category, and we could only choose one out of `[direct], [proxy], [block]`, how inconvenient that would be!
-就如关羽需要他的青龙偃月刀,`geosite.dat` 文件便作为【路由功能】驱使的神兵利器横空出世了,它致力于为用户提供成熟完善的【域名分类表】。让用户可以简单的通过 `geosite:xxx` 这种格式方便的调用任何子类,定制符合自身需求的路由规则。
+Just as Guan Yu needed his Green Dragon Crescent Blade, the `geosite.dat` file was born as a divine weapon driven by the [Routing Function]. It is dedicated to providing users with a mature and complete [Domain Classification Table]. It allows users to easily call any subclass via the `geosite:xxx` format to customize routing rules that meet their own needs.
-这种模块化结构提供的灵活性,其实远超传统的一揽子防火墙域名列表 [`GFWList`](https://github.com/gfwlist/gfwlist)。为什么这么说呢?比如,你可以指定苹果的域名 `geosite:apple` 和 icloud 相关域名 `geosite:icloud` 通过代理 `[proxy]`,但是苹果的软件域名 `geosite:apple-update` 保持直连 `[direct]` 来保持最大下载速度。
+The flexibility provided by this modular structure actually far exceeds the traditional blanket firewall domain list [`GFWList`](https://github.com/gfwlist/gfwlist). Why do I say that? For example, you can specify Apple's domains `geosite:apple` and iCloud related domains `geosite:icloud` to go through the proxy `[proxy]`, but keep Apple's software update domains `geosite:apple-update` on direct connection `[direct]` to maintain maximum download speed.
::: warning
-**注意:** 现在,`geosite.dat` 文件其实有多种选择:
+**Note:** Nowadays, there are actually multiple choices for the `geosite.dat` file:
-最初,从 `Victoria Raymond` 主力维护 `Project V` 项目时期,便提供了最初的配套项目:[`domain-list-community`](https://github.com/v2ray/domain-list-community),用来收集、沉淀、分类各种常用的域名类型;
+Initially, during the time when `Victoria Raymond` was the main maintainer of the `Project V` project, the original companion project was provided: [`domain-list-community`](https://github.com/v2ray/domain-list-community), used to collect, precipitate, and classify various commonly used domain types;
-之后,随着 V 姐突然消失导致 `Project V` 的原项目开发陷入停滞,`v2fly` 社区维护并持续更新了社区版本的 [`domain-list-community`](https://github.com/v2fly/domain-list-community);
+Later, as V disappeared and the development of the original `Project V` stalled, the `v2fly` community maintained and continued to update the community version of [`domain-list-community`](https://github.com/v2fly/domain-list-community);
-同时,Loyalsoldier 维护了其个人修改增强的路由规则文件 [v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat),提供了诸多不同的选择和分类逻辑;
+Meanwhile, Loyalsoldier maintains his personally modified and enhanced routing rule file [v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat), offering many different choices and classification logic;
-另外,`Project X` 也计划于未来定制维护更适合 `Xray` 使用的路由规则文件 [Xray-rules-dat](https://github.com/XTLS/Xray-rules-dat)。~~(你们看,文件夹都建好了,所以快了快了)~~
+In addition, `Project X` also plans to customize and maintain a routing rule file better suited for `Xray` in the future: [Xray-rules-dat](https://github.com/XTLS/Xray-rules-dat). ~~(Look, the folder is already created, so it's coming soon, coming soon)~~
-甚至,你还可以定制自己的 `geosite` 文件,外挂给 `Xray` 使用,但是这个就跑题了,本文不展开。
-
-如果你发现有些你遇到的域名没有被合理分类,请向上面的项目们提出 `issue` 甚至提交 `Pull Request` 吧!社区列表社区维护,人人为我我为人人!
+You can even customize your own `geosite` file and load it externally for `Xray` to use, but that's off-topic and won't be expanded upon in this article.
+If you find that some domains you encounter are not properly classified, please raise an `issue` or even submit a `Pull Request` to the projects above! Community lists are maintained by the community; one for all, all for one!
:::
-### 3.6 军师锦囊藏奇兵:一条隐藏的路由规则
+### 3.6 The Strategist's Hidden Card: A Hidden Routing Rule
-事实上,当你认真思考上面的规则,不难发现一个问题,我们的所有规则都只规定了【当入站流量 **符合某种条件时** 应该被转发给哪个出站】,那么,如果 `geosite.dat` 文件不全面,我们的入站流量【**不符合任何条件时**】,`Xray` 会怎么处理呢?
+In fact, if you think carefully about the rules above, it's not hard to spot a problem. All our rules only stipulate [which outbound to forward to **when the inbound traffic meets certain conditions**]. So, if the `geosite.dat` file is not comprehensive, how will `Xray` handle our inbound traffic **when it does not meet any conditions**?
-::: warning 注意
-如果你认为【不符合条件当然就无法连接啦!】的话,你可要重新思考一下哦。因为只有指定了 `[block]` 规则,才会被导入到 `blackhole` 黑洞协议从而阻断连接
+::: warning Note
+If you think "If it doesn't meet conditions, of course it can't connect!", you need to rethink. Because only when a `[block]` rule is specified will it be imported into the `blackhole` protocol to block the connection.
:::
-事实上,`Xray` 为了避免路由规则不完全导致的规则混乱,已经贴心的提供了一条隐藏的路由规则:【**当入站流量不符合任何条件时,转发给第一个出站** 】
+In fact, to avoid rule chaos caused by incomplete routing rules, `Xray` has thoughtfully provided a hidden routing rule: [**When inbound traffic does not meet any conditions, forward it to the first outbound**].
-这样,就不会有任何流量被漏掉了。所以,你一定要把你最信赖的心腹大将放在【第一条出站】,让它为你守城护池。
+This way, no traffic will be left out. Therefore, you must place your most trusted "general" at the [First Outbound] position to guard your city.
-### 3.7 再看“三分天下”的大地图
+### 3.7 Looking at the "Three Kingdoms" Big Map Again
-因为我们在前面的示例中把 `[proxy-out-vless]` 放在了出站的第一位,所以隐藏规则生效时,流量会通过 `VLESS` 协议被转发至远端的 VPS。因此,`Xray` 此时的完整工作逻辑如下:
+Because we placed `[proxy-out-vless]` in the first position of the outbounds in the previous example, when the hidden rule takes effect, traffic will be forwarded to the remote VPS via the `VLESS` protocol. Therefore, `Xray`'s complete working logic at this time is as follows:
```mermaid
graph LR;
- S(APP数据) .-> I[入站]
+ S(APP Data) .-> I[Inbound]
subgraph Xray
- I --> R[路由] -- "geosite:category-ads-all" --> O1[block]
- R[路由] -- "geosite:cn" --> O2[direct]
- R[路由] -- "geosite:geolocation-!cn" --> O3[proxy]
- R[路由] -. "没有命中规则的流量" .-> O4[第一条出站]
+ I --> R[Routing] -- "geosite:category-ads-all" --> O1[block]
+ R[Routing] -- "geosite:cn" --> O2[direct]
+ R[Routing] -- "geosite:geolocation-!cn" --> O3[proxy]
+ R[Routing] -. "Traffic hitting no rules" .-> O4[First Outbound]
end
- O2 .-> D(国内服务器)
+ O2 .-> D(Domestic Server)
O3 .-> V(VPS)
O4 .-> V(VPS)
@@ -350,15 +349,15 @@
```
-事实上,这就是传统所谓的 **【默认科学上网、国内网站白名单直连】** 的配置。
+In fact, this is the traditional configuration known as **[Default Proxy (Science Internet), Domestic Website Whitelist Direct]**.
-## 4. “三分天下” 之 “蜀魏争雄”
+## 4. "Three Kingdoms" - "Shu vs Wei": Changing Priorities
-现在,你已经知道了隐藏的默认路由规则:【**当入站流量不符合任何条件时,转发给第一个出站** 】。这时候,你应该能看出来,究竟是【科学上网】为王,还是【直连】称霸,全看你的第一条出站是什么!
+Now, you already know the hidden default routing rule: [**When inbound traffic does not meet any conditions, forward to the first outbound**]. At this point, you should be able to see that whether [Proxy/Science Internet] rules supreme or [Direct Connection] dominates depends entirely on what your first outbound is!
-上一步我们已经配置出了 **【默认科学上网、国内网站白名单直连】** 的规则。那么现在只要 **【把直连规则放在第一位】**,就立即变成了正好相反的 **【默认直连、国外网站白名单科学上网】** 规则。
+In the previous step, we configured the **[Default Proxy, Domestic Whitelist Direct]** rule. Now, as long as we **[place the direct rule in the first position]**, it immediately changes to the exact opposite **[Default Direct, Foreign Website Whitelist Proxy]** rule.
-是不是,非常地简单?
+Isn't it very simple?
```json
{
@@ -379,22 +378,22 @@
}
```
-此时,路由规则其实变成了:
+At this time, the routing rules actually become:
```mermaid
graph LR;
- S(APP数据) .-> I[入站]
+ S(APP Data) .-> I[Inbound]
subgraph Xray
- I --> R[路由] -- "geosite:category-ads-all" --> O1[block]
- R[路由] -- "geosite:geolocation-!cn" --> O3[proxy]
- R[路由] -- "geosite:cn" --> O2[direct]
- R[路由] -. "没有命中规则的流量" .-> O4[第一条出站]
+ I --> R[Routing] -- "geosite:category-ads-all" --> O1[block]
+ R[Routing] -- "geosite:geolocation-!cn" --> O3[proxy]
+ R[Routing] -- "geosite:cn" --> O2[direct]
+ R[Routing] -. "Traffic hitting no rules" .-> O4[First Outbound]
end
- O2 .-> D(国内服务器)
+ O2 .-> D(Domestic Server)
O3 .-> V(VPS)
O4 .-> D
@@ -408,12 +407,12 @@
```
-这就是路由功能的灵活之处了,你可以自由的改变它的顺序来实现不同的设计。
+This is the flexibility of the routing function; you can freely change its order to achieve different designs.
-至此,我们已经解释完了 **【如何利用 `geosite.dat` 文件,通过路由规则,根据【域名】来分流网络流量】。**
+At this point, we have finished explaining **[How to use the `geosite.dat` file to route network traffic based on [Domain Name] through routing rules].**
-## 5. 攻城略池 - 多种路由匹配条件
+## 5. Conquering Cities - Multiple Routing Match Conditions
-请确保你已经读懂了上面的内容,因为这样,你就已经理解了【路由】功能的工作逻辑。有了这个基础,我们就可以继续分析【路由】功能更多更详细的配置方式和匹配条件了。
+Please ensure you have understood the content above, because this means you have understood the working logic of the [Routing] function. With this foundation, we can continue to analyze more detailed configuration methods and matching conditions of the [Routing] function.
-等你看完后面的内容,就完全可以自由的定制属于自己的路由规则啦!还等什么,让我们一起进入 [《路由 (routing) 功能简析(下)》](./routing-lv1-part2.md) 吧!
+Once you finish reading the subsequent content, you will be completely able to freely customize your own routing rules! What are you waiting for? Let's enter [《A Brief Analysis of Routing Functionality (Part 2)》](./routing-lv1-part2.md) together!
diff --git a/docs/en/document/level-1/routing-lv1-part2.md b/docs/en/document/level-1/routing-lv1-part2.md
index a8137b6e..239732f1 100644
--- a/docs/en/document/level-1/routing-lv1-part2.md
+++ b/docs/en/document/level-1/routing-lv1-part2.md
@@ -1,71 +1,71 @@
-# 路由 (routing) 功能简析(下)
+# Brief Analysis of Routing Functions (Part 2)
-欢迎继续学习 `Xray` 的【路由】功能!
+Welcome back to the study of `Xray`'s **[Routing]** function!
-在 [《路由 (routing) 功能简析(上)》](./routing-lv1-part1.md) 中,我们已经对【路由】功能的工作逻辑有了清晰的理解,也基于 `geosite.dat` 文件做了简单的域名分流配置。
+In [Brief Analysis of Routing Functions (Part 1)](./routing-lv1-part1.md), we gained a clear understanding of the working logic of the **[Routing]** function and set up simple domain-based shunting based on the `geosite.dat` file.
-如前面所说,域名分流仅仅是【路由】功能的牛刀小试而已。下面就让我们来看看除了域名之外,还什么可以用做分流依据的东西吧!
+As mentioned earlier, domain-based shunting is just a small test of the **[Routing]** function's capabilities. Now, let's see what else, besides domains, can be used as a basis for shunting!
-## 5. 攻城略池 - 多种路由匹配条件
+## 5. Expanding Horizons - Multiple Routing Matching Conditions
-> `[域名], [IP], [协议], etc.`
+> `[domain], [IP], [protocol], etc.`
-基于域名的分流,已经可以让我们对网络流量进行基本合理的分流。为什么说【基本合理】呢?
+Shunting based on domains allows us to route network traffic in a basically reasonable way. Why do I say "basically reasonable"?
-因为【三分天下】虽然是正确的战略方向,但如果只用【域名】来实现这个战略,其实漏洞百出,比如:
+Because although "Dividing the world into three" (Block, Direct, Proxy) is the correct strategic direction, if you only use **[Domain]** to implement this strategy, it is actually full of loopholes. For example:
-1. 我读了《小小白白话文》后,给 VPS 新申请了一个 `proxy.yourdomain.com` 的域名, 我希望它无论如何都代理,`geosite.dat` 里面有吗?
-2. 如果我还有个 `direct.yourdomain.com` 的域名,我希望它无论如何都直连, `geosite.dat` 里面有吗?
-3. 本机 `127.0.0.1` 的内部流量,是否正确直连了?(比如 `docker` 等)
-4. 路由器、本地局域网 `192.168.*.*` 的流量,是否正确直连了?(比如路由器、群晖等)
-5. 我的国内 DNS 查询(如 `223.5.5.5`)是否正确直连了?
-6. 我的国外 DNS 查询(如 `1.1.1.1`)是否正确代理了?
-7. 其他类似国内公共 DNS 一样没有域名、只有 IP 地址的国内网站,是否正确直连了?
-8. 其他类似国外公共 DNS 一样没有域名、只有 IP 地址的国外网站,是否正确代理了?
-9. BT 下载的流量,虽然来源是国外,但如果通过 VPS 下载很可能导致违规使用被封,这该如何强制直连?
+1. After reading the "Simple Guide for Beginners", I applied for a new domain `proxy.yourdomain.com` for my VPS. I want it to be proxied no matter what. Is it in `geosite.dat`?
+2. If I have another domain `direct.yourdomain.com`, and I want it to be connected directly no matter what. Is it in `geosite.dat`?
+3. Is the internal traffic of the local machine `127.0.0.1` (such as `docker`, etc.) correctly connected directly?
+4. Is the traffic of the router and local LAN `192.168.*.*` correctly connected directly? (Such as routers, Synology NAS, etc.)
+5. Are my domestic DNS queries (such as `223.5.5.5`) correctly connected directly?
+6. Are my foreign DNS queries (such as `1.1.1.1`) correctly proxied?
+7. Are other domestic websites that only have IP addresses and no domains (similar to domestic public DNS) correctly connected directly?
+8. Are other foreign websites that only have IP addresses and no domains (similar to foreign public DNS) correctly proxied?
+9. Although the source of BT download traffic is abroad, downloading via VPS may lead to a ban due to violation of usage terms. How can I force this to be direct?
10. ......
-我之所以说只用【域名分流】会漏洞百出,是因为 `geosite.dat` 文件内只包含了一部分常用的域名。换言之,仅仅依赖它,则会:
+The reason I say using only **[Domain Shunting]** is full of loopholes is that the `geosite.dat` file only contains a portion of commonly used domains. In other words, relying solely on it will result in:
-- 无法匹配文件里没有的新域名
-- 无法匹配基于 IP 地址的规则
-- 无法匹配基于网络协议的规则
+- Inability to match new domains not in the file.
+- Inability to match rules based on IP addresses.
+- Inability to match rules based on network protocols.
-::: warning 啰嗦君
-那我们来复习一下,当上面这些情况无法匹配时,会发生什么?对了,会触发隐藏路由规则,即【**转发给第一个出站** 】。这其实就是说:
+::: warning Mr. Wordy
+Let's review: what happens when the situations above cannot be matched? That's right, the hidden routing rule will be triggered, which is **[Forward to the first outbound]**. This actually means:
-- 当你的第一个出站是 `[direct-out]` 时:**需要直连的都正确了,但需要代理的则都错误**
-- 当你的第一个出站是 `[proxy-out-vless]` 时:**需要代理的都正确了,但需要直连的则都错误**
- :::
+- When your first outbound is `[direct-out]`: **Everything needing direct connection is correct, but everything needing proxy is wrong.**
+- When your first outbound is `[proxy-out-vless]`: **Everything needing proxy is correct, but everything needing direct connection is wrong.**
+:::
-所以,我们需要一个办法,让我们鱼与熊掌兼得。这样的办法是否存在呢?**当然存在!** 我们需要的只是【域名】之外更多的【**分流判断依据**】而已。
+Therefore, we need a way to have our cake and eat it too. Does such a way exist? **Of course!** All we need are more **[Shunting Judgment Criteria]** beyond just **[Domain]**.
-### 5.1 基于指定域名分流:`[domain], [full]` 等
+### 5.1 Shunting Based on Specific Domains: `[domain], [full]`, etc
-1. 如果需要匹配某个子域名,如 `a-name.yourdomain.com`,我们使用 `full: "a-name.yourdomain.com"`
-2. 前面的 `问题1` 和 `问题2`,就可以通过给 `proxy.yourdomain.com` 指定 `[proxy-out-vless]` 出站,给 `direct.yourdomain.com` 指定 `[direct-out]` 出站来解决
-3. 如果需要匹配 `yourdomain.com` 的所有子域名,我们使用 `domain: "yourdomain.com"` 实现
-4. 上述两个可以成为两个独立的路由规则,达到某些子域名直连,其他子域名代理的配置
-5. 另外,`[domain]` 还支持正则表达式等匹配方式。详情请参考 [《基础配置模块 - 路由》文档](../../config/routing.md)
+1. If we need to match a specific subdomain, such as `a-name.yourdomain.com`, we use `full: "a-name.yourdomain.com"`.
+2. The previous `Question 1` and `Question 2` can be solved by assigning the `[proxy-out-vless]` outbound to `proxy.yourdomain.com` and the `[direct-out]` outbound to `direct.yourdomain.com`.
+3. If we need to match all subdomains of `yourdomain.com`, we use `domain: "yourdomain.com"` to implement it.
+4. The above two can become two independent routing rules, achieving a configuration where some subdomains are direct and others are proxied.
+5. Additionally, `[domain]` also supports matching methods like regular expressions. For details, please refer to the [[Basic Configuration Module - Routing] documentation](../../config/routing.md).
-上述配置如下:
+The configuration is as follows:
```json
{
"routing": {
"domainStrategy": "AsIs",
"rules": [
- // 指定子域名直连
+ // Specify subdomain for direct connection
{
"domain": ["full:direct.yourdomain.com"],
"outboundTag": "direct-out"
},
- // 指定子域名转发VPS
+ // Specify subdomain for forwarding to VPS
{
"domain": ["full:proxy.yourdomain.com"],
"outboundTag": "proxy-out-vless"
},
- // 指定泛域名转发VPS
+ // Specify wildcard domain for forwarding to VPS
{
"domain": ["yourdomain.com"],
"outboundTag": "proxy-out-vless"
@@ -75,27 +75,27 @@
}
```
-### 5.2 基于 IP 文件分流:`geoip.dat`
+### 5.2 Shunting Based on IP Files: `geoip.dat`
-除了使用 `geosite.dat` 核心自然也支持直接使用IP进行路由以满足各种需求。
+Very similar to the `geosite.dat` rule file, we also have the `geoip.dat` rule file. It is dedicated to providing users with a mature and complete **[IP Classification Table]**. It allows users to simply call any subclass via the `geoip:xxx` format to customize routing rules that meet their needs.
-1. 解决前面的 `[问题3], [问题4]`,我们使用 `geoip:private` 类别来指定 `[direct-out]`
-2. 解决前面的 `[问题7]`,我们使用 `geoip:cn` 类别来指定 `[direct-out]`
-3. 解决前面的 `[问题8]`,由于 `geoip` 中没有【非中国 IP】这个分类(因为这等于要收集全世界的 IP 段),所以我们用隐藏规则代替,也就是将 `[proxy-out-vless]` 放在第一个出站
+1. To solve the previous `[Question 3]` and `[Question 4]`, we use the `geoip:private` category to specify `[direct-out]`.
+2. To solve the previous `[Question 7]`, we use the `geoip:cn` category to specify `[direct-out]`.
+3. To solve the previous `[Question 8]`, since `geoip` does not have a category for "Non-Chinese IPs" (because this would mean collecting IP ranges from the entire world), we use the hidden rule instead, which is placing `[proxy-out-vless]` as the first outbound.
-上述配置如下:
+The configuration is as follows:
```json
{
"routing": {
"domainStrategy": "AsIs",
"rules": [
- // 本机内部地址、局域网地址直连
+ // Local internal addresses and LAN addresses direct connection
{
"ip": ["geoip:private"],
"outboundTag": "direct-out"
},
- // 国内IP集直连
+ // Domestic IP set direct connection
{
"ip": ["geoip:cn"],
"outboundTag": "direct-out"
@@ -105,26 +105,26 @@
}
```
-### 5.3 基于指定 IP 地址分流
+### 5.3 Shunting Based on Specific IP Addresses
-与 `geosite.dat` 规则文件十分类似的,我们还有 `geoip.dat` 这个规则文件,它是供【路由功能】驱使的**第二个神兵利器**,它致力于为用户提供成熟完善的【IP 分类表】。让用户可以简单的通过 `geoip:xxx` 这种格式方便的调用任何子类,定制符合自身需求的路由规则 。
+In addition to using `geoip.dat`, the core naturally supports routing directly using IPs to meet various needs.
-1. 解决前面的 `[问题5]`,我们使用 `ip: "223.5.5.5"` 来指定 `[direct-out]`
-2. 解决前面的 `[问题6]`,我们使用 `ip: "1.1.1.1"` 来指定 `[proxy-out-vless]`
+1. To solve the previous `[Question 5]`, we use `ip: "223.5.5.5"` to specify `[direct-out]`.
+2. To solve the previous `[Question 6]`, we use `ip: "1.1.1.1"` to specify `[proxy-out-vless]`.
-上述配置如下:
+The configuration is as follows:
```json
{
"routing": {
"domainStrategy": "AsIs",
"rules": [
- // 指定IP地址直连
+ // Specific IP address direct connection
{
"ip": ["223.5.5.5"],
"outboundTag": "direct-out"
},
- // 指定IP地址转发VPS
+ // Specific IP address forwarding to VPS
{
"ip": ["1.1.1.1"],
"outboundTag": "proxy-out-vless"
@@ -134,12 +134,12 @@
}
```
-### 5.4 基于协议类型分流:`[protocol]` 等
+### 5.4 Shunting Based on Protocol Types: `[protocol]`, etc
-1. 解决前面的 `[问题9]`,我们使用 `"protocol": ["bittorrent"]` 类别来指定 `[direct-out]`
+1. To solve the previous `[Question 9]`, we use the `"protocol": ["bittorrent"]` category to specify `[direct-out]`.
::: tip
-你需要打开入站代理中的 `sniffing` 才能使用此种方式分流。
+You need to enable `sniffing` in the inbound proxy to use this method for shunting.
:::
```json
@@ -147,7 +147,7 @@
"routing": {
"domainStrategy": "AsIs",
"rules": [
- // 指定 BT 协议直连
+ // Specific BT protocol direct connection
{
"protocol": ["bittorrent"],
"outboundTag": "direct-out"
@@ -157,18 +157,18 @@
}
```
-### 5.5 基于更多条件的分流
+### 5.5 Shunting Based on More Conditions
-到目前位置,我们仍然只讲了【路由功能】分流能力的冰山一角!因为它还支持很多其他的判断条件!我在此简单罗列如下:
+Up to this point, we have only touched the tip of the iceberg of the **[Routing Function]**'s shunting capabilities! It supports many other judgment conditions! I will briefly list them below:
-本文已经讲过的:
+Covered in this article:
- `inboundTag`
- `domain`
- `ip`
- `protocol`
-本文尚未讲到的:
+Not yet covered in this article:
- `port`
- `sourcePort`
@@ -177,14 +177,14 @@
- `user`
- `attrs`
-但这些内容实在是过多,全部展开就远远不是 `level-1` 的内容了,所以,需要这些复杂条件的朋友,请仔细阅读 [《基础配置模块 - 路由》文档](../../config/routing.md) 自学哦!有问题就去 TG 群里面问问吧!
+However, expanding on all these would be too much content, far beyond the scope of `level-1`. Therefore, friends who need these complex conditions, please carefully read the [[Basic Configuration Module - Routing] documentation](../../config/routing.md) to learn on your own! If you have questions, ask in the Telegram group!
-## 6. “霸业初定”:路由规则整体回顾
+## 6. "The Empire is Set": A Comprehensive Review of Routing Rules
-到现在为止,我们已经累积出了一套战略雄伟、战术精准的路由规则,为了避免混乱,现在就对它进行一次完整的整理和回顾。
+So far, we have accumulated a set of routing rules with grand strategy and precise tactics. To avoid confusion, let's now organize and review them completely.
-::: warning 注意
-路由生效的顺序是:【从上往下,依次判断】,所以我一般推荐的规则顺序是:
+::: warning Note
+The order in which routing takes effect is: **[Top to bottom, judged sequentially]**. Therefore, the rule order I generally recommend is:
`[1-block] --> [2-direct] --> [3-proxy] --> [4-first-outbound]`
:::
@@ -194,30 +194,30 @@
"routing": {
"domainStrategy": "AsIs",
"rules": [
- // [1-block 广告流量屏蔽]
- // 1.1 广告域名集屏蔽
+ // [1-block Ad traffic blocking]
+ // 1.1 Ad domain set blocking
{
"domain": ["geosite:category-ads-all"],
"outboundTag": "block"
},
- // [2-direct 国内流量直连]
- // 2.1 国内域名集、指定子域名直连
+ // [2-direct Domestic traffic direct connection]
+ // 2.1 Domestic domain set, specific subdomain direct connection
{
"domain": ["geosite:cn", "full:direct.yourdomain.com"],
"outboundTag": "direct-out"
},
- // 2.2 本机内部地址+局域网、国内IP、指定IP直连
+ // 2.2 Local internal address + LAN, Domestic IP, Specific IP direct connection
{
"ip": ["geoip:private", "geoip:cn", "223.5.5.5"],
"outboundTag": "direct-out"
},
- // 2.3 BT协议流量直连
+ // 2.3 BT protocol traffic direct connection
{
"protocol": ["bittorrent"],
"outboundTag": "direct-out"
},
- // [3-proxy 国外流量转发VPS]
- // 3.1 国外域名集、指定子域名、指定泛域名转发VPS
+ // [3-proxy Foreign traffic forwarding to VPS]
+ // 3.1 Foreign domain set, specific subdomain, specific wildcard domain forwarding to VPS
{
"domain": [
"geosite:geolocation-!cn",
@@ -226,45 +226,45 @@
],
"outboundTag": "proxy-out-vless"
},
- // 3.2 指定IP转发VPS
+ // 3.2 Specific IP forwarding to VPS
{
"ip": ["1.1.1.1"],
"outboundTag": "proxy-out-vless"
}
- // [4-default-routing 第一条出站]
- // 没有匹配到任何规则的流量,默认使用第一条出站处理
+ // [4-default-routing First outbound]
+ // Traffic not matching any rules defaults to the first outbound handling
]
}
}
```
-此时,路由规则其实变成了:
+At this point, the routing rules have effectively become:
```mermaid
graph LR;
- S(APP数据) .-> I[入站]
+ S(App Data) .-> I[Inbound]
subgraph Xray
- I --> R[路由] -- "geosite:category-ads-all" --> O1[block]
+ I --> R[Routing] -- "geosite:category-ads-all" --> O1[block]
- R[路由] -- "geosite:cn" --> O2[direct]
- R[路由] -- "direct.yourdomain.com" --> O2[direct]
- R[路由] -- "geoip:private" --> O2[direct]
- R[路由] -- "geoip:cn" --> O2[direct]
- R[路由] -- "ip:223.5.5.5" --> O2[direct]
- R[路由] -- "protocol:bittorrent" --> O2[direct]
+ R[Routing] -- "geosite:cn" --> O2[direct]
+ R[Routing] -- "direct.yourdomain.com" --> O2[direct]
+ R[Routing] -- "geoip:private" --> O2[direct]
+ R[Routing] -- "geoip:cn" --> O2[direct]
+ R[Routing] -- "ip:223.5.5.5" --> O2[direct]
+ R[Routing] -- "protocol:bittorrent" --> O2[direct]
- R[路由] -- "geosite:geolocation-!cn" --> O3[proxy]
- R[路由] -- "proxy.yourdomain.com" --> O3[proxy]
- R[路由] -- "*.yourdomain.com" --> O3[proxy]
- R[路由] -- "ip:1.1.1.1" --> O3[proxy]
+ R[Routing] -- "geosite:geolocation-!cn" --> O3[proxy]
+ R[Routing] -- "proxy.yourdomain.com" --> O3[proxy]
+ R[Routing] -- "*.yourdomain.com" --> O3[proxy]
+ R[Routing] -- "ip:1.1.1.1" --> O3[proxy]
- R[路由] -. "没有命中规则的流量" .-> O4[第一条出站]
+ R[Routing] -. "Traffic not hitting any rules" .-> O4[First Outbound]
end
- O2 .-> D(国内服务器)
+ O2 .-> D(Domestic Server)
O3 .-> V(VPS)
O1:::redclass
@@ -277,20 +277,20 @@
```
-至于第一条出站是 `[direct-out]` 还是 `[proxy-out-vless]`,这就全看你的需求了。
+As for whether the first outbound is `[direct-out]` or `[proxy-out-vless]`, that depends entirely on your needs.
-## 7. 路由配置常见错误
+## 7. Common Routing Configuration Errors
-请大家注意看,我上面每一条路由规则,都是一个独立的匹配依据,只有这样才能确保生效。而新人在自定义路由规则时常犯的一个错误就是:**在一条规则内同时匹配了多种不同的匹配依据,造成匹配无效。**
+Please pay attention: every routing rule I listed above is an independent matching basis. This is the only way to ensure they take effect. A common mistake newcomers make when customizing routing rules is: **Matching multiple different matching criteria within a single rule, causing the match to fail.**
-比如,他希望实现的配置是:
+For example, the configuration they hope to achieve is:
-1. 自己的 `direct.yourdomain.com` 直连
-2. 国内 DNS 查询(如 `223.5.5.5`)直连
+1. Their own `direct.yourdomain.com` connects directly.
+2. Domestic DNS queries (such as `223.5.5.5`) connect directly.
-### 7.1 错误示范
+### 7.1 Incorrect Example
-为了实现上面的目标,他写出了以下路由规则:
+To achieve the above goals, they wrote the following routing rule:
```json
{
@@ -307,19 +307,19 @@
}
```
-你能看出这里面的错误吗?乍一看,似乎是对的?
+Can you spot the error here? At first glance, it seems correct?
-::: warning 注意
-**同一个规则之内,各个依据需要同时成立,才会匹配成功**,逻辑关系是 `和`,而不是 `或`。
+::: warning Note
+**Within the same rule, all criteria must be met simultaneously for the match to succeed.** The logical relationship is `AND`, not `OR`.
:::
-换言之,这条规则的意思是:【当你访问的 `目标 = direct.yourdomain.com`, **并且** 同时还满足 `目标 = 223.5.5.5` 时,`Xray` 才会将流量转发给 `[direct-out]` 直连出站】
+In other words, this rule means: **[Xray will only forward traffic to `[direct-out]` when the target = `direct.yourdomain.com` **AND** at the same time the target = `223.5.5.5`]**.
-很显然,一个目标不可能同时等于两个不同的值,所以这不但是一个永远不可能实现的无效规则,更与原本的目标风马牛不相及。
+Obviously, a target cannot equal two different values at the same time. So this is not only an invalid rule that can never be realized, but it also has nothing to do with the original goal.
-### 7.2 正确示范
+### 7.2 Correct Example
-正确示范,自然就是将不同的匹配依据独立出来:
+The correct example is naturally to separate the different matching criteria:
```json
{
@@ -339,78 +339,78 @@
}
```
-其实,第 6 点已经是我整理过的规则了,原则就是【相同的匹配依据可以合并,不同的匹配依据保持独立】。
+In fact, point 6 was already my organized rules. The principle is **[Identical matching criteria can be merged, different matching criteria must remain independent]**.
-## 8. 明修栈道、暗渡陈仓
+## 8. The Secret Passage
-> `[domain]` 转化 `[ip]` 的密道:`domainStrategy`
+> The secret path from `[domain]` to `[ip]`: `domainStrategy`
-我们在 5.4 中提交了多种流量判断的【依据】,其中一种是域名 `[domain]`、一种是 `[IP]`。
+In section 5.4, we presented various **[criteria]** for traffic judgment. One is domain `[domain]`, and another is `[IP]`.
-如果你初步了解过 DNS 的运作过程,就会知道,我们对一个域名 `[domain]` 发起访问请求时,其实需要先向 `DNS` 发起请求来解析域名 `[domain]` 对应的 `[IP]`,在得到 `[IP]` 后再向它发起实际请求。
+If you have a preliminary understanding of how DNS works, you know that when we initiate a request to a domain `[domain]`, we actually need to first initiate a request to `DNS` to resolve the `[IP]` corresponding to the domain `[domain]`, and then initiate the actual request to that `[IP]`.
-所以,面对入站的一次域名请求,`Xray` 其实有两次机会去判断它的类型。那么,究竟是否要用这两次机会呢?这就是由 `domainStrategy` 这个配置来决定的。它有三个选项:
+Therefore, facing an inbound domain request, `Xray` actually has two opportunities to judge its type. So, should we use these two opportunities? This is decided by the `domainStrategy` configuration. It has three options:
- `AsIs`
- `IPIfNonMatch`
- `IPOnDemand`
-按么我们逐个来解释一下:
+Let's explain them one by one:
-### 8.1 域名策略: `"AsIs"`
+### 8.1 Domain Strategy: `"AsIs"`
-就是 "As Domain Is",也就是说 【域名什么样,就什么样,不多折腾】。
+This means "As Domain Is", which implies **[Just let the domain be, don't fuss with it]**.
-简单粗暴理解就是说【仅用 `[domain]` 来匹配】。
+To understand it simply and crudely: **[Only use `[domain]` to match]**.
::: tip
-`AsIs` 的实际意义为 【如原先所示,不加修改】,🍉 老师这里描述的不是很恰当。
+The actual meaning of `AsIs` is "As shown in the original, without modification". Teacher Watermelon didn't describe it very precisely here.
:::
-这个方式的处理都在 `Xray` 内部完成,没有与外界的数据往来,所以速度最快。它的兜底策略也很清晰:即前面所说的、无法匹配的域名自动转入第一条出站处理。所以,对于常规使用路由功能这最推荐的策略。
+The processing of this method is completed within `Xray`, with no data exchange with the outside world, so it is the fastest. Its fallback strategy is also clear: that is, the unmatchable domains mentioned earlier are automatically transferred to the first outbound for processing. Therefore, this is the most recommended strategy for general routing usage.
-### 8.2 域名策略: `"IPIfNonMatch"`
+### 8.2 Domain Strategy: `"IPIfNonMatch"`
-就是 "lookup IP if (there's) no matching rule",也就是说【如果其他所有规则都匹配不上,那就转化成 `IP` 去匹配 `IP` 规则】。
+This means "lookup IP if (there's) no matching rule", which implies **[If no other rules match, then convert to `IP` to match `IP` rules]**.
-简单粗暴理解就是说【先把访问目标和其他所有类型规则匹配,如果匹配不上,那就通过 `DNS` 查询转化成 `IP`,再从头和所有规则匹配一次】。
+To understand it simply and crudely: **[First match the access target with all other types of rules. If there is no match, then convert it to `IP` via `DNS` query, and match it against all rules again from the beginning]**.
-该策略下没有命中任何规则的这一部分域名,会需要再经历 `DNS` 查询过程、以及第二轮规则匹配的过程,其耗时会多于 `AsIs` 策略,所以并不是首选推荐的策略。
+Under this strategy, domains that do not hit any rules need to go through the `DNS` query process and a second round of rule matching. It takes more time than the `AsIs` strategy, so it is not the preferred recommended strategy.
-### 8.3 域名策略: `"IPOnDemand"`
+### 8.3 Domain Strategy: `"IPOnDemand"`
-这里其实说 `Demand IP` 更准确些,也就是说【当匹配时碰到任何基于 IP 的规则,将域名立即解析为 IP 进行匹配】。
+It is actually more accurate to say `Demand IP` here, which implies **[When matching, if any IP-based rule is encountered, immediately resolve the domain to IP for matching]**.
-简单粗暴理解就是说【只要路由规则中有 `IP` 类规则,那么所有基于域名 `[domain]` 的请求都要解析成 `[IP]` 然后去匹配 `[IP]` 类规则】。
+To understand it simply and crudely: **[As long as there are `IP` type rules in the routing rules, then all requests based on domain `[domain]` must be resolved into `[IP]` and then matched against `[IP]` type rules]**.
-它要对所有首次域名访问进行 `DNS` 解析,所以首次查询比较耗时。虽然由于 `Xray` 中 `DNS` 缓存机制的存在,后续对相同域名的访问速度会重回巅峰,但总体来说也不是首选推荐的策略。
+It requires `DNS` resolution for all initial domain accesses, so the first query is relatively time-consuming. Although due to the existence of the `DNS` caching mechanism in `Xray`, subsequent access speeds to the same domain will return to peak performance, generally speaking, it is not the preferred recommended strategy either.
-::: warning 啰嗦君
-`domainStrategy` 仅对域名生效,不要搞混了哦~
+::: warning Mr. Wordy
+`domainStrategy` only takes effect for domains, don't get mixed up~
:::
-## 9. 思考题
+## 9. Thought Exercises
-迄今为止,我们都是在【单入站】和【单出站】的基础上,讲解【路由】内部的各种配置逻辑。
+So far, we have been explaining the various configuration logics within **[Routing]** based on **[Single Inbound]** and **[Single Outbound]**.
-但是,如你所知,`Xray` 本身是支持多端口,多协议的。那么,如果我问你:
+However, as you know, `Xray` itself supports multiple ports and multiple protocols. So, if I ask you:
-1. 我希望 `VLESS` 协议将我日常的网页浏览和 APP 流量转发给美国的大流量服务器
-2. 我希望 `trojan` 协议将我的所有 Netflix 流量转发给日本的服务器解锁各种二次元
-3. 我希望 `shadowsocks` 协议将我所有的游戏流量转发给香港的服务器达到最低的延迟
-4. 我希望有一个独立的端口,能够把 `telegram` 的流量全都转发给 VPS
-5. 我希望有一个独立的端口,能够把 `bittorrent` 下载流量全都转发给欧洲大盘鸡
-6. 我希望......
+1. I want the `VLESS` protocol to forward my daily web browsing and App traffic to a high-traffic server in the US.
+2. I want the `trojan` protocol to forward all my Netflix traffic to a server in Japan to unlock various anime content.
+3. I want the `shadowsocks` protocol to forward all my gaming traffic to a server in Hong Kong to achieve the lowest latency.
+4. I want an independent port to forward all `telegram` traffic to the VPS.
+5. I want an independent port to forward all `bittorrent` download traffic to a "Big Disk Chicken" (Server with large storage) in Europe.
+6. I want......
-这些想法,是否能通过【路由】功能配置实现呢?
+Can these ideas be realized through **[Routing]** configuration?
-答案当然是 **【完全可以】** 啦! 但是这些对于 `level-1` 来说已经超纲了,就留给各位自由的探索吧!
+The answer is, of course, **[Absolutely!]** But these are already beyond the scope of `level-1`, so I'll leave them for you to explore freely!
-## 10. 结语
+## 10. Conclusion
-至此,`Xray` 的【路由】功能就介绍完了。希望本文能够对你理解 `Xray` 的灵活有所帮助。
+This concludes the introduction to `Xray`'s **[Routing]** function. I hope this article helps you understand the flexibility of `Xray`.
-## 11. 尾注
+## 11. Endnotes
-- 现在你可以重新阅读一遍 [路由](../../config/routing.md),看看是否有更加深刻的理解。
+- Now you can read the [Routing](../../config/routing.md) documentation again to see if you have a deeper understanding.
- 🍉🍉🍉🍉🍉 :D
diff --git a/docs/en/document/level-1/routing-with-dns.md b/docs/en/document/level-1/routing-with-dns.md
new file mode 100644
index 00000000..d1fadf7d
--- /dev/null
+++ b/docs/en/document/level-1/routing-with-dns.md
@@ -0,0 +1,286 @@
+# Achieving Precise Domestic/Foreign Traffic Splitting via DNS
+
+## Conventional Splitting Methods and Their Flaws
+
+When you try to manually craft proxy rules, you inevitably ask yourself: Which traffic should go through the proxy, and which should go directly?
+
+The answer is usually a Blacklist or Whitelist.
+
+Over the past decade, the community has maintained massive rule lists, giving birth to many excellent projects:
+
+-
+-
+-
+
+However, it is impossible for them to cover every website; they suffer from lag and cannot be 100% trusted.
+
+Here are a few examples:
+
+- `geosite:cn` is a hodgepodge. Anything remotely related to China gets thrown in. Even if a domain is blocked by the GFW, it might not be removed in time.
+ If you rely solely on whether the target domain is in this list to decide on direct connection, it won't work perfectly. For example, `ai.ytimg.com` and `login.corp.google.com` remain in the list despite being blocked.
+- The [README](https://github.com/Loyalsoldier/v2ray-rules-dat) of `v2ray-rules-dat` states: Apple, Microsoft, and Google CN domains exist in both `geosite:cn` and `geosite:geolocation-!cn`. But in reality, this is not always the case. (See: [PR#328](https://github.com/Loyalsoldier/v2ray-rules-dat/pull/328))
+- What if the domain isn't in any list?
+
+This undoubtedly causes trouble for traffic splitting. If your rules aren't updated in time, traffic that should go directly might be proxied, or some websites might not open at all.
+
+What if an unknown domain has a server in China and you want to connect directly as much as possible, but after all your efforts, you encounter the legendary [DNS Leak](https://github.com/XTLS/BBS/issues/3#issuecomment-3505661189)?
+
+So, is there a way to achieve 99.99% secure and precise traffic splitting?
+
+The answer is: **Absolutely.**
+
+## Achieving Precise Splitting with Xray-core DNS Module
+
+By making reasonable use of Xray's ~~wheelchair-like~~ powerful built-in DNS features—such as Fallbacks, ECS (EDNS Client Subnet), IP filtering, and Tagging—and carefully adjusting their order, you can obtain a much more accurate and real-time routing condition than `geosite cn/!cn`: the IP address. This works because IP geolocation, especially CN geolocation, changes much less frequently than domain lists.
+
+Before reading further, you need to fully read and understand the "Beginner Skills: Analysis of the Routing Feature [Part 1](./routing-lv1-part1.md) & [Part 2](./routing-lv1-part2.md)".
+At the same time, you should have practically memorized the official configuration guide. You must fully understand the functions of `domainStrategy` in routing/outbounds, `sniffing` options in inbounds, and the behaviors produced by their different combinations.
+
+Ready? Please try to understand the following paragraph:
+
+When using **socks/http inbounds**, the request is a domain name. When it reaches the **Routing** module, a `domainStrategy` other than `AsIs` can use the built-in DNS to resolve an IP specifically for routing matching. When the traffic reaches a local **direct outbound**, a `domainStrategy` other than `AsIs` in the outbound can use the built-in DNS to resolve the IP again for the actual connection. The request sent to the Xray Server (remote) contains only the domain name; which IP is actually accessed depends on the server's direct outbound.
+
+The situation becomes more complex with **Transparent Proxy**. If inbound `sniffing` is enabled and `destOverride` includes `[http, tls]`:
+
+- If `routeOnly = false`, the requested IP will be wiped, and the subsequent flow acts just like a socks inbound.
+- If `routeOnly = true`, both the domain and IP are available. When reaching the **Routing** module, it can match against both domain and IP rules directly. The local **direct outbound** will also use this IP. The request sent to the Xray Server contains only the IP. How does the server handle it? It repeats the process described above.
+
+Having trouble? You need to re-read the official guide and try to understand it. Otherwise, it will be difficult for you to utilize the resolution results of the DNS module in the examples below for correct traffic splitting.
+
+---
+
+#### Example 1: This configuration resolves precise, CDN-friendly IP addresses. It guarantees no DNS Leaks while ensuring that if a domain has a server in China, it is prioritized. This is highly suitable for realIp transparent proxy scenarios
+
+```json
+{
+ "dns": {
+ "servers": [
+ // Prevent Google CAPTCHA issues and prevent Google China from being monitored (since many 3rd party sites load Google Fonts, etc.)
+ {
+ "address": "1.1.1.1",
+ "skipFallback": true,
+ "domains": ["geosite:google", "geosite:google-cn"]
+ },
+ {
+ "address": "8.8.8.8",
+ "skipFallback": true,
+ "domains": ["geosite:google", "geosite:google-cn"],
+ "finalQuery": true // Terminate the query chain
+ },
+ // Resolve domains considered by the community to be in China via Direct connection.
+ // If the result is not as expected, it might be blocked or have left China.
+ // Resolve via Proxy for fallback in case it is blocked or left China.
+ {
+ "tag": "dns-direct",
+ "address": "114.114.114.114",
+ "skipFallback": true,
+ "domains": ["geosite:cn"],
+ "expectIPs": ["geoip:cn"]
+ },
+ {
+ "tag": "dns-direct",
+ "address": "223.5.5.5",
+ "skipFallback": true,
+ "domains": ["geosite:cn"],
+ "expectIPs": ["geoip:cn"]
+ },
+ {
+ "address": "1.1.1.1",
+ "skipFallback": true,
+ "domains": ["geosite:cn"]
+ },
+ {
+ "address": "8.8.8.8",
+ "skipFallback": true,
+ "domains": ["geosite:cn"],
+ "finalQuery": true // Terminate the query chain
+ },
+ // Resolve domains considered non-Chinese via Proxy.
+ // If the result is not as expected, attempt optimized direct connection.
+ {
+ "address": "1.1.1.1",
+ "skipFallback": true,
+ "domains": ["geosite:geolocation-!cn"],
+ "expectIPs": ["geoip:!cn"]
+ },
+ {
+ "address": "8.8.8.8",
+ "skipFallback": true,
+ "domains": ["geosite:geolocation-!cn"],
+ "expectIPs": ["geoip:!cn"]
+ },
+ {
+ "address": "8.8.8.8",
+ "clientIp": "222.85.85.85", // Provide your local ISP IP to get direct-connection optimized A/AAAA records
+ // e.g., if you are Henan Telecom, use a Henan Telecom DNS (pun intended / example)
+ // Cannot guarantee 100% China CDN friendliness as not all authoritative servers support ECS
+ "skipFallback": true,
+ "domains": ["geosite:geolocation-!cn"]
+ },
+ {
+ "address": "8.8.4.4",
+ "clientIp": "222.85.85.85", // Same as above
+ "skipFallback": true,
+ "domains": ["geosite:geolocation-!cn"],
+ "finalQuery": true // Terminate the query chain
+ // You might wonder: Are these 4 rules redundant with the 4 above? Can they be simplified?
+ // Actually no, this is for extreme speed and because some authoritative DNS do not support ECS.
+ },
+ // Unknown domains, prioritize China. If unexpected, attempt optimized proxy.
+ {
+ "address": "8.8.8.8",
+ "clientIp": "222.85.85.85", // Same as above
+ "expectIPs": ["geoip:cn"]
+ },
+ {
+ "address": "8.8.4.4",
+ "clientIp": "222.85.85.85", // Same as above
+ "expectIPs": ["geoip:cn"]
+ },
+ "1.1.1.1",
+ "8.8.8.8"
+ ],
+ "tag": "dns-proxy",
+ "enableParallelQuery": true // Intelligent parallel query: All parallel, smart grouping, race within group
+ },
+ "routing": {
+ "domainStrategy": "Depends entirely on your needs",
+ "rules": [
+ {
+ // Routing for DNS queries themselves
+ "inboundTag": ["dns-direct"],
+ "outboundTag": "direct"
+ },
+ {
+ // Routing for DNS queries themselves
+ "inboundTag": ["dns-proxy"],
+ "outboundTag": "proxy"
+ }
+ // Your personalized routing rules
+ // For media unlocking, use domain routing. For domestic/foreign splitting, ALWAYS use IP routing.
+ ]
+ }
+ // Others ignored, configure as needed...
+}
+```
+
+```mermaid
+graph TD
+ A[Receive DNS Query] --> B{Domain Classification};
+
+ B -->|geosite:google
Google Domains| C["Query via Proxy
Foreign DNS (1.1.1.1...)"];
+ C --> C_OUT[Likely returns Foreign IP];
+ C_OUT --> Z[End Query];
+
+ B -->|geosite:cn
Known/Suspected CN Domains| D["Query via Direct
Domestic DNS (114, AliDNS)"];
+ D --> E{Result is CN IP?};
+ E -->|"Yes (Expected)"| F_OUT[Return CN IP];
+ F_OUT --> Z;
+ E -->|"No (Polluted/Wrong/Left CN)"| G["Fallback: Query via Proxy
Foreign DNS (1.1.1.1...)"];
+ G --> G_OUT[Return correct Foreign IP];
+ G_OUT --> Z;
+
+ B -->|geosite:geolocation-!cn
Known/Suspected Foreign| I["Query via Proxy
Foreign DNS (1.1.1.1...)"];
+ I --> J{Result is Foreign IP?};
+ J -->|"Yes (Expected)"| K_OUT[Return Foreign IP];
+ K_OUT --> Z;
+ J -->|"No (Unexpectedly CN IP / Wrong)"| L["Fallback: Query via Proxy+ECS
Foreign DNS (8.8.8.8...)"];
+ L --> L_OUT[Return optimized CN IP];
+ L_OUT --> Z;
+
+ B -->|Unknown Domains| N["Query via Proxy+ECS
Foreign DNS (8.8.8.8...)
Expect CN IP"];
+ N --> O{Result is CN IP?};
+ O -->|"Yes (Has CN Server)"| P_OUT[Return CN IP];
+ P_OUT --> Z;
+ O -->|"No (Pure Foreign Site)"| Q["Fallback: Query via Proxy
Foreign DNS (1.1.1.1...)"];
+ Q --> Q_OUT[Return optimized Foreign IP];
+ Q_OUT --> Z;
+```
+
+You can route traffic based on the IP resolved by this configuration combined with the domain name, or rely entirely on the IP.
+
+In a realIp transparent proxy environment, you can even ensure that after hijacking DNS from various channels, you set `domainStrategy=AsIs` and `routeOnly=true` to achieve a process with no secondary DNS resolution throughout.
+
+> Note: The "CDN-friendly" mentioned above regarding the foreign part is optimized for the location of your **proxy server**. If you are only proxying blacklisted sites rather than all foreign traffic, you need to adjust the ECS in the rules yourself.
+
+#### Example 2: This configuration resolves correct but not necessarily foreign-CDN-friendly addresses. It guarantees no DNS Leaks while prioritizing China servers if they exist. It is suitable for fakeIp transparent proxy, socks, and http inbound scenarios
+
+```json
+{
+ "dns": {
+ "servers": [
+ // Prevent Google CAPTCHA issues, prevent Google China monitoring
+ {
+ "address": "1.1.1.1",
+ "skipFallback": true,
+ "domains": ["geosite:google", "geosite:google-cn"],
+ "finalQuery": true // Terminate query chain
+ },
+ {
+ // We don't fully trust geosite:cn, but if a domain is in this list,
+ // we try resolving it first. If it returns a China IP, it means it's not blocked.
+ // Conversely, if not, it's highly likely blocked. Fallback to 8.8.8.8 to resolve again, solving potential DNS pollution.
+ // We prioritize this because the cost is minimal; direct connection takes only ~10ms.
+ "tag": "dns-direct",
+ "address": "223.5.5.5",
+ "skipFallback": true,
+ "domains": ["geosite:cn"],
+ "expectIPs": ["geoip:cn"]
+ },
+ {
+ // If a domain is not in geosite:cn, or fell back from the rule above, use this server.
+ // Here we use ECS to try and get China A/AAAA records.
+ "address": "8.8.8.8",
+ "clientIp": "222.85.85.85", // Provide local ISP IP to get direct-connection optimized A/AAAA records
+ // e.g., if you are Henan Telecom, use a Henan Telecom DNS
+ // Cannot guarantee 100% China CDN friendliness as not all authoritative servers support ECS
+ "skipFallback": false
+ }
+ ],
+ "tag": "dns-proxy"
+ },
+ "routing": {
+ "domainStrategy": "Must be NON-AsIs, depends on your needs",
+ "rules": [
+ {
+ // Routing for DNS queries themselves
+ "inboundTag": ["dns-direct"],
+ "outboundTag": "direct"
+ },
+ {
+ // Routing for DNS queries themselves
+ "inboundTag": ["dns-proxy"],
+ "outboundTag": "proxy"
+ }
+ // Your personalized routing rules
+ // For media unlocking, use domain routing. For domestic/foreign splitting, ALWAYS use IP routing.
+ ]
+ }
+ // Others ignored, configure as needed...
+}
+```
+
+In this scenario, since all requests sent to the Xray Server are domain names, there is no need to use DNS to repeatedly probe for the optimal result. We only need to quickly identify if the domain is polluted and resolve a Chinese CDN-friendly IP as much as possible.
+
+The China IP resolved by the DNS module in this example is already 99% China CDN friendly. Therefore, you can set `domainStrategy` in the direct outbound to **non-AsIs** to utilize the cache if you wish.
+
+If you pursue 100% China CDN friendliness, you can set it to `AsIs` to use the OS configured DNS to resolve it again. This adds about 1ms to hundreds of ms of latency; it is recommended to enable optimistic caching to further reduce latency.
+
+## Postscript
+
+It is known that many unscrupulous domestic Apps probe your overseas exit IP and correlate it with your sensitive information such as GPS location, phone number, and food delivery address, leaking it to social engineering databases. ~~Big brother is watching u!!!~~
+
+Some people mistakenly believe this is caused by traffic splitting and that simply switching to Blacklist mode (only proxying blocked sites) will avoid it.
+In reality, this is not the case. First, blacklists are very easy to poison; they can intentionally create bait websites and submit them to the list to probe your overseas IP.
+
+Secondly, as long as any website in the blacklist is hosted on Cloudflare, they don't even need bait. Just try accessing: `https://chatgpt.com/cdn-cgi/trace`
+
+Clever as you are, you might think: "Can't I just find another public proxy to layer on top?" The premise is that you must completely trust that this proxy keeps no logs and won't sell you out, and that it is heavily used by people in your country. If an overseas IP is correlated with thousands of people per unit of time, it is impossible to trace back to you via that IP. As for the annoying CAPTCHAs that come with such "dirty IPs," you just have to deal with them.
+
+Doesn't the cyber-philanthropist Cloudflare's Warp fit all these characteristics perfectly? Unfortunately, for websites hosted on CF, Warp cannot completely hide your IP; it is only effective for non-CF servers.
+
+Can Tor do it? It's not suitable for daily use. The IPs are too dirty, and the exit nodes jump frequently, causing many websites to ban your accounts.
+
+Therefore, unless the client you use can split traffic by App (which is only possible on mobile phones and computers), any other method of wall-crossing will lead to your overseas IP leaking.
+
+In short, for conventional wall-crossing methods, overseas IP leakage is almost inevitable. If you need high-level privacy protection, please use tools like Tor. Xray-core, as an anti-censorship tool, focuses on resisting blocking to help you cross the firewall, and its capabilities in privacy protection are very limited.
diff --git a/docs/en/document/level-1/work.md b/docs/en/document/level-1/work.md
index fce778e9..def7ee54 100644
--- a/docs/en/document/level-1/work.md
+++ b/docs/en/document/level-1/work.md
@@ -1,37 +1,37 @@
-# Xray 的工作模式
+# Xray Working Modes
-## 单服务器模式
+## Single Server Mode
-与其它的网络代理工具一样,你需要一台配置了 Xray 的服务器,然后在自己的设备上安装并配置 Xray 客户端,然后即可流畅地访问互联网。
+Like other network proxy tools, you need a server configured with Xray. Then, install and configure the Xray client on your device to access the Internet smoothly.
```mermaid
graph LR;
-A(PC) -.- B(防火墙);
-B -.-> C(墙外网站);
+A(PC) -.- B(Firewall);
+B -.-> C(Foreign Websites);
A --> D(Xray/VPS);
D --> C;
-A --> E(墙内网站);
+A --> E(Domestic Websites);
```
-一个 Xray 服务器可同时支持多台设备使用不同的代理协议访问。同时,经过合理的配置,Xray 可以识别并区分需要代理以及不需要代理的流量,直连的流量不需要绕路。
+A single Xray server can support multiple devices accessing via different proxy protocols simultaneously. Meanwhile, with reasonable configuration, Xray can identify and distinguish traffic that needs proxying from traffic that doesn't; direct traffic does not need to take a detour.
-## 桥接模式
+## Bridge Mode
-如果你不想在每一台设备上都配置路由,你也可以设置一台中转服务器,用于接收客户端发来的所有流量,然后在服务器中进行转发判断。
+If you don't want to configure routing on every single device, you can set up a relay (transit) server. This server receives all traffic sent from clients and then makes forwarding decisions within the server itself.
```mermaid
graph LR;
-A(PC) -.-> B(防火墙);
-B -.-> C(墙外网站);
-A --> D(墙内 VPS);
-D --> E(墙外 VPS);
+A(PC) -.-> B(Firewall);
+B -.-> C(Foreign Websites);
+A --> D(Domestic VPS);
+D --> E(Foreign VPS);
E --> C;
-D --> F(墙内网站);
+D --> F(Domestic Websites);
```
-## 工作原理
+## Working Principle
-在配置 Xray 之前,不妨先来看一下 Xray 的工作原理,以下是单个 Xray 进程的内部结构示意图。多个 Xray 之间相互独立,互不影响。
+Before configuring Xray, it is helpful to look at how Xray works. The following is a schematic diagram of the internal structure of a single Xray process. Multiple Xray instances are independent of each other and do not affect one another.
```mermaid
graph LR;
@@ -45,10 +45,10 @@ D --> B3(outbound);
D --> B4(outbound);
```
-- 需要配置至少一个入站连接(Inbound)和一个出站连接(Outbound)才可以正常工作。
- - 入站连接负责与客户端(如浏览器)通信:
- - 入站连接通常可以配置用户认证,如 ID 和密码等;
- - 入站连接收到数据之后,会交给分发器(Dispatcher)进行分发;
- - 出站连接负责将数据发给服务器,如另一台主机上的 Xray。
-- 当有多个出站连接时,可以配置路由(Routing)来指定某一类流量由某一个出站连接发出。
- - 路由会在必要时查询 DNS 以获取更多信息来进行判断。
+- You need to configure at least one **Inbound** and one **Outbound** connection for it to work properly.
+ - **Inbound** connections are responsible for communicating with clients (such as browsers):
+ - Inbound connections can usually be configured with user authentication, such as IDs and passwords.
+ - After receiving data, the inbound connection hands it over to the **Dispatcher** for distribution.
+ - **Outbound** connections are responsible for sending data to the destination, such as Xray on another host.
+- When there are multiple outbound connections, you can configure **Routing** to specify that a certain category of traffic is sent via a specific outbound connection.
+ - The Router will query DNS when necessary to obtain more information for decision-making.
diff --git a/docs/en/document/level-2/index.md b/docs/en/document/level-2/index.md
index 5a364924..92a2b140 100644
--- a/docs/en/document/level-2/index.md
+++ b/docs/en/document/level-2/index.md
@@ -1,35 +1,35 @@
# Advanced Documentation
-**This chapter contains experience sharing of using Xray at an advanced level. If you are already familiar with Xray, the experience shared here can help you unleash the full power of Xray.**
+**This section contains advanced insights into using Xray. If you are already familiar with Xray, the experiences shared here will help you further unleash its full potential.**
-[Beginner's Guide to Transparent Proxies](./transparent_proxy/transparent_proxy.md) by
[@kirin](https://github.com/kirin10000)
+[Introduction to Transparent Proxy](./transparent_proxy/transparent_proxy.md) by
[@kirin](https://github.com/kirin10000)
-An Introduction to Transparent Proxies.
+An introductory chapter on Transparent Proxy.
-[TProxy Configuration Tutorial](./tproxy.md) by
[@BioniCosmos](https://github.com/BioniCosmos)
+[Transparent Proxy (TProxy) Configuration Tutorial](./tproxy.md) by
[@BioniCosmos](https://github.com/BioniCosmos)
-Complete tutorial on configuring transparent proxy (TProxy) based on Xray.
+A complete tutorial on configuring Transparent Proxy (TProxy) based on Xray.
[TProxy Transparent Proxy (IPv4 and IPv6) Configuration Tutorial](./tproxy_ipv4_and_ipv6.md) by
[@SQLimit](https://github.com/SQLimit)
-Xray-based TProxy Transparent Proxy (IPv4 and IPv6) Configuration Tutorial
+Configuration tutorial for Xray-based TProxy Transparent Proxy (IPv4 and IPv6).
-[Nginx_TLS Tunnel Hidden Fingerprint](./nginx_or_haproxy_tls_tunnel.md) by
[@SQLimit](https://github.com/SQLimit)
+[Using Nginx or HAProxy to Build TLS Tunnels to Hide Fingerprints](./nginx_or_haproxy_tls_tunnel.md) by
[@SQLimit](https://github.com/SQLimit)
-Use Nginx_TLS tunnel on both ends to hide the fingerprint.
+Using Nginx or HAProxy on both ends to build a TLS tunnel for fingerprint hiding.
-[[Transparent Proxy] Avoiding Xray Traffic Through gid](./iptables_gid.md) by
[@kirin](https://github.com/kirin10000)
+[[Transparent Proxy] Bypassing Xray Traffic via GID](./iptables_gid.md) by
[@kirin](https://github.com/kirin10000)
-A new way of bypassing Xray traffic in transparent proxy implemented by iptables/nftables.
+A new method to bypass Xray traffic in transparent proxies implemented via iptables/nftables.
-[Redirect Specific Traffic to Specific Gateway using Xray to Achieve Global Routing "Load Balancing"](./redirect.md) by
[@Zzz3m](https://github.com/Zzz3m)
+[Directing Specific Traffic to Specific Exits via Xray for Global Routing "Traffic Splitting"](./redirect.md) by
[@Zzz3m](https://github.com/Zzz3m)
-Play Xray to the fullest: Implement "load balancing" based on fwmark or sendThrough.
+Getting creative with Xray: Achieving "traffic splitting" based on fwmark, sendThrough, or sockopt.interface.
-[Enhancing Proxy Security with Cloudflare Warp](./warp.md) by
[@yuhan6665](https://github.com/yuhan6665)
+[Enhancing Proxy Security via Cloudflare Warp](./warp.md) by
[@yuhan6665](https://github.com/yuhan6665)
-Introduction to using WireGuard for outbound traffic added in Xray v1.6.5.
+Introduction to the use of the WireGuard outbound added in Xray v1.6.5.
[Xray Traffic Statistics](./traffic_stats.md) by
[@yuhan6665](https://github.com/yuhan6665)
-Adapt traffic statistics and scripts compatible with Xray.
+Traffic statistics and scripts adapted for Xray.
diff --git a/docs/en/document/level-2/iptables_gid.md b/docs/en/document/level-2/iptables_gid.md
index 0bc73d10..f8fdb2ca 100644
--- a/docs/en/document/level-2/iptables_gid.md
+++ b/docs/en/document/level-2/iptables_gid.md
@@ -1,98 +1,97 @@
---
-title: Transparent proxy via GID
+title: GID Transparent Proxy
---
-# Transparent proxy to circumvent Xray traffic via GID
+# Transparent Proxy: Bypassing Xray Traffic via GID
-In the existing transparent proxy configuration(**[New V2Ray vernacular tutorial on transparent proxy](https://guide.v2fly.org/app/transparent_proxy.html)** 、 **[New V2Ray vernacular tutorial on transparent proxy (TProxy)](https://guide.v2fly.org/app/tproxy.html)** 、 **[Transparent proxy(TProxy)configuration tutorial](./tproxy.md)**)tutorials, the circumvention of Xray traffic is achieved by using mark. That is, mark outbound traffics and set up iptables rules which directly connect traffics corresponding to the mark, to circumvent the Xray traffic and prevent loop back.
+In existing `iptables` transparent proxy guides (**[New V2Ray Plain English Guide - Transparent Proxy](https://guide.v2fly.org/app/transparent_proxy.html)**, **[New V2Ray Plain English Guide - Transparent Proxy (TPROXY)](https://guide.v2fly.org/app/tproxy.html)**, **[Transparent Proxy (TProxy) Configuration Tutorial](./tproxy)**), the method used to bypass Xray traffic (to prevent routing loops) involves marking packets (`mark`). Specifically, marks are applied to Xray's outbound traffic, and `iptables` rules are set to direct traffic with corresponding marks to go out directly, thus bypassing the Xray proxy process.
-There are several problems with this method:
+There are several issues with this approach:
-1. **[Inexplicable traffic into PREROUTING chain](https://github.com/v2ray/v2ray-core/issues/2621)**
+1. **[Unexplained traffic entering the PREROUTING chain](https://github.com/v2ray/v2ray-core/issues/2621)**.
+2. Android systems have their own marking mechanism, making this solution unusable on Android.
-2. Android has its own mark mechanism and this solution is not available on Android
+The solution in this tutorial does not require setting marks. Theoretically, it offers higher performance and avoids the issues mentioned above.
-The solution in this tutorial does not require a mark setting and has a higher theoretical performance, as well as not having the problems mentioned above.
+## Concept
-## Ideas
+TProxy traffic can only be received by the root user (`uid==0`) or other users with `CAP_NET_ADMIN` privileges.
-TProxy traffic can only be received by users with root privileges (uid==0) or other users with CAP_NET_ADMIN privileges.
+`iptables` rules can route traffic based on UID (User ID) and GID (Group ID).
-The iptables rules can separate network traffic by uid (user id) and gid (user group id).
-Let Xray run on a user with uid==0 but gid!=0. Set the iptables rule to not proxy traffic for that gid to circumvent Xray traffic.
+By running Xray as a user with `uid==0` but `gid!=0`, we can set `iptables` rules to exclude traffic from that specific GID, thereby bypassing Xray traffic.
-## Configuration Procedure
+## Configuration Process
-### 1. Preliminary preparation
+### 1. Prerequisites
-**Android**
+**Android System**
-1. System has root privilege.
+1. System must be rooted.
+2. Install **[busybox](https://play.google.com/store/apps/details?id=stericson.busybox)**.
+3. Have a terminal capable of executing commands, such as `adb shell`, `termux`, etc.
-2. Install **[busybox](https://play.google.com/store/apps/details?id=stericson.busybox)**
+**Other Linux Systems**
-3. There is a terminal that can execute commands, you can use adb shell, termux etc.
+Requires dependencies: `sudo`, `iptables-mod-tproxy`, and `iptables-mod-extra`.
-**Other Linux system**
-
-Need sudo, iptables-tproxy module and iptables-extra module。
-
-Usually the system comes with these functions. If you are using openwrt, you will need to run the following command:
+Most systems come with these built-in. For OpenWrt, run:
```bash
opkg install sudo iptables-mod-tproxy iptables-mod-extra
```
-Also attached are some common dependencies for openwrt, the lack of which may prevent Xray from running
+Here are some common dependencies for OpenWrt. Missing them might prevent Xray from running:
```bash
opkg install libopenssl ca-certificates
```
-### 2. Add user (Android users please ignore this section)
+### 2. Add User (Skip for Android users)
-Android does not support managing users by modifying the /etc/passwd file, please ignore it and go straight to the next step.
+Android systems do not support managing users via the `/etc/passwd` file, so please ignore this and proceed to the next step.
```bash
grep -qw xray_tproxy /etc/passwd || echo "xray_tproxy:x:0:23333:::" >> /etc/passwd
```
-where xray_tproxy is the username, 0 is the uid and 23333 is the gid, the username and gid can be set by yourself, the uid must be 0.
-To check if the user was added successfully, run
+Here, `xray_tproxy` is the username, `0` is the UID, and `23333` is the GID. The username and GID can be customized, but the UID must be 0.
+To check if the user was added successfully, run:
```bash
sudo -u xray_tproxy id
```
-The result displayed should be uid 0 and gid 23333.
+The displayed result should show UID as 0 and GID as 23333.
-### 3. Configure and run Xray, and configure iptables rules
+### 3. Configure/Run Xray and Set iptables Rules
-In the existing transparent proxy configuration(**[New V2Ray vernacular tutorial on transparent proxy](https://guide.v2fly.org/app/transparent_proxy.html)** 、 **[New V2Ray vernacular tutorial on transparent proxy (TProxy)](https://guide.v2fly.org/app/tproxy.html)** 、 **[Transparent proxy(TProxy)configuration tutorial](./tproxy.md)**)tutorials, modify:
+Modify based on the existing `iptables` transparent proxy guides (**[New V2Ray Plain English Guide - Transparent Proxy](https://guide.v2fly.org/app/transparent_proxy.html)**, **[New V2Ray Plain English Guide - Transparent Proxy (TPROXY)](https://guide.v2fly.org/app/tproxy.html)**, **[Transparent Proxy (TProxy) Configuration Tutorial](./tproxy)**):
-1. Modify the json configuration file: remove mark-related content
+1. Modify the JSON configuration file to delete content related to `mark`.
+2. Modify `iptables` rules to delete content related to `mark`, and add the option `-m owner ! --gid-owner 23333` to the rule applied in the OUTPUT chain.
-2. Modify the iptables rule to remove the mark-related content and add the option at the OUTPUT chain application rule: `-m owner ! --gid-owner 23333`
+For example:
-e.g.:
+```bash
+iptables -t mangle -A OUTPUT -j XRAY_SELF
+```
-`iptables -t mangle -A OUTPUT -j XRAY_SELF`
+Change to:
-Change to
+```bash
+iptables -t mangle -A OUTPUT -m owner ! --gid-owner 23333 -j XRAY_SELF
+```
-`iptables -t mangle -A OUTPUT -m owner ! --gid-owner 23333 -j XRAY_SELF`
+1. Modify the way Xray is run so that it runs as a user with `uid=0` and `gid=23333`. Refer to [this section](#_3-configure-max-open-files-run-xray-client).
-1. Modify the way you run Xray so that it runs on a user with uid 0 and gid 23333, refer to [here](#_3-configure-and-run-xray-and-configure-iptables-rules).
+## Below is a complete configuration process for implementing global TProxy
-## Steps
+### 1. Complete the Prerequisites and User Addition steps above
-The following provides a complete configuration process for implementing the tproxy global proxy
+### 2. Prepare Xray Configuration File
-### 1. Finish **[Preliminary preparation](#_1-preliminary-preparation)** and **[Add user](#_2-add-user-android-users-please-ignore-this-section)**
-
-### 2. Preparing Xray profiles
-
-Configure Xray to listen to 12345 at dokodemo-door, turn on followRedirect and tproxy, no sniffing required:
+Configure Xray `dokodemo-door` to listen on port 12345, enable `followRedirect` and `tproxy`. Setting `sniffing` is not required:
```json
{
@@ -113,60 +112,60 @@ Configure Xray to listen to 12345 at dokodemo-door, turn on followRedirect and t
],
"outbounds": [
{
- // Your server configuration
+ Your Server Configuration
}
]
}
```
-### 3. Configuring the maximum number of open files and run the Xray client
+### 3. Configure Max Open Files & Run Xray Client
-About the maximum number of open files, see: **[too many open files issues](https://guide.v2fly.org/app/tproxy.html#解决-too-many-open-files-问题)**
+For issues regarding the maximum number of open files, see: **[Too many open files issue](https://guide.v2fly.org/app/tproxy.html#解决-too-many-open-files-问题)**.
-The current Xray server installed with the official script has the maximum number of open files automatically configured, so no further changes are required.
+Currently, Xray servers installed using the official script automatically configure the maximum open file limit, so no further modification is needed.
-**Android**
+**Android System**
```bash
ulimit -SHn 1000000
setuidgid 0:23333 "Command to run Xray"&
```
-**Other Linux system**
+**Other Linux Systems**
```bash
ulimit -SHn 1000000
sudo -u xray_tproxy "Command to run Xray"&
```
-e.g.:
+For example:
```bash
ulimit -SHn 1000000
sudo -u xray_tproxy xray -c /etc/xray/config.json &
```
-_The first command:_
+*First command:*
-Change the maximum number of open files, valid only for the current terminal and to be run every time before starting Xray, this command is to set the maximum number of open files for the client.
+Changes the maximum number of open files. It is only effective for the current terminal and must be run every time before starting Xray. This command sets the maximum file limit for the client.
-_The second command:_
+*Second command:*
-Run the Xray client as a user with uid 0 and gid not 0, followed by & for running in the background.
+Runs the Xray client as a user with `uid=0` and a non-zero `gid`. The `&` at the end indicates running in the background.
-**Check if the maximum number of open files is set successfully**
+**Check if Max Open Files was set successfully**
```bash
-cat /proc/"Xray's pid"/limits
+cat /proc/PID_OF_XRAY/limits
```
-Find max open files, which should be the value you set. Xray's pid can be obtained by running `ps` or `ps -aux` or `ps -a`
+Find the `max open files` item; it should match the value you set. You can get the PID by running `ps`, `ps -aux`, `ps -a`, or `pidof xray`.
-Both the server and client side should be checked.
+Check both the server and the client.
-### 4. Setting up iptables rules
+### 4. Set iptables Rules
-**Proxy ipv4**
+**Proxy IPv4**
```bash
ip rule add fwmark 1 table 100
@@ -174,31 +173,40 @@ ip route add local 0.0.0.0/0 dev lo table 100
# Proxy LAN devices
iptables -t mangle -N XRAY
-# "ipv4 segment where the gateway is located" is obtained by running the command "ip address | grep -w inet | awk '{print $2}'", usually there are multiple
-iptables -t mangle -A XRAY -d "first ipv4 segment where the gateway is located" -j RETURN
-iptables -t mangle -A XRAY -d "second ipv4 segment where the gateway is located" -j RETURN
+# "Gateway IPv4 subnet" is obtained by running "ip address | grep -w inet | awk '{print $2}'". There are usually multiple.
+iptables -t mangle -A XRAY -d Gateway_IPv4_Subnet_1 -j RETURN
+iptables -t mangle -A XRAY -d Gateway_IPv4_Subnet_2 -j RETURN
+...
-# If the gateway is used as the primary router, add this line, see: [Other considerations for transparent proxy of iptables](https://xtls.github.io/en/documents/level-2/transparent_proxy/transparent_proxy/#proxy-ipv6)
-# The "gateway LAN_IPv4 address segment", obtained by running the command "ip address | grep -w "inet" | awk '{print $2}'", is one of the results
-iptables -t mangle -A XRAY ! -s "gateway LAN_IPv4 address segment" -j RETURN
+# Direct connection for Multicast/Class E/Broadcast addresses
+iptables -t mangle -A XRAY -d 224.0.0.0/3 -j RETURN
-# Mark 1 for TCP and forward to port 12345
-# mark can only be set to 1 for the traffic to be accepted by the Xray dokodemo-door
+
+# If the gateway serves as the main router, add this line.
+# See: [https://xtls.github.io/documents/level-2/transparent_proxy/transparent_proxy.md#iptables透明代理的其它注意事项](https://xtls.github.io/documents/level-2/transparent_proxy/transparent_proxy.md#iptables透明代理的其它注意事项)
+# Gateway_LAN_IPv4_Subnet is one of the results from "ip address | grep -w "inet" | awk '{print $2}'".
+iptables -t mangle -A XRAY ! -s Gateway_LAN_IPv4_Subnet -j RETURN
+
+# Mark TCP packets with 1, forward to port 12345
+# Traffic is accepted by Xray dokodemo-door only if mark is set to 1
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A XRAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
# Apply rules
iptables -t mangle -A PREROUTING -j XRAY
-# Proxy gateway itself
+# Proxy the Gateway itself
iptables -t mangle -N XRAY_MASK
-iptables -t mangle -A XRAY_MASK -d "the first ipv4 segment where the gateway is located" -j RETURN
-iptables -t mangle -A XRAY_MASK -d "the second ipv4 segment where the gateway is located" -j RETURN
-
+iptables -t mangle -A XRAY_MASK -m owner --gid-owner 23333 -j RETURN
+iptables -t mangle -A XRAY_MASK -d Gateway_IPv4_Subnet_1 -j RETURN
+iptables -t mangle -A XRAY_MASK -d Gateway_IPv4_Subnet_2 -j RETURN
+...
+iptables -t mangle -A XRAY_MASK -d 224.0.0.0/3 -j RETURN
iptables -t mangle -A XRAY_MASK -j MARK --set-mark 1
-iptables -t mangle -A OUTPUT -m owner ! --gid-owner 23333 ! -p icmp -j XRAY_MASK
+iptables -t mangle -A OUTPUT -p tcp -j XRAY_MASK
+iptables -t mangle -A OUTPUT -p udp -j XRAY_MASK
```
-**Proxy ipv6 (optional)**
+**Proxy IPv6 (Optional)**
```bash
ip -6 rule add fwmark 1 table 106
@@ -206,23 +214,27 @@ ip -6 route add local ::/0 dev lo table 106
# Proxy LAN devices
ip6tables -t mangle -N XRAY6
-# The "ipv6 segment where the gateway is located" is obtained by running the command "ip address | grep -w inet6 | awk '{print $2}'".
-ip6tables -t mangle -A XRAY6 -d "the first ipv6 segment where the gateway is located" -j RETURN
-ip6tables -t mangle -A XRAY6 -d "the second ipv6 segment where the gateway is located" -j RETURN
+# "Gateway IPv6 subnet" is obtained by running "ip address | grep -w inet6 | awk '{print $2}'".
+ip6tables -t mangle -A XRAY6 -d Gateway_IPv6_Subnet_1 -j RETURN
+ip6tables -t mangle -A XRAY6 -d Gateway_IPv6_Subnet_2 -j RETURN
+...
-# If the gateway is used as the primary router, add this line, see: [Other considerations for transparent proxy of iptables](https://xtls.github.io/en/documents/level-2/transparent_proxy/transparent_proxy/#proxy-ipv6)
-# The "gateway LAN_IPv6 address segment", obtained by running the command "ip address | grep -w "inet6" | awk '{print $2}'", is one of the results
-ip6tables -t mangle -A XRAY6 ! -s "gateway LAN_IPv6 address segment" -j RETURN
+# If the gateway serves as the main router, add this line.
+# See: [https://xtls.github.io/documents/level-2/transparent_proxy/transparent_proxy.md#iptables透明代理的其它注意事项](https://xtls.github.io/documents/level-2/transparent_proxy/transparent_proxy.md#iptables透明代理的其它注意事项)
+# Gateway_LAN_IPv6_Subnet is one of the results from "ip address | grep -w "inet6" | awk '{print $2}'".
+ip6tables -t mangle -A XRAY6 ! -s Gateway_LAN_IPv6_Subnet -j RETURN
ip6tables -t mangle -A XRAY6 -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
ip6tables -t mangle -A XRAY6 -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
ip6tables -t mangle -A PREROUTING -j XRAY6
-# Proxy gateway itself
+# Proxy the Gateway itself
ip6tables -t mangle -N XRAY6_MASK
-ip6tables -t mangle -A XRAY6_MASK -d "the first ipv6 segment where the gateway is located" -j RETURN
-ip6tables -t mangle -A XRAY6_MASK -d "the second ipv6 segment where the gateway is located" -j RETURN
-
+ip6tables -t mangle -A XRAY6_MASK -m owner --gid-owner 23333 -j RETURN
+ip6tables -t mangle -A XRAY6_MASK -d Gateway_IPv6_Subnet_1 -j RETURN
+ip6tables -t mangle -A XRAY6_MASK -d Gateway_IPv6_Subnet_2 -j RETURN
+...
ip6tables -t mangle -A XRAY6_MASK -j MARK --set-mark 1
-ip6tables -t mangle -A OUTPUT -m owner ! --gid-owner 23333 ! -p icmp -j XRAY6_MASK
+ip6tables -t mangle -A OUTPUT -p tcp -j XRAY6_MASK
+ip6tables -t mangle -A OUTPUT -p udp -j XRAY6_MASK
```
diff --git a/docs/en/document/level-2/nginx_or_haproxy_tls_tunnel.md b/docs/en/document/level-2/nginx_or_haproxy_tls_tunnel.md
index e03174d0..1edbb7a3 100644
--- a/docs/en/document/level-2/nginx_or_haproxy_tls_tunnel.md
+++ b/docs/en/document/level-2/nginx_or_haproxy_tls_tunnel.md
@@ -1,18 +1,18 @@
---
-title: Nginx 或 Haproxy 搭建 TLS 隧道隐藏指纹
+title: Using Nginx or HAProxy to Build TLS Tunnels to Hide Fingerprints
---
-Nginx 或 Haproxy 实现的 HTTPS 隧道、HTTP/2 over HTTPS 隧道、WebSocket over HTTP/2 over HTTPS 隧道、gRPC over HTTP/2 over HTTPS 隧道以及自签证书双端认证的 gRPC over HTTP/2 over HTTPS 隧道
+HTTPS tunnels, HTTP/2 over HTTPS tunnels, WebSocket over HTTP/2 over HTTPS tunnels, gRPC over HTTP/2 over HTTPS tunnels implemented via Nginx or HAProxy, and gRPC over HTTP/2 over HTTPS tunnels with self-signed certificate mutual authentication.
-# 客户端服务端 Nginx 构建 HTTPS 隧道隐藏指纹
+# Building HTTPS Tunnels with Nginx on Client & Server to Hide Fingerprints
-网路结构:
+Network Structure:
xray_client ---tcp--- nginx_client ---HTTPS--- nginx_sever ---tcp--- xray_server
-## 编译 nginx --with-stream
+## Compile Nginx --with-stream
-在客户端及服务端均编译
+Compile on both the client and the server.
`curl -O -L http://nginx.org/download/nginx-1.22.1.tar.gz`
@@ -20,45 +20,44 @@ xray_client ---tcp--- nginx_client ---HTTPS--- nginx_sever ---tcp--- xray_server
`cd nginx-1.22.1`
-`apt install gcc make` //编译依赖 gcc 以及 make
+`apt install gcc make` // Install compilation dependencies: gcc and make
-`./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-stream --with-stream_ssl_module` //此步需要依赖一些库,根据报错安装相应 lib
+`./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-stream --with-stream_ssl_module` // This step requires some libraries; install the corresponding libs based on any errors reported.
`make && make install`
-编译之后 nginx 文件夹位于 `/usr/local/nginx`
+After compilation, the nginx folder is located at `/usr/local/nginx`.
-## 配置 nginx
+## Configure Nginx
-编辑 nginx 配置文件 nginx.conf
+Edit the nginx configuration file `nginx.conf`.
`vim /usr/local/nginx/conf/nginx.conf`
-服务端加入如下配置
+Add the following configuration to the **Server**:
-服务器申请证书不再赘述,参考[白话文](../level-0/ch06-certificates.md)
+(I won't go into detail about applying for server certificates; refer to the [Plain Language Guide](../level-0/ch06-certificates.md)).
-```
+```nginx
stream {
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_protocols TLSv1.3;
- ssl_certificate /path/to/cert/domain.crt; # crt 文件位置
- ssl_certificate_key /path/to/cert/domain.key; # key 文件位置
- proxy_pass unix:/dev/shm/vless.sock; # 使用 domain socket
+ ssl_certificate /path/to/cert/domain.crt; # Location of crt file
+ ssl_certificate_key /path/to/cert/domain.key; # Location of key file
+ proxy_pass unix:/dev/shm/vless.sock; # Use domain socket
}
}
```
-::: warning 注意
-
-stream 部分与 http 模块并列,客户端可删除 http 部分,服务端可删除或搭建网页伪装回落
+::: warning Note
+The `stream` section is parallel to the `http` module. On the client side, you can delete the `http` section. On the server side, you can delete it or set up a web page fallback for camouflage.
:::
-客户端加入如下配置
+Add the following configuration to the **Client**:
-```
+```nginx
stream {
server {
listen 6666;
@@ -66,19 +65,19 @@ stream {
proxy_ssl on;
proxy_ssl_protocols TLSv1.3;
proxy_ssl_server_name on;
- proxy_ssl_name yourdomain.domain; # 服务器域名
- proxy_pass ip:443; # 服务器 ip 形如 proxy_pass 6.6.6.6:443; 或 proxy_pass [2401:0:0::1]:443;
+ proxy_ssl_name yourdomain.domain; # Server domain name
+ proxy_pass ip:443; # Server IP, e.g., proxy_pass 6.6.6.6:443; or proxy_pass [2401:0:0::1]:443;
}
}
```
-在 `/etc/systemd/system` 文件夹中创建 `nginx.service` 文件
+Create the `nginx.service` file in the `/etc/systemd/system` directory.
`vim /etc/systemd/system/nginx.service`
-写入如下
+Write the following:
-```
+```ini
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
@@ -96,13 +95,13 @@ PrivateTmp=true
WantedBy=multi-user.target
```
-加入开机自启
+Enable auto-start on boot:
`systemctl enable nginx`
-## xray 配置
+## Xray Configuration
-服务端 xray 配置
+**Server-side** Xray Configuration:
```json
{
@@ -138,7 +137,7 @@ WantedBy=multi-user.target
}
```
-客户端 xray 配置,此处以旁路由透明代理为例
+**Client-side** Xray Configuration (Taking transparent proxy on a side-router/gateway as an example):
```json
{
@@ -270,49 +269,49 @@ WantedBy=multi-user.target
}
```
-如果使用透明代理需要在 iptables 或 ip6tables 配置中加入
+If using transparent proxy, you need to add the following to the `iptables` or `ip6tables` configuration:
-```
-# 设置策略路由 v4
+```bash
+# Set policy routing v4
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
-# 设置策略路由 v6
+# Set policy routing v6
ip -6 rule add fwmark 1 table 106
ip -6 route add local ::/0 dev lo table 106
-# VPS IP 直连
+# VPS IP Direct Connection
iptables -t mangle -A XRAY_MASK -d VSP_IPv4/32 -j RETURN
ip6tables -t mangle -A XRAY6_MASK -d VPS_IPv6/128 -j RETURN
```
-## 客户端及服务端启动服务
+## Start Services on Client & Server
`systemctl restart xray`
`systemctl restart nginx`
-## 结束
+## Conclusion
-# 双端 Haproxy 构建 HTTPS 隧道隐藏指纹
+# Building HTTPS Tunnels with Dual-End HAProxy to Hide Fingerprints
-安装 Haproxy
+Install HAProxy:
-`pacman -Su haproxy` 或 `apt install haproxy`
+`pacman -Su haproxy` or `apt install haproxy`
-Haproxy 处理 ssl 需要 openssl 支持,检查 openssl 版本,必要时安装或更新
+HAProxy requires OpenSSL support to handle SSL. Check the OpenSSL version and install or update it if necessary.
-## HTTPS 隧道
+## HTTPS Tunnel
-前述 Nginx HTTPS 隧道 Hproxy 同样可以简单做到
+The Nginx HTTPS tunnel described above can also be easily achieved with HAProxy.
-网路结构:
+Network Structure:
xray_client ---tcp--- haproxy_client ---HTTPS--- haproxy_sever ---tcp--- xray_server
-### haproxy_client 配置 (运行前去掉注释)
+### haproxy_client Configuration (Uncomment before running)
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -322,7 +321,7 @@ global
group root
daemon
- # 隧道强制使用 TLS 1.3
+ # Force tunnel to use TLS 1.3
ssl-default-server-options ssl-min-ver TLSv1.3
defaults
@@ -333,17 +332,20 @@ defaults
timeout server 300s
frontend xray
- bind 127.0.0.1:6666 # 监听本机 6666 端口
+ bind 127.0.0.1:6666 # Listen on local port 6666
default_backend tunnel
backend tunnel
- server tunnel www.example.com:443 ssl verify none sni req.hdr(host) alpn h2,http/1.1
- # 域名或 IP 均可以,若填域名建议在 hosts 中指定 IP 降低解析时间;alpn 与服务器协商,服务器端为 alpn h2,http1.1 时,客户端指定为 h2 则隧道为 HTTP2 方式连接,指定为 http1.1 为 HTTP 方式,双端均写优先 h2
+ server tunnel [www.example.com:443](https://www.example.com:443) ssl verify none sni req.hdr(host) alpn h2,http/1.1
+ # Domain or IP are both fine. If using a domain, it's recommended to specify the IP in hosts to reduce resolution time.
+ # alpn negotiates with the server. If the server side is alpn h2,http1.1:
+ # Specifying h2 on the client means the tunnel connects via HTTP2.
+ # Specifying http1.1 means HTTP. It is recommended to prioritize h2 on both ends.
```
-### haproxy_server 配置 (运行前去掉注释)
+### haproxy_server Configuration (Uncomment before running)
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -353,7 +355,7 @@ global
group root
daemon
- # 指定安全套件并指定 ssl 版本最低 1.2 增加真实性
+ # Specify cipher suites and set minimum SSL version to 1.2 to increase authenticity
ssl-default-bind-ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256
ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
ssl-default-bind-options ssl-min-ver TLSv1.2
@@ -366,40 +368,40 @@ defaults
timeout server 300s
frontend tls-in
- bind :::443 ssl crt /path/to/pem alpn h2,http/1.1 # haproxy 使用 pem 进行 ssl 解密,pem 由 cat www.example.com.crt www.example.com.key > www.example.com.pem 获得
+ bind :::443 ssl crt /path/to/pem alpn h2,http/1.1 # haproxy uses pem for ssl decryption. pem is obtained by: cat [www.example.com](https://www.example.com).crt [www.example.com](https://www.example.com).key > [www.example.com](https://www.example.com).pem
default_backend xray
tcp-request inspect-delay 5s
tcp-request content accept if HTTP
use_backend web if HTTP
backend xray
- server xray /dev/shm/vless.sock # 支持 abstract 格式: "abns@vless.sock" ;loopback 方式:127.0.0.1:6666
+ server xray /dev/shm/vless.sock # Supports abstract format: "abns@vless.sock"; loopback method: 127.0.0.1:6666
backend web
- server web /dev/shm/h1h2c.sock # 回落到网页
+ server web /dev/shm/h1h2c.sock # Fallback to web page
```
-### xray 配置
+### Xray Configuration
-同上 nginx 部分:最简单的 TCP 配置,可搭配任意协议,建议使用 VLESS+TCP 无需多余加密,参考文档或其他示例
+Same as the Nginx section above: Simplest TCP configuration. It works with any protocol. It is recommended to use VLESS+TCP without extra encryption. Refer to the documentation or other examples.
## WebSocket over HTTP/2
-Haproxy 支持 HTTP/2 的 h2c 进站及出站
+HAProxy supports inbound and outbound HTTP/2 h2c.
-然而援引 xray 文档 HTTP/2 的说明
+However, quoting the Xray documentation on HTTP/2:
-“由 HTTP/2 的建议,客户端和服务器必须同时开启 TLS 才可以正常使用这个传输方式。...... 当前版本的 HTTP/2 的传输方式并不强制要求入站(服务端)有 TLS 配置。”
+"According to HTTP/2 recommendations, both the client and server must enable TLS to use this transport method normally... The current version of HTTP/2 transport does not enforce TLS configuration for inbound (server side)."
-即入站可以使用 h2c,出站并不支持 h2c。因此无法使用 xray_client ---h2c--- haproxy_client ---HTTP/2+TLS--- haproxy_sever ---h2c--- xray_server
+This means inbound can use h2c, but outbound does not support h2c. Therefore, you cannot use: `xray_client ---h2c--- haproxy_client ---HTTP/2+TLS--- haproxy_sever ---h2c--- xray_server`.
-但是可以通过 ws 偷个鸡,Haproxy 支持 ws over HTTP/2
+However, we can use a trick with WS (WebSocket). HAProxy supports WS over HTTP/2.
-则网络结构:xray_client ---ws--- haproxy_client ---ws over HTTP/2 over HTTPS--- haproxy_sever ---ws--- xray_server
+So the network structure is: `xray_client ---ws--- haproxy_client ---ws over HTTP/2 over HTTPS--- haproxy_sever ---ws--- xray_server`.
-### haproxy_client 配置
+### haproxy_client Configuration
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -409,9 +411,9 @@ global
group root
daemon
- # 调整 HTTP/2 的性能,当遇到 HTTP/2 性能问题时都可以设置相关项,更多设置见 Haproxy 文档 tune.h2 部分 https://docs.haproxy.org/2.7/configuration.html
- tune.h2.initial-window-size 536870912 # 初始窗口大小,建议设置,默认值 65536 单位 byte,此值在突发大流量情况下需要一定加载时间,建议根据网速调整
- tune.h2.max-concurrent-streams 512 # 复用线路数,可根据情况设置,默认值 100,一般不用设置(官方不建议改动)
+ # Adjust HTTP/2 performance. Set relevant items when encountering HTTP/2 performance issues. For more settings, see the tune.h2 section of the Haproxy documentation [https://docs.haproxy.org/2.7/configuration.html](https://docs.haproxy.org/2.7/configuration.html)
+ tune.h2.initial-window-size 536870912 # Initial window size. Recommended to set. Default is 65536 bytes. Larger values may require some load time during traffic bursts. Adjust based on network speed.
+ tune.h2.max-concurrent-streams 512 # Number of multiplexed streams. Set as needed. Default is 100. Generally no need to set (official recommendation is not to change).
ssl-default-server-options ssl-min-ver TLSv1.3
@@ -427,13 +429,13 @@ frontend xray
default_backend tunnel
backend tunnel
- server tunnel www.example.com:443 ssl verify none sni req.hdr(host) ws h2 alpn h2
+ server tunnel [www.example.com:443](https://www.example.com:443) ssl verify none sni req.hdr(host) ws h2 alpn h2
# ws over HTTP/2
```
-### haproxy_server 配置
+### haproxy_server Configuration
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -443,7 +445,7 @@ global
group root
daemon
- # 客户端配置即可,服务端配置也无妨
+ # Configured on client is enough, configuring on server is also fine
tune.h2.initial-window-size 536870912
tune.h2.max-concurrent-streams 512
@@ -465,7 +467,7 @@ frontend tls-in
use_backend server2 if { ssl_fc_alpn -i h2 } { path_beg /path2 }
use_backend server3 if { ssl_fc_alpn -i h2 } { path_beg /path3 }
default_backend web
- # haproxy 使用 http 模式可以根据 path 分流
+ # haproxy using http mode can route based on path
backend xray
server xray abns@vless.sock ws h1
@@ -483,19 +485,19 @@ backend web
server web /dev/shm/h1h2c.sock
```
-### xray 配置
+### Xray Configuration
-简单的 websocket 配置即可,无需 TLS, 配置见 xray 文档示例,配置 "path" 可以用于服务端 haproxy 分流(客户端有分流需求同样可以通过客户端 haproxy 进行,原理类似,参考服务端的 path 分流配置)
+A simple WebSocket configuration is sufficient. No TLS required. See Xray documentation examples. Configuration of "path" can be used for server-side HAProxy routing (if the client has routing needs, it can also be done via client-side HAProxy; the principle is similar, refer to the server-side path routing configuration).
## gRPC over HTTP/2
-虽然双端的 h2c 不行,但是 gRPC 不要求必须 TLS,直接冲
+Although dual-end h2c doesn't work, gRPC does not mandate TLS, so we can go straight ahead.
-网络结构:xray_client ---gRPC h2c--- haproxy_client ---gRPC over HTTP/2 over HTTPS--- haproxy_sever ---gRPC h2c--- xray_server
+Network Structure: `xray_client ---gRPC h2c--- haproxy_client ---gRPC over HTTP/2 over HTTPS--- haproxy_sever ---gRPC h2c--- xray_server`
-### haproxy_client 配置
+### haproxy_client Configuration
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -518,16 +520,16 @@ defaults
timeout server 300s
frontend xray
- bind 127.0.0.1:6666 proto h2 # 指定 proto h2 使用 h2c
+ bind 127.0.0.1:6666 proto h2 # Specify proto h2 to use h2c
default_backend tunnel
backend tunnel
- server tunnel www.example.com:443 ssl verify none sni req.hdr(host) alpn h2
+ server tunnel [www.example.com:443](https://www.example.com:443) ssl verify none sni req.hdr(host) alpn h2
```
-### haproxy_server 配置
+### haproxy_server Configuration
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -553,7 +555,7 @@ defaults
frontend tls-in
bind :::443 ssl crt /path/to/pem alpn h2,http/1.1
- use_backend xray if { ssl_fc_alpn -i h2 } { path_beg /tunnel } # xray gRPC 中配置的 "serviceName" 在 harpoxy 中可以使用 path 进行分流,为方便使用 "multiMode",使用 path_beg 参数匹配路径
+ use_backend xray if { ssl_fc_alpn -i h2 } { path_beg /tunnel } # The "serviceName" configured in xray gRPC can be used for routing in haproxy via path. For convenience when using "multiMode", use the path_beg parameter to match the path.
use_backend server1 if { ssl_fc_alpn -i h2 } { path_beg /path1 }
use_backend server2 if { ssl_fc_alpn -i h2 } { path_beg /path2 }
use_backend server3 if { ssl_fc_alpn -i h2 } { path_beg /path3 }
@@ -575,27 +577,27 @@ backend web
server web /dev/shm/h1h2c.sock
```
-### xray 配置
+### Xray Configuration
-简单的 gRPC 配置,无需 TLS,配置见文档,配置的 serviceName 可用于分流。
+Simple gRPC configuration, no TLS needed. See documentation for configuration. The configured `serviceName` can be used for routing.
-# Haproxy 使用自签证书进行双端认证(gRPC 示例)
+# HAProxy Using Self-Signed Certificates for Mutual Authentication (gRPC Example)
-这里使用自签证书双端认证加强隧道安全性(但会牺牲一点延迟,不过使用 gRPC 后感知不强),而服务端同时处理信任的证书和自签名证书,并据此分流伪装网站和隧道流量
+Here, we use self-signed certificates with mutual authentication (mTLS) to strengthen tunnel security (at the cost of a little latency, though not very noticeable with gRPC). The server handles both trusted certificates and self-signed certificates simultaneously, and routes traffic for the camouflage site and tunnel traffic accordingly.
-其中 www.example.com 为伪装站信任证书(如白话文中申请的证书)
+Where `www.example.com` is the trusted certificate for the camouflage site (like certificates applied for in the Plain Language Guide).
-tunnel.example.com 为自签证书网址,自签证书可以参考 https://learn.microsoft.com/zh-cn/azure/application-gateway/self-signed-certificates
+`tunnel.example.com` is the URL for the self-signed certificate. For self-signed certificates, refer to:
-根证书 ca.crt 服务器证书 server.crt 服务器密钥 server.key
+Root certificate: `ca.crt`; Server certificate: `server.crt`; Server key: `server.key`.
-至少需要生成一个 server.pem,客户端可以同样使用此证书用于双端认证;或者生成两个证书,一个 client,一个 server,用于双端认证
+You need to generate at least one `server.pem`. The client can use this same certificate for mutual authentication; or generate two certificates, one for client and one for server, for mutual authentication.
-需准备 fullchain.crt 用于认证( cat server.crt ca.crt > fullchain.crt ),server.pem ( cat server.crt server.key ca.crt > server.pem )用于解密
+Prepare `fullchain.crt` for verification (`cat server.crt ca.crt > fullchain.crt`) and `server.pem` (`cat server.crt server.key ca.crt > server.pem`) for decryption.
-### haproxy_client 配置
+### haproxy_client Configuration
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -623,12 +625,12 @@ frontend xray
backend tunnel
server tunnel tunnel.example.com:443 tfo allow-0rtt ssl crt /path/to/client.pem verify required ca-file /path/to/fullchain.crt sni str(tunnel.example.com) alpn h2
- # 网址自定义,和自签证书一致即可,hosts 中配置 IP 解析,sni 的 str 设定 sni,用于服务端识别
+ # The URL is custom, just keep it consistent with the self-signed certificate. Configure IP resolution in hosts. Set sni with `sni str()` for server-side identification.
```
-### haproxy_server 配置
+### haproxy_server Configuration
-```
+```haproxy
global
log /dev/log local0 alert
log /dev/log local1 alert
@@ -653,14 +655,14 @@ defaults
timeout server 300s
frontend tls-in
- bind :::443 tfo allow-0rtt ssl crt /path/to/server.pem verify optional ca-file /path/to/fullchain.crt crt /path/to/www.example.com.pem alpn h2,http/1.1
+ bind :::443 tfo allow-0rtt ssl crt /path/to/server.pem verify optional ca-file /path/to/fullchain.crt crt /path/to/[www.example.com](https://www.example.com).pem alpn h2,http/1.1
use_backend xray if { ssl_fc_sni tunnel.example.com } { ssl_c_used } { ssl_fc_alpn -i h2 } { path_beg /tunnel }
use_backend server1 if { ssl_fc_sni atunnel.example.com } { ssl_c_used } { ssl_fc_alpn -i h2 } { path_beg /path2 }
use_backend server2 if { ssl_fc_sni btunnel.example.com } { ssl_c_used } { ssl_fc_alpn -i h2 } { path_beg /path3 }
use_backend server3 if { ssl_fc_sni ctunnel.example.com } { ssl_c_used } { ssl_fc_alpn -i h2 } { path_beg /path4 }
default_backend web
- # Haproxy 支持多个 pem 解密
- # 可根据多个客户端的不同 sni 分流,也可以 path 分流,方式多样,更多 acl 见 Haproxy 文档
+ # Haproxy supports multiple pem decryptions
+ # Can route based on different client SNIs, or based on path. Various methods available. See Haproxy docs for more ACLs.
backend xray
server xray abns@vless.sock proto h2
@@ -678,6 +680,6 @@ backend web
server web /dev/shm/h1h2c.sock
```
-### xray 配置
+### Xray Configuration
-简单的 gRPC 配置,无需 TLS,配置见文档,配置的 serviceName 可用于分流。
+Simple gRPC configuration, no TLS needed. See documentation for configuration. The configured `serviceName` can be used for routing.
diff --git a/docs/en/document/level-2/redirect.md b/docs/en/document/level-2/redirect.md
index cbcf5966..b9fd378c 100644
--- a/docs/en/document/level-2/redirect.md
+++ b/docs/en/document/level-2/redirect.md
@@ -1,146 +1,100 @@
---
-title: 出站流量重定向
+title: Outbound Traffic Redirection
---
-# 基于 fwmark 或 sendThrough 的流量重定向
+# Traffic Redirection Based on fwmark or sendThrough
-通过 Xray 将特定的流量指向特定出口,实现全局路由“分流”
+Direct specific traffic to specific exits via Xray to achieve global routing "traffic splitting".
-## 前言
+## Foreword
-之前在网络上看到许多代理或者 VPN 会接管全局路由,如果与 Xray 同时安装,会导致 Xray 失效。参考了网络上许多教程,及时分流,也是通过维护一张或者多张 CIDR
-路由表来实现的。这种情况下并不优雅,如果我想可以任意替换,实现按需分流,那有没有更好的办法呢?有!
+Previously, I noticed that many proxies or VPNs take over the global routing table. If installed alongside Xray, this causes Xray to fail. I referred to many tutorials online, and even immediate traffic splitting was achieved by maintaining one or more CIDR routing tables. This approach is not elegant. If I want to be able to replace interfaces arbitrarily and achieve on-demand splitting, is there a better way? Yes!
-通过 fwmark 或 Xray 的 sendThrough,再简单配合路由表功能即可实现:
+By using `fwmark` or Xray's `sendThrough`/`sockopt.interface`, combined simply with routing table functions, we can achieve:
-1. Xray 可设置指定的 Tag、域名等走指定接口。如果您的接口是双栈的,可以指定 IPV4 或者 IPV6
-2. 其余用户则走原 IPV4 或者 IPV6
+1. Xray can set specific Tags, domains, etc., to go through a specific interface. If your interface is dual-stack, you can specify IPv4 or IPv6.
+2. The rest of the users will use the original IPv4 or IPv6.
-具体设置如下(以 Debian10 为例):
+The specific settings are as follows (using Debian 10 as an example):
-## 1、安装代理或者 VPN 软件(例如 Wireguard、IPsec 等)
+## 1. Install Proxy or VPN Software (e.g., WireGuard, IPsec, etc.)
-根据不同系统和不同软件,请参考官方安装方法
+Please refer to the official installation methods for different systems and software.
-## 2、编辑 VPN 配置文件(以 WireGuard 为例)
+## 2. Edit VPN Configuration File (Using WireGuard as an example)
-原始文件:
-
-
-
-
+Original file:
```ini
[Interface]
-PrivateKey = xxxxxxxxxxxxxxxxxxxx
-Address = "your wg0 v4 address"
-Address = "your wg0 v6 address"
+PrivateKey =
+Address =
+Address =
DNS = 8.8.8.8
MTU = 1280
[Peer]
-PublicKey = xxxxxxxxxxxxxxxxxxxxx
+PublicKey =
AllowedIPs = ::/0
AllowedIPs = 0.0.0.0/0
-Endpoint = "ip:port"
+Endpoint = :
```
-在 `[Interface]` 下添加如下命令:
+Add the following commands under `[Interface]`:
```ini
-Table = off
-PostUP = ip -4 rule add fwmark lookup
-PostUP = ip -4 route add default dev <接口名称> table
-PostUP = ip -4 rule add table main suppress_prefixlength 0
+Table =
+### fwmark
+PostUP = ip rule add fwmark lookup
+PostDown = ip rule del fwmark lookup
PostUP = ip -6 rule add fwmark lookup
-PostUP = ip -6 rule add not fwmark table
-PostUP = ip -6 route add ::/0 dev <接口名称> table
-PostUP = ip -6 rule add table main suppress_prefixlength 0
-PostDown = ip -4 rule delete fwmark lookup
-PostDown = ip -4 rule delete table main suppress_prefixlength 0
-PostDown = ip -6 rule delete fwmark lookup
-PostDown = ip -6 rule delete not fwmark table
-PostDown = ip -6 rule delete table main suppress_prefixlength 0
+PostDown = ip -6 rule del fwmark lookup
+## sendThrough
+PreUp = ip rule add from lookup
+PostDown = ip rule del from lookup
+PreUp = ip -6 rule add from lookup
+PostDown = ip -6 rule del from lookup
+## sockopt.interface
+PreUp = ip rule add oif %i lookup
+PostDown = ip rule del oif %i lookup
+PreUp = ip -6 rule add oif %i lookup
+PostDown = ip -6 rule del oif %i lookup
```
::: tip
-- 此命令表示 IPv4 中 fwmark 为 ``,IPv6 中 fwmark 为``,::/0 全局 v6 走 WireGuard
-- 可根据自己需求增删命令,mark 值要与 Xray-core 中设置为相同,table 值自定
-- 如果不支持配置文件,可以在系统中修改路由表
+- This configuration integrates `fwmark` / `sendThrough` / `sockopt.interface`, meaning:
+- Connections sent to this device `%i` / Connections sent to this `` / Connections marked with `fwmark` ``
+- Will be forwarded using WireGuard.
+- `%i` is a placeholder in the WireGuard configuration file, which represents the device name to be replaced at startup.
:::
-
+Save it.
-
+You can also install this handy tool:
-```ini
-[Interface]
-PrivateKey = xxxxxxxxxxxxxxxxxxxx
-Address = "your wg0 v4 address"
-Address = "your wg0 v6 address"
-DNS = 8.8.8.8
-MTU = 1280
-[Peer]
-PublicKey = xxxxxxxxxxxxxxxxxxxxx
-AllowedIPs = ::/0
-AllowedIPs = 0.0.0.0/0
-Endpoint = "ip:port"
-```
-
-在 `[Interface]` 下添加如下命令:
-
-```ini
-Table = off
-PostUP = ip -4 rule add from "your wg0 v4 address" lookup
-PostUP = ip -4 route add default dev wg0 table
-PostUP = ip -4 rule add table main suppress_prefixlength 0
-PostUP = ip -6 rule add not fwmark table
-PostUP = ip -6 route add ::/0 dev wg0 table
-PostUP = ip -6 rule add table main suppress_prefixlength 0
-PostDown = ip -4 rule delete from "your wg0 v4 address" lookup
-PostDown = ip -4 rule delete table main suppress_prefixlength 0
-PostDown = ip -6 rule delete not fwmark table
-PostDown = ip -6 rule delete table main suppress_prefixlength 0
-```
-
-::: tip
-
-- 此命令表示 IPV4 中来自 `your wg0 v4 address` 地址的走 WireGuard,IPv6 中::/0 全局 v6 走 WireGuard)
-- 可根据自己需求增删命令,实现 v6 分流,也可以与 fwmark 融合
-- 如果不支持配置文件,可以在系统中修改路由表
- :::
-
-
-
-
-
-保存
-
-可顺手安装
+::: warning
+If the `DNS` field in `[Interface]` is used, this program is required.
+:::
```bash
apt install openresolv
```
-## 3、启用 WireGuard 网络接口
+## 3. Enable WireGuard Network Interface
-加载内核模块
+Load the kernel module:
```bash
modprobe wireguard
```
-检查 WG 模块加载是否正常
+Check if the WG module is loaded correctly:
```bash
lsmod | grep wireguard
```
-## 4、Xray-core 配置文件修改
-
-
-
-
+## 4. Xray-core Configuration Modification
```json
{
@@ -167,105 +121,48 @@ lsmod | grep wireguard
{
"protocol": "freedom",
"settings": {
- "domainStrategy": "UseIPv6"
- //设置默认用户走指定方式”UseIPv6”或者”UseIPv4”
+ "domainStrategy": "UseIPv4"
}
+ // Modify here, can be v4 or v6
},
+ // <--Please choose between different schemes--> Scheme 1: fwmark
{
"protocol": "freedom",
"tag": "wg0",
"streamSettings": {
"sockopt": {
- "mark":
+ "mark": //
}
},
"settings": {
"domainStrategy": "UseIPv6"
}
- //设置fwmark为的用户走指定方式”UseIPv6””UseIPv4”
- },
- {
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }
- ],
- "policy": {
- "system": {
- "statsInboundDownlink": true,
- "statsInboundUplink": true
- }
- },
- "routing": {
- "rules": [
- {
- "inboundTag": [
- "api"
- ],
- "outboundTag": "api"
- },
- {
- "outboundTag": "wg0",
- "inboundTag": [
- ""
- //需要之前在inbound中指定好Tag,我这里是api生成的,还可以添加域名等等
- ]
- },
- {
- "outboundTag": "blocked",
- "protocol": [
- "bittorrent"
- ]
- }
- ]
- },
- "stats": {}
-}
-```
-
-
-
-
-
-```json
-{
- "api": {
- "services": [
- "HandlerService",
- "LoggerService",
- "StatsService"
- ],
- "tag": "api"
- },
- "inbounds": [
- {
- "listen": "127.0.0.1",
- "port": ,
- "protocol": "dokodemo-door",
- "settings": {
- "address": "127.0.0.1"
- },
- "tag": "api"
- }
- ],
- "outbounds": [
- {
- "protocol": "freedom",
- "settings": {
- "domainStrategy": "UseIPv4"
- }
- //修改此处,可v4或者v6
- },
+ }, // Users with fwmark set to use the specified strategy "UseIPv6" or "UseIPv4"
+ // <--Please choose between different schemes--> Scheme 2: sendThrough
{
"tag": "wg0",
"protocol": "freedom",
"sendThrough": "your wg0 v4 address",
- //修改此处,可v4或者v6
+ // Modify here, can be v4 or v6
"settings": {
"domainStrategy": "UseIPv4"
}
- //修改此处,可v4或者v6
+ // Modify here, can be v4 or v6
},
+ // <--Please choose between different schemes--> Scheme 3: sockopt.interface
+ {
+ "tag": "wg0",
+ "protocol": "freedom",
+ "settings": {
+ "domainStrategy": "UseIPv4"
+ },
+ "streamSettings": {
+ "sockopt": {
+ "interface": "wg0"
+ }
+ }
+ },
+ // <--Please choose between different schemes--> End
{
"protocol": "blackhole",
"settings": {},
@@ -290,7 +187,7 @@ lsmod | grep wireguard
"outboundTag": "wg0",
"inboundTag": [
""
- //需要之前在 inbound 中指定好 Tag,我这里是 api 生成的,还可以添加域名等等
+ // Need to specify the Tag in inbound beforehand; here it's generated by api, domains can also be added, etc.
]
},
{
@@ -305,43 +202,43 @@ lsmod | grep wireguard
}
```
-
-
-
-
::: tip
-可以通过修改 "domainStrategy": "UseIPv6"来控制对应用户的访问方式 实测优先级要高于系统本身的 gai.config
+You can control the access method for corresponding users by modifying `"domainStrategy": "UseIPv6"`. Actual tests show priority is higher than the system's own `gai.config`.
:::
-## 5、系统设置配置
+## 5. System Settings Configuration
::: tip
-需要打开系统的 ip_forward
+You need to enable the system's `ip_forward`.
+`sysctl -w net.ipv4.ip_forward=1`
+`sysctl -w net.ipv6.conf.all.forwarding=1`
:::
-## 6、完成 WireGuard 相关设置
+## 6. Complete WireGuard Settings
-开启隧道
+Start the tunnel:
```bash
wg-quick up wg0
```
-开机自启
+Enable auto-start on boot:
```bash
systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0
```
-验证 IPv4/IPv6
+Verify IPv4/IPv6:
-> 自行验证 Google 搜索 myip
+> Run `curl ip-api.com -4/-6` on the proxy / Visit ip-api.com via browser
-## 后记
+## Postscript
-本文本意是可以避免的多余的流量浪费,将路由和分流的功能交给 Xray 处理。避免了维护路由表的繁琐工作。顺便技术提升 UP。
+The intention of this article is to avoid unnecessary waste of traffic by handing over the routing and splitting functions to Xray. This avoids the tedious work of maintaining routing tables. It also serves to level up your technical skills.
-## 感谢
+## Acknowledgments
-@Xray-core @V2ray-core @WireGuard @p3terx @w @Hiram @Luminous @Ln @JackChou
+[XTLS/Xray-core](https://github.com/XTLS/Xray-core); [v2fly/v2ray-core](https://github.com/v2fly/v2ray-core); [WireGuard](https://www.wireguard.com/); [@p3terx](https://p3terx.com/); @w; @Hiram; @Luminous; @Ln; @JackChou;
+
+
diff --git a/docs/en/document/level-2/tproxy.md b/docs/en/document/level-2/tproxy.md
index 8d1cf50f..fe526592 100644
--- a/docs/en/document/level-2/tproxy.md
+++ b/docs/en/document/level-2/tproxy.md
@@ -1,24 +1,24 @@
---
-title: TProxy 透明代理
+title: TProxy Transparent Proxy
---
-# 透明代理(TProxy)配置教程
+# Transparent Proxy (TProxy) Configuration Tutorial
-本配置基于[TProxy 透明代理的新 V2Ray 白话文教程](https://guide.v2fly.org/app/tproxy.html),加入了 Xray 的新特性,使用 VLESS + XTLS Vision 方案,并将旧教程中默认出站代理的分流方式改为默认出站直连,使用者请按照实际情况进行修改。
+This configuration is based on the [New V2Ray Plain Guide for Transparent Proxy (TProxy)](https://guide.v2fly.org/app/tproxy.html), adding new features from Xray. It utilizes the VLESS + XTLS Vision scheme. Unlike the old tutorial which defaulted to proxying outbound traffic, this configuration defaults to direct connection for outbound traffic. Users should adjust this according to their actual needs.
-本文中所有配置已在 Raspberry Pi 2B、Ubuntu 20.04 环境下测试成功,如在其它环境中使用请自行调整配置。
+All configurations in this article have been successfully tested on Raspberry Pi 2B and Ubuntu 20.04. If you are using a different environment, please adjust the configuration accordingly.
-## 开始之前
+## Before You Start
-请检查您的设备是否有可用的网络连接,且服务端已经配置成功,客户端已经安装完毕。
+Please check that your device has an active network connection, the server-side is successfully configured, and the client is installed.
-需注意的是,目前很多透明代理教程都会将 Linux 系统的 IP 转发打开,但这样会导致 Splice 性能下降。详情请参考[大案牍术破案纪实第三篇--我们是如何破解 Splice 性能下降甚至低于 Direct 之谜的](https://github.com/XTLS/Xray-core/discussions/59)。
+It is worth noting that many transparent proxy tutorials instruct you to enable IP Forwarding on Linux. However, doing so can degrade `Splice` performance. For details, please refer to [Detective Story Part 3: How we solved the mystery of Splice performance dropping even below Direct](https://github.com/XTLS/Xray-core/discussions/59).
-这里我想要补充的是,很多透明代理教程会使用 Netfilter 进行分流,使直连流量直接发出而不经过 Xray,这时必须开启 IP 转发;也有的教程,如本文,会将所有流量导入 Xray 之中,由 Xray 的路由模块进行分流,这时无需开启 IP 转发。
+I would like to add that many transparent proxy tutorials use Netfilter for traffic splitting (routing), allowing direct traffic to go out without passing through Xray. In that case, IP Forwarding must be enabled. However, some tutorials, like this one, direct *all* traffic into Xray, and the routing module within Xray handles the splitting. In this scenario, IP Forwarding does **not** need to be enabled.
-## Xray 配置
+## Xray Configuration
-为了更好的分流体验,请替换默认路由规则文件为 [Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat),否则 Xray-core 将无法加载本配置。
+For a better routing experience, please replace the default routing rule files with [Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat); otherwise, Xray-core will not be able to load this configuration.
```bash
sudo curl -oL /usr/local/share/xray/geoip.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
@@ -71,7 +71,7 @@ sudo curl -oL /usr/local/share/xray/geosite.dat https://github.com/Loyalsoldier/
"settings": {
"vnext": [
{
- "address": "服务端域名",
+ "address": "Server_Domain",
"port": 443,
"users": [
{
@@ -118,7 +118,7 @@ sudo curl -oL /usr/local/share/xray/geosite.dat https://github.com/Loyalsoldier/
],
"dns": {
"hosts": {
- "服务端域名": "服务端 IP"
+ "Server_Domain": "Server_IP"
},
"servers": [
{
@@ -168,26 +168,22 @@ sudo curl -oL /usr/local/share/xray/geosite.dat https://github.com/Loyalsoldier/
```
::: tip TIP
-本配置会劫持所有发往 53 端口的流量以解决 DNS 污染问题,所以客户端和本机的 DNS 服务器的地址可以随意配置。
+This configuration hijacks all traffic sent to port 53 to solve DNS pollution issues, so the DNS server addresses on the client and the local machine can be configured arbitrarily.
:::
-## 策略路由配置
+## Policy Routing Configuration
-```
-sudo ip route add local default dev lo table 100 # 添加路由表 100
-sudo ip rule add fwmark 1 table 100 # 为路由表 100 设定规则
+```bash
+sudo ip route add local default dev lo table 100 # Add routing table 100
+sudo ip rule add fwmark 1 table 100 # Set rules for routing table 100
```
-## Netfilter 配置
+## Netfilter Configuration
-::: warning 注意
-nftables 配置与 iptables 配置二选一,不可同时使用。
+::: warning Note
+Choose either **nftables** or **iptables** configuration. Do not use both simultaneously.
:::
-
-
-
-
```nftables
#!/usr/sbin/nft -f
@@ -226,15 +222,11 @@ table ip xray {
}
```
-::: tip 使用方法
+::: tip Usage
-将上述配置写入一个文件(如 `nft.conf`),之后将该文件赋予可执行权限,最后使用 root 权限执行该文件即可(`# ./nft.conf`)。
+Write the above configuration to a file (e.g., `nft.conf`), then give the file executable permissions, and finally execute the file with root privileges (`# ./nft.conf`).
:::
-
-
-
-
```bash
iptables -t mangle -N XRAY
iptables -t mangle -A XRAY -d 10.0.0.0/8 -j RETURN
@@ -270,21 +262,11 @@ iptables -t mangle -A XRAY_SELF -p udp -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -j XRAY_SELF
```
-
+After the configuration is complete, change the default gateway of other devices in the LAN to the IP of this device to bypass the firewall directly. After successfully testing on both other hosts and the local machine, you can proceed to the next step.
-
+## Persistence and Auto-start
-配置完成后,将局域网内其它设备的默认网关改为该设备 IP,就可以直接翻墙了。在其它主机和本机皆测试成功后,可进行下一步配置。
-
-## 配置永久化与开机自启
-
-
-
-
-
-
-
-首先将已经编辑好的 nftables 配置文件移动到 `/etc` 目录下,并重命名为 `nftables.conf`。然后编辑 `/lib/systemd/system/nftables.service`。
+First, move the edited `nftables` configuration file to the `/etc` directory and rename it to `nftables.conf`. Then edit `/lib/systemd/system/nftables.service`.
```ini
[Unit]
@@ -309,17 +291,13 @@ ExecStop=/usr/sbin/nft flush ruleset ; /usr/sbin/ip route del local default dev
WantedBy=sysinit.target
```
-最后 enable 即可。
+Finally, enable it.
-
+For persistence with `iptables`, it is recommended to install `iptables-persistent` directly.
-
+During the installation process, you will be prompted to "Save current IPv4 rules?". If you have already applied the iptables configuration to the system, select "Yes". If not, it doesn't matter; after installation, apply the configuration and then execute `netfilter-persistent save` (root privileges required).
-关于 iptables 的永久化,建议直接安装 `iptables-persistent`。
-
-安装过程中会提示你选择“是否保存配置”,如果已经将 iptables 配置写入系统,那么此时选择“是”即可;如果尚未写入也没有关系,安装完毕后将配置写入,然后执行 `netfilter-persistent save` 即可(需要 root 权限)。
-
-之后编辑 `/lib/systemd/system/netfilter-persistent.service`。
+After that, edit `/lib/systemd/system/netfilter-persistent.service`.
```ini
[Unit]
@@ -340,7 +318,3 @@ ExecStop=/usr/sbin/netfilter-persistent stop ; /usr/sbin/ip route flush dev lo t
[Install]
WantedBy=multi-user.target
```
-
-
-
-
diff --git a/docs/en/document/level-2/tproxy_ipv4_and_ipv6.md b/docs/en/document/level-2/tproxy_ipv4_and_ipv6.md
index b596b68e..f1973b9a 100644
--- a/docs/en/document/level-2/tproxy_ipv4_and_ipv6.md
+++ b/docs/en/document/level-2/tproxy_ipv4_and_ipv6.md
@@ -1,33 +1,33 @@
---
-title: TProxy 透明代理 (ipv4 and ipv6)
+title: TProxy Transparent Proxy (IPv4 and IPv6)
---
-# TProxy 透明代理(ipv4 and ipv6)配置教程
+# TProxy Transparent Proxy (IPv4 and IPv6) Configuration Tutorial
-本配置参考了[TProxy 透明代理的新 V2Ray 白话文教程](https://guide.v2fly.org/app/tproxy.html),[透明代理(TProxy)配置教程](https://xtls.github.io/document/level-2/tproxy.html#%E5%BC%80%E5%A7%8B%E4%B9%8B%E5%89%8D)以及[透明代理通过 gid 规避 Xray 流量](https://xtls.github.io/document/level-2/iptables_gid.html),加入了透明代理对 ipv6 的支持,并且使用 VLESS-TCP-XTLS-RPRX-Vision 方案对抗封锁 (推荐使用 1.7.2 及之后版本)。
+This configuration is based on the [New V2Ray Plain English Guide for TProxy Transparent Proxy](https://guide.v2fly.org/app/tproxy.html), the [Transparent Proxy (TProxy) Configuration Tutorial](https://xtls.github.io/document/level-2/tproxy.html#%E5%BC%80%E5%A7%8B%E4%B9%8B%E5%89%8D), and [Bypassing Xray Traffic via GID](https://xtls.github.io/document/level-2/iptables_gid.html). It adds support for IPv6 transparent proxying and utilizes the VLESS-TCP-XTLS-RPRX-Vision scheme to counter blocking (version 1.7.2 or later is recommended).
-关于 Xray 的配置并不是本文重点,使用者可依实际情况进行修改,具体可以参考[官方文档示例](https://github.com/XTLS/Xray-examples)或其他优秀示例 比如[@chika0801](https://github.com/chika0801/Xray-examples) 又如[@lxhao61](https://github.com/lxhao61/integrated-examples)。
+The configuration of Xray itself is not the main focus of this article. Users should modify it according to their actual situation. For specific details, please refer to the [official document examples](https://github.com/XTLS/Xray-examples) or other excellent examples such as [@chika0801](https://github.com/chika0801/Xray-examples) and [@lxhao61](https://github.com/lxhao61/integrated-examples).
-::: warning 注意
+::: warning Note
-若使用其他配置,你需要着重注意客户端配置中 `outbound` 中`tag` 为 `proxy` 的部分,其他部分不变
+If you use other configurations, you need to pay special attention to the part where the `tag` is `proxy` in the `outbound` section of the client configuration. Other parts remain unchanged.
-服务端配置也要同时改变
+The server configuration must also be changed accordingly.
:::
-此配置意在解决例如 Netflix 等默认使用 ipv6 连接的网站无法通过旁路由进行代理的问题,或对 ipv6 代理有需要。
+This configuration aims to solve the problem where websites that default to IPv6 connections, such as Netflix, cannot be proxied through a side router (gateway), or to satisfy the need for IPv6 proxying.
-本文网络结构为单臂旁路由
+The network structure in this article is a Single-Arm Router (Side Router).
-本文中所有配置已在 Arch Linux (Kernel: 6.0.10) 环境下测试成功,如在其它环境中同理
+All configurations in this article have been successfully tested in an Arch Linux (Kernel: 6.0.10) environment. The logic is the same for other environments.
-注意安装相应程序 `# sudo apt install iptables ip6tables` 或 `# sudo apt install nftables`。
+Note that you need to install the corresponding programs: `# sudo apt install iptables ip6tables` or `# sudo apt install nftables`.
-若旁路由未安装 xray 程序,可以手动下载相应 xray 程序如 [Xray-linux-64.zip](https://github.com/XTLS/Xray-core/releases/download/v1.7.0/Xray-linux-64.zip) ,然后复制 [install-release.sh](https://github.com/XTLS/Xray-install/blob/main/install-release.sh) 文件到旁路由,赋予可执行权限 `# chmod 700 install-release.sh`,然后使用 `# ./install-release.sh --local Xray-linux-64.zip` 根据提示进行本地安装。
+If the Xray program is not installed on the side router, you can manually download the corresponding Xray program, such as [Xray-linux-64.zip](https://github.com/XTLS/Xray-core/releases/download/v1.7.0/Xray-linux-64.zip), then copy the [install-release.sh](https://github.com/XTLS/Xray-install/blob/main/install-release.sh) file to the side router, grant executable permission `# chmod 700 install-release.sh`, and then use `# ./install-release.sh --local Xray-linux-64.zip` to perform a local installation according to the prompts.
-## Xray 配置
+## Xray Configuration
-### 客户端配置
+### Client Configuration
```json
{
@@ -49,8 +49,7 @@ title: TProxy 透明代理 (ipv4 and ipv6)
},
"streamSettings": {
"sockopt": {
- "tproxy": "tproxy",
- "mark": 255
+ "tproxy": "tproxy"
}
}
},
@@ -69,17 +68,19 @@ title: TProxy 透明代理 (ipv4 and ipv6)
],
"outbounds": [
{
- //此为默认outbound,路由(routing)模块若未匹配到任何规则,则默认走此 proxy 出口,如果你希望直连国内优先请将下面 direct 出口放到 outbound 第一,看不懂可忽略
+ // This is the default outbound. If the routing module does not match any rules,
+ // it defaults to this "proxy" exit. If you prefer direct connection for domestic traffic as priority,
+ // please move the "direct" outbound below to the first position in outbounds. Ignore if you don't understand.
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
- "address": "yourdomain.domain", //改为你自己的域名,直接填写ipv4或ipv6地址也可以
+ "address": "yourdomain.domain", // Change to your own domain. Direct IPv4 or IPv6 address is also acceptable.
"port": 443,
"users": [
{
- "id": "uuid", //填写uuid,可通过在终端中输入 xray uuid 生成;此处也支持任意字符串(https://xtls.github.io/config/inbounds/vless.html#clientobject)
+ "id": "uuid", // Fill in UUID. Can be generated by typing 'xray uuid' in terminal; Arbitrary strings are also supported ([https://xtls.github.io/config/inbounds/vless.html#clientobject](https://xtls.github.io/config/inbounds/vless.html#clientobject))
"encryption": "none",
"flow": "xtls-rprx-vision"
}
@@ -92,12 +93,12 @@ title: TProxy 透明代理 (ipv4 and ipv6)
"mark": 255
},
"network": "tcp",
- "security": "tls", //注意使用 xtls-rprx-vision 流控此处需为 tls
+ "security": "tls", // Note: must be tls when using xtls-rprx-vision flow
"tlsSettings": {
- //注意使用 xtls-rprx-vision 流控此处需为 tlsSettings
+ // Note: must be tlsSettings when using xtls-rprx-vision flow
"allowInsecure": false,
- "serverName": "yourdomain.domain", //改为你自己的域名
- "fingerprint": "chrome" //此设置建议先看下Release, https://github.com/XTLS/Xray-core/releases/tag/v1.7.3
+ "serverName": "yourdomain.domain", // Change to your own domain
+ "fingerprint": "chrome" // Recommended to check Release notes for this setting: [https://github.com/XTLS/Xray-core/releases/tag/v1.7.3](https://github.com/XTLS/Xray-core/releases/tag/v1.7.3)
}
}
},
@@ -136,16 +137,16 @@ title: TProxy 透明代理 (ipv4 and ipv6)
"hosts": {
"domain:googleapis.cn": "googleapis.com",
"dns.google": "8.8.8.8",
- "你的VPS域名": "你的VSP IP" //如果 outbound 的 proxy 里 address 填的域名:希望代理走ipv4,这里 VPS IP 填VPS的ipv4, 希望代理走ipv6,这里VPS IP 填VPS的ipv6;outbound 的 proxy 里 address 填的 IP,这行不用写。
+ "Your_VPS_Domain": "Your_VPS_IP" // If 'address' in outbound proxy is a domain: fill VPS IPv4 if you want proxy via IPv4, fill VPS IPv6 if via IPv6; If 'address' is an IP, skip this line.
},
"servers": [
- "https://1.1.1.1/dns-query",
+ "[https://1.1.1.1/dns-query](https://1.1.1.1/dns-query)",
{
"address": "119.29.29.29",
"domains": ["geosite:cn"],
"expectIPs": ["geoip:cn"]
},
- "https://dns.google/dns-query",
+ "[https://dns.google/dns-query](https://dns.google/dns-query)",
"223.5.5.5",
"localhost"
]
@@ -179,7 +180,7 @@ title: TProxy 透明代理 (ipv4 and ipv6)
"outboundTag": "direct"
},
{
- "ip": ["geoip:private", "geoip:cn"], //此处可加入 VPS IP 避免 ssh 时被代理
+ "ip": ["geoip:private", "geoip:cn"], // Can add VPS IP here to avoid proxying SSH connections
"outboundTag": "direct"
},
{
@@ -203,7 +204,7 @@ title: TProxy 透明代理 (ipv4 and ipv6)
}
```
-### 服务端配置
+### Server Configuration
```json
{
@@ -214,7 +215,7 @@ title: TProxy 透明代理 (ipv4 and ipv6)
"domainStrategy": "IPIfNonMatch",
"rules": [
{
- //阻止 cnip 提高安全性,或者可以将 cn 流量导入 warp 中,详见https://xtls.github.io/document/level-2/warp.html
+ // Block CN IP to improve security, or you can route CN traffic into Warp, see [https://xtls.github.io/document/level-2/warp.html](https://xtls.github.io/document/level-2/warp.html)
"ip": ["geoip:cn"],
"outboundTag": "block"
}
@@ -227,14 +228,14 @@ title: TProxy 透明代理 (ipv4 and ipv6)
"settings": {
"clients": [
{
- "id": "uuid", //与客户端相同
+ "id": "uuid", // Same as client
"flow": "xtls-rprx-vision"
}
],
"decryption": "none",
"fallbacks": [
{
- "dest": 8080 //回落,需要 web 配合,参见白话文,不设置也行
+ "dest": 8080 // Fallback, requires web server cooperation, see the plain English guide. Optional.
}
]
},
@@ -245,7 +246,7 @@ title: TProxy 透明代理 (ipv4 and ipv6)
"certificates": [
{
"certificateFile": "/etc/ssl/private/fullchain.crt",
- "keyFile": "/etc/ssl/private/crt.key" //参照小小白话文将生成的 fullchain.crt 以及 cert.key证书的路径相应填于此处(https://xtls.github.io/document/level-0/ch06-certificates.html#_6-4-%E6%AD%A3%E5%BC%8F%E8%AF%81%E4%B9%A6%E7%94%B3%E8%AF%B7)
+ "keyFile": "/etc/ssl/private/crt.key" // Refer to the Beginner's Guide to fill in the path of the generated fullchain.crt and cert.key here ([https://xtls.github.io/document/level-0/ch06-certificates.html#_6-4-%E6%AD%A3%E5%BC%8F%E8%AF%81%E4%B9%A6%E7%94%B3%E8%AF%B7](https://xtls.github.io/document/level-0/ch06-certificates.html#_6-4-%E6%AD%A3%E5%BC%8F%E8%AF%81%E4%B9%A6%E7%94%B3%E8%AF%B7))
}
]
}
@@ -269,36 +270,38 @@ title: TProxy 透明代理 (ipv4 and ipv6)
}
```
-## Netfilter 配置
+## Netfilter Configuration
-### 首先设置策略路由
+### First, Set Policy Routing
```bash
-# 设置策略路由 v4
+# Set policy routing v4
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
-# 设置策略路由 v6
+# Set policy routing v6
ip -6 rule add fwmark 1 table 106
ip -6 route add local ::/0 dev lo table 106
-# 直连从主路由发出
-ip route add default via 192.168.31.1 #写主路由 ipv4, 采用局域网设备上网设置方法一可不写此命令
-ip -6 route add default via fd00:6868:6868::1 #写主路由 ipv6, 采用局域网设备上网设置方法一可不写此命令
+# Direct connection goes out from the main router
+ip route add default via 192.168.31.1 # Write main router IPv4. Not needed if using Method 1 for LAN devices.
+ip -6 route add default via fd00:6868:6868::1 # Write main router IPv6. Not needed if using Method 1 for LAN devices.
```
-::: tip 使用方法
+::: tip Usage
-直接将命令复制到旁路由终端执行
+Copy the commands directly to the side router terminal and execute them.
:::
-::: tip 关于直连从主路由发出
+::: tip About "Direct connection goes out from the main router"
-在旁路由使用命令`ip route show`,如果使用下属方法一,则`default via`后应是主路由 ip,无需更改;如使用下述方法二,则`default via`后应是旁路由 ip,此时直连网站 DNS 解析会回环,造成直连网站无法访问,因此需指定为主路由 ip。
+Run the command `ip route show` on the side router.
+If you use **Method 1** below, the `default via` should be the main router's IP, and no change is needed.
+If you use **Method 2** below, the `default via` would be the side router's IP. In this case, DNS resolution for direct connections will loop back, causing direct websites to be inaccessible, so it must be specified as the main router's IP.
:::
-如果是在路由器上指定了默认网关为旁路由(亦即下述“局域网设备上网设置方法二”),那么就需要设置上述 `# 直连从主路由发出` ,除了通过 iproute2 命令行方式设置,也可以通过 dhcpcd 或者 systemctl-network 设置静态 IP,这里以 dhcpcd 为例,编辑 `/etc/dhcpcd.conf` 文件,在最下方加入如下配置,具体 IP 根据你的实际情况修改,其中 `interface` 可以通过 `# ip link show` 查看要设定的网口或者无线设备。
+If you specified the default gateway as the side router on the main router (i.e., "LAN Device Internet Setup Method 2" below), then you need to set the above `# Direct connection goes out from the main router`. besides setting it via `iproute2` command line, you can also set a static IP via `dhcpcd` or `systemctl-network`. Here we take `dhcpcd` as an example. Edit the `/etc/dhcpcd.conf` file and add the following configuration at the bottom. Modify the specific IP according to your actual situation. The `interface` can be viewed via `# ip link show` to see the network port or wireless device to be configured.
```
interface enp0s25
@@ -308,19 +311,19 @@ static routers=192.168.31.1
static domain_name_servers=192.168.31.1 fd00:6868:6868::1
```
-这样通过静态 IP 设置 IP 及网关后就无需每次开机设置 `# 直连从主路由发出`。
+By setting the IP and gateway via static IP this way, there is no need to set `# Direct connection goes out from the main router` every time you boot.
-::: warning 注意
+::: warning Note
-以下 nftables 配置与 iptables 配置二选一,不可同时使用。
+Choose **either** the following nftables configuration **or** iptables configuration. Do not use both simultaneously.
:::
-### 使用 iptables
+### Using iptables
-此处配置将 ipv4 与 ipv6 写在同一文件中。
+This configuration writes IPv4 and IPv6 into the same file.
```bash
-# 代理局域网设备 v4
+# Proxy LAN devices v4
iptables -t mangle -N XRAY
iptables -t mangle -A XRAY -d 127.0.0.1/32 -j RETURN
iptables -t mangle -A XRAY -d 224.0.0.0/4 -j RETURN
@@ -332,7 +335,7 @@ iptables -t mangle -A XRAY -p udp -j TPROXY --on-ip 127.0.0.1 --on-port 12345 --
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-ip 127.0.0.1 --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j XRAY
-# 代理局域网设备 v6
+# Proxy LAN devices v6
ip6tables -t mangle -N XRAY6
ip6tables -t mangle -A XRAY6 -d ::1/128 -j RETURN
ip6tables -t mangle -A XRAY6 -d fe80::/10 -j RETURN
@@ -343,7 +346,7 @@ ip6tables -t mangle -A XRAY6 -p udp -j TPROXY --on-ip ::1 --on-port 12345 --tpro
ip6tables -t mangle -A XRAY6 -p tcp -j TPROXY --on-ip ::1 --on-port 12345 --tproxy-mark 1
ip6tables -t mangle -A PREROUTING -j XRAY6
-# 代理网关本机 v4
+# Proxy Gateway Itself v4
iptables -t mangle -N XRAY_MASK
iptables -t mangle -A XRAY_MASK -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY_MASK -d 255.255.255.255/32 -j RETURN
@@ -354,7 +357,7 @@ iptables -t mangle -A XRAY_MASK -p udp -j MARK --set-mark 1
iptables -t mangle -A XRAY_MASK -p tcp -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -j XRAY_MASK
-# 代理网关本机 v6
+# Proxy Gateway Itself v6
ip6tables -t mangle -N XRAY6_MASK
ip6tables -t mangle -A XRAY6_MASK -d fe80::/10 -j RETURN
ip6tables -t mangle -A XRAY6_MASK -d fd00::/8 -p tcp -j RETURN
@@ -364,13 +367,13 @@ ip6tables -t mangle -A XRAY6_MASK -p udp -j MARK --set-mark 1
ip6tables -t mangle -A XRAY6_MASK -p tcp -j MARK --set-mark 1
ip6tables -t mangle -A OUTPUT -j XRAY6_MASK
-# 新建 DIVERT 规则,避免已有连接的包二次通过 TPROXY,理论上有一定的性能提升 v4
+# Create DIVERT rule to avoid packet re-traversal through TPROXY for existing connections, theoretical performance boost v4
iptables -t mangle -N DIVERT
iptables -t mangle -A DIVERT -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
iptables -t mangle -I PREROUTING -p tcp -m socket -j DIVERT
-# 新建 DIVERT 规则,避免已有连接的包二次通过 TPROXY,理论上有一定的性能提升 v6
+# Create DIVERT rule to avoid packet re-traversal through TPROXY for existing connections, theoretical performance boost v6
ip6tables -t mangle -N DIVERT
ip6tables -t mangle -A DIVERT -j MARK --set-mark 1
ip6tables -t mangle -A DIVERT -j ACCEPT
@@ -378,16 +381,16 @@ ip6tables -t mangle -I PREROUTING -p tcp -m socket -j DIVERT
```
-::: tip 使用方法
+::: tip Usage
-将上述配置写入一个文件(如 `iptables.rules`),之后将该文件赋予可执行权限`# chmod 700 ./iptables.rules`
+Write the above configuration into a file (e.g., `iptables.rules`), then grant executable permission to the file: `# chmod 700 ./iptables.rules`.
-最后使用 root 权限执行该文件即可:`# ./iptables.rules`或`# source iptables.rules`。
+Finally, execute the file with root privileges: `# ./iptables.rules` or `# source iptables.rules`.
:::
-### 使用 nftables
+### Using nftables
-此处合并 ipv4 与 ipv6
+This merges IPv4 and IPv6.
```
#!/usr/sbin/nft -f
@@ -428,30 +431,30 @@ table inet xray {
```
-::: tip 使用方法
+::: tip Usage
-将上述配置写入一个文件(如 `nftables.rules`),之后将该文件赋予可执行权限`# chmod 700 ./nftables.rules`
+Write the above configuration into a file (e.g., `nftables.rules`), then grant executable permission to the file: `# chmod 700 ./nftables.rules`.
-最后使用 root 权限执行该文件即可:`# ./nftables.rules`或`# source nftables.rules`
+Finally, execute the file with root privileges: `# ./nftables.rules` or `# source nftables.rules`.
:::
-其中,网关地址`192.168.0.0/16`, `fd00::/8`等可由`ip address | grep -w inet | awk '{print $2}'`以及`ip address | grep -w inet6 | awk '{print $2}'`[获得](https://xtls.github.io/document/level-2/iptables_gid.html#_4-%E8%AE%BE%E7%BD%AE-iptables-%E8%A7%84%E5%88%99)
+Where gateway addresses `192.168.0.0/16`, `fd00::/8`, etc., can be [obtained](https://xtls.github.io/document/level-2/iptables_gid.html#_4-%E8%AE%BE%E7%BD%AE-iptables-%E8%A7%84%E5%88%99) by `ip address | grep -w inet | awk '{print $2}'` and `ip address | grep -w inet6 | awk '{print $2}'`.
-或者在 windows 网络设置中查看。
+Or check in Windows Network Settings.
-又或者在路由器“上网设置”中查看。
+Or check in the Router's "Internet Settings".
-如果前缀`192.168`, `fd00:`相同可不更改,若不同如 `fc00:`, `fe00:` 等则更改为相应值,写法可通过 Goolge 搜索得到如 `fc00::/7`, `fe00::/9`。
+If the prefixes `192.168`, `fd00:` are the same, you don't need to change them. If they are different, such as `fc00:`, `fe00:`, etc., change them to the corresponding values. The notation (like `fc00::/7`, `fe00::/9`) can be found via Google search.
-### 开机自动运行 Netfilter 配置
+### Auto-run Netfilter Configuration on Boot
-首先确认已经运行过上述相应 Netfilter 命令,并且成功测试透明代理配置,以确保接下来输出正确的文件。
+First, confirm that you have run the corresponding Netfilter commands above and successfully tested the transparent proxy configuration to ensure the output files are correct.
-#### 若使用 iptables 配置
+#### If using iptables configuration
-1. 首先通过 `# iptables-save > /root/iptables.rulesv4` `# ip6tables-save > /root/iptables.rulesv6` 将 iptables 配置写入 `iptables.rulesv4` 和 `iptables.rulesv6` 文件中
+1. First, save the iptables configuration to `iptables.rulesv4` and `iptables.rulesv6` files: `# iptables-save > /root/iptables.rulesv4` and `# ip6tables-save > /root/iptables.rulesv6`.
-2. 然后在 `/etc/systemd/system/` 目录下创建一个名为 `tproxyrules.service` 的文件,添加以下内容并保存
+2. Then create a file named `tproxyrules.service` in the `/etc/systemd/system/` directory, add the following content, and save it:
```
[Unit]
@@ -482,13 +485,13 @@ ExecStop=/sbin/ip rule del fwmark 1 table 100 ; \
WantedBy=multi-user.target
```
-3. 最后执行 `systemctl enable tproxyrules` 命令。
+1. Finally, execute the command `systemctl enable tproxyrules`.
-#### 如果使用 nftables 配置
+#### If using nftables configuration
-1. 首先通过 `# nft list ruleset > /root/nftables.rulesv46` 将 nftables 配置写入 `nftables.rulesv46` 文件中
+1. First, write the nftables configuration to the `nftables.rulesv46` file: `# nft list ruleset > /root/nftables.rulesv46`.
-2. 在 `/etc/systemd/system/` 目录下创建一个名为 `tproxyrules.service` 的文件,然后添加以下内容并保存
+2. Create a file named `tproxyrules.service` in the `/etc/systemd/system/` directory, then add the following content and save it:
```
[Unit]
@@ -517,55 +520,57 @@ ExecStop=/sbin/ip rule del fwmark 1 table 100 ; \
WantedBy=multi-user.target
```
-3. 最后执行 `systemctl enable tproxyrules` 命令。
+1. Finally, execute the command `systemctl enable tproxyrules`.
::: tip tproxyrules.service
-注意其中主路由器 IP 地址,根据实际修改
+Note the Main Router IP address, modify it according to reality.
-`ExecStartPre=/bin/sh -c 'until ping -c1 192.168.31.1; do sleep 1; done;'` 命令为确保获得 IP 地址后再执行命令,否则会诡异报错,其中 IP 地址为主路由器地址,根据实际修改。
+The command `ExecStartPre=/bin/sh -c 'until ping -c1 192.168.31.1; do sleep 1; done;'` ensures that the command is executed only after obtaining an IP address, otherwise weird errors may occur. The IP address is the main router address, modify it according to reality.
:::
-::: warning 注意
+::: warning Note
-如果通过 dhcpcd 等设置了静态 IP 及网关,则上述相关 `ip route add/del` 设置需删除
+If you have set a static IP and gateway via dhcpcd, etc., the related `ip route add/del` settings above should be removed.
:::
-## 局域网设备上网设置
+## LAN Device Internet Setup
-此处假定旁路由 ipv4, ipv6 地址分别为`192.168.31.100`, `fd00:6868:6868::8866`, 旁路由的 ipv4, ipv6 地址可由命令`ip add`获得。
+Assuming the IPv4 and IPv6 addresses of the side router are `192.168.31.100` and `fd00:6868:6868::8866` respectively. The IP addresses of the side router can be obtained by the command `ip add`.
-### 方法一
+### Method 1
-局域网设备上网有两种方式,第一种就是在使用设备上进行静态 IP 的配置,将网关指向旁路由 IP。注意绝大部分手机仅支持手动配置 ipv4 网关,不支持手动配置 ipv6 网关,除非 root 后进行相关设置。
+There are two ways for LAN devices to access the Internet. The first is to configure a static IP on the device and point the gateway to the side router IP. Note that most mobile phones only support manual configuration of IPv4 gateways and do not support manual configuration of IPv6 gateways unless rooted and configured accordingly.
-以 windows 设备为例,可以先开启 DHCP 记录自动分配的 IP 以参考,然后手写静态配置。
+Taking a Windows device as an example, you can first enable DHCP to record the automatically assigned IP for reference, and then write the static configuration manually.
-::: tip DNS 设置
+::: tip DNS Settings
-此配置劫持 DNS 流量,DNS 可以随便写
+This configuration hijacks DNS traffic, so DNS can be written arbitrarily.
+
+It is recommended to set it to the side router IP to prevent DNS leaks.
:::
-### 方法二
+### Method 2
-局域网设备上网的第二种方式,是在路由器上进行网关设置,这种方法对于连接到此路由器的设备无需做任何设置即可科学上网,但注意有些路由器不支持 ipv6 的网关设置,有 ipv6 需求的设备仍需在所需设备上单独手动配置 ipv6 相关设置参考方法一。
+The second way for LAN devices to access the Internet is to configure the gateway on the router. With this method, devices connected to this router can access the scientific internet (bypass firewall) without any configuration. However, note that some routers do not support IPv6 gateway configuration. Devices requiring IPv6 still need to manually configure IPv6-related settings on the specific device (refer to Method 1).
## Finally
-按照以上方法设置后设备即可双栈访问,进入测试网站比如 https://ipv6-test.com/ 可以看到如下结果 (需要代理此网站才能看到如下结果)
+After setting up according to the above methods, the device can access via dual-stack. Entering a test website like , you can see the following results (you need to proxy this website to see the result below):
-## 写在最后
+## Closing Thoughts
-如今 ipv6 并未完全普及,我们日常访问的流量 99%仍为 ipv4 流量;很多 VPS 商家虽然提供 ipv6 地址,但线路优化非常垃圾,甚至处于不可用状态,为何要加入 ipV6 的设置?
+Nowadays, IPv6 is not yet fully popularized. 99% of our daily access traffic is still IPv4 traffic. Although many VPS providers offer IPv6 addresses, the route optimization is often garbage, or even in an unusable state. So why add IPv6 settings?
-可以看到目前 ipv6 处于很尴尬的境地,各种设备对于 ipv6 的支持很烂,但是都在逐步完善,同时 Windows 系统对于 ipv6 的优先级也在提高,很多浏览器也会优先进行 ipv6 的解析以及访问,很多网站也开始默认使用 ipv6 进行访问(比如 Netflix, 如果没有配置 ipv6, 浏览器打开 Netflix 会显示 Not Available 是因为没有代理 Netflix 的 ipv6 请求,当然可以选择禁用 Windows 的 ipv6,但支持 ipv6 的 pt 站就无法使用)
+It can be seen that IPv6 is currently in an awkward position. Support for IPv6 on various devices is poor, but it is gradually improving. At the same time, the priority of IPv6 in Windows systems is also increasing. Many browsers will also prioritize IPv6 resolution and access. Many websites have also started to use IPv6 for access by default (such as Netflix; if IPv6 is not configured, opening Netflix in the browser will show "Not Available" because the IPv6 request for Netflix is not proxied. Of course, you can choose to disable IPv6 in Windows, but PT sites that support IPv6 will not be usable).
-这种情况下 ipv4 无法完全胜任网络冲浪的需求,即使是那 1%的流量,遇到了也会让人头疼不已。
+In this case, IPv4 cannot fully meet the needs of web surfing. Even if it is only that 1% of traffic, encountering it can be a headache.
-而可以预见 ipv6 也会逐步与 ipv4 分庭抗礼,所以有必要加入 ipv6 的设置。
+And it is foreseeable that IPv6 will gradually stand up to IPv4, so it is necessary to add IPv6 settings.
diff --git a/docs/en/document/level-2/traffic_stats.md b/docs/en/document/level-2/traffic_stats.md
index 9a22bde0..6b112572 100644
--- a/docs/en/document/level-2/traffic_stats.md
+++ b/docs/en/document/level-2/traffic_stats.md
@@ -1,23 +1,23 @@
---
-title: 流量统计
+title: Traffic Statistics
---
-# 流量统计配置教程
+# Traffic Statistics Configuration Tutorial
-请熟悉[流量统计 白话文教程](https://guide.v2fly.org/advanced/traffic.html),本文在其基础上适配了 Xray(1.5.9+)。
+Please familiarize yourself with the [Traffic Statistics Plain Language Guide](https://guide.v2fly.org/advanced/traffic.html). This article adapts those concepts for Xray (1.5.9+).
-## 查看流量信息
+## Viewing Traffic Information
-配置方法与 v2fly 一致。
-查看流量信息是 xray 命令行的其中一个功能。配置内设置的 api dokodemo-door 端口,即为 `--server` 参数的端口。
+The configuration method is consistent with v2fly.
+Viewing traffic information is one of the features of the xray command line. The `api dokodemo-door` port set in the configuration corresponds to the port for the `--server` parameter.
```bash
-xray api statsquery --server=127.0.0.1:10085 #查看所有流量
-xray help api statsquery #statsquery 查询匹配的记录
-xray help api stats #stats 查询一个记录
+xray api statsquery --server=127.0.0.1:10085 # View all traffic statistics
+xray help api statsquery # statsquery queries matching records
+xray help api stats # stats queries a single record
```
-输出例子:
+Output example:
```json
{
@@ -58,9 +58,9 @@ xray help api stats #stats 查询一个记录
}
```
-## 流量信息的处理
+## Processing Traffic Information
-把以下脚本保存到 `traffic.sh`,注意使用 `chmod 755 traffic.sh` 授予执行权限。注意调整修改 `_APISERVER` 一行的连接具体的端口参数。
+Save the following script to `traffic.sh`, and remember to use `chmod 755 traffic.sh` to grant execution permissions. Pay attention to adjusting the specific port parameter in the `_APISERVER` line.
```bash
#!/bin/bash
diff --git a/docs/en/document/level-2/transparent_proxy/transparent_proxy.md b/docs/en/document/level-2/transparent_proxy/transparent_proxy.md
index 2d5d0624..d2997cdd 100644
--- a/docs/en/document/level-2/transparent_proxy/transparent_proxy.md
+++ b/docs/en/document/level-2/transparent_proxy/transparent_proxy.md
@@ -1,104 +1,107 @@
-# 透明代理入门
+# Introduction to Transparent Proxy
-## 什么是透明代理
+## What is a Transparent Proxy?
-透明代理简单地说就是不让被代理的设备感觉到自己被代理了。简单地说就是,被代理的设备上不需要运行任何代理软件(比如 Xray、V2RayNG 等),当你连接上网络时,你的设备已经被代理了。
+Simply put, a transparent proxy means that the proxied device does not realize it is being proxied. In other words, no proxy software (such as Xray, V2RayNG, etc.) needs to be run on the proxied device itself. When you connect to the network, your device is automatically proxied.
-这也意味着,代理的软件运行在别的地方,比如运行在路由器中,通过路由器上网的设备就自动被代理了。
+This also implies that the proxy software is running elsewhere, for example, on a router. Devices accessing the Internet through this router are automatically proxied.
-## 透明代理的实现
+## Implementation of Transparent Proxy
-透明代理的实现目前主要有两种方式:
+There are two main ways to implement a transparent proxy:
### tun2socks
-可用 Windows/Linux(包括安卓)实现。因为实现过程比较简单,很少有教程,我这里简单描述一下。
+This can be implemented on Windows/Linux (including Android). Since the implementation process is relatively simple, there are few tutorials available. I will briefly describe it here.
**Windows**
-1. 安装 **[Netch](https://github.com/NetchX/Netch/releases)** ,使用模式`[3] [TUN/TAP] 绕过局域网`启动。
+1. Install **[Netch](https://github.com/NetchX/Netch/releases)** and start it using the mode `[3] [TUN/TAP] Bypass LAN`.
-2. 开启热点
+2. Enable the Mobile Hotspot.
-3. 打开`控制面板`->`网络和 Internet`->`网络和共享中心`->`更改适配器设置`,找到`TAP-Windows Adapter`和`Microsoft Wi-Fi Direct Virtual Adapter`。
+3. Open `Control Panel` -> `Network and Internet` -> `Network and Sharing Center` -> `Change adapter settings`. Find `TAP-Windows Adapter` and `Microsoft Wi-Fi Direct Virtual Adapter`.
-4. 鼠标右键点击`TAP-Windows Adapter`,`属性`->`共享`,勾选`允许其他网络用户通过此计算机的 Internet 连接来连接`,在`家庭网络连接`中选择`Microsoft Wi-Fi Direct Virtual Adapter`的那个网络连接,点击确定。
+4. Right-click on `TAP-Windows Adapter`, select `Properties` -> `Sharing`. Check `Allow other network users to connect through this computer's Internet connection`. Under `Home networking connection`, select the network connection corresponding to the `Microsoft Wi-Fi Direct Virtual Adapter`, and click OK.
**Android**
-1. 配置连接 V2RayNG
+1. Configure and connect V2RayNG.
-2. 开启热点
+2. Enable Hotspot.
-3. 热点设置 -> 允许热点使用 VPN(部分安卓系统可能没有这个选项)
+3. Hotspot Settings -> Allow hotspot to use VPN (some Android systems may not have this option).
### iptables/nftables
-iptables 与 nftables 实现透明代理的原理相同,下文统一使用 iptables。
+The principle of implementing a transparent proxy with iptables and nftables is the same. The text below will unify the description using iptables.
-基于 iptables 的透明代理实现只能用于 Linux 系统(包括 openwrt/安卓)。由于其比 tun2socks 更高效率以及适合在路由器中配置而广泛使用。
+Transparent proxy implementation based on iptables can only be used on Linux systems (including OpenWrt/Android). It is widely used because it is more efficient than tun2socks and is suitable for configuration in routers.
-现存的三篇白话文透明代理教程其实讲的都是基于这种方案的透明代理实现,它们是: **[新 V2Ray 白话文指南-透明代理](https://guide.v2fly.org/app/transparent_proxy.html)** 、 **[新 V2Ray 白话文指南-透明代理(TPROXY)](https://guide.v2fly.org/app/tproxy.html)** 、 **[透明代理(TProxy)配置教程](../tproxy.md)** 。其中第一篇是基于 iptables-redirect 模式,已经过时了,不建议使用,仅供参考。第二篇和第三篇讲的都是基于 iptables-tproxy 模式的透明代理实现。
+The three existing "Plain Language" transparent proxy tutorials are actually all based on this scheme. They are: **[New V2Ray Plain Guide - Transparent Proxy](https://guide.v2fly.org/app/transparent_proxy.html)**, **[New V2Ray Plain Guide - Transparent Proxy (TPROXY)](https://guide.v2fly.org/app/tproxy.html)**, and **[Transparent Proxy (TProxy) Configuration Tutorial](../tproxy.md)**. The first one is based on the iptables-redirect mode, which is obsolete and not recommended (for reference only). The second and third ones discuss transparent proxy implementation based on the iptables-tproxy mode.
-## iptables 实现透明代理原理
+## Principle of iptables-based Transparent Proxy
-Linux 使用`Netfilter`来管理网络,`Netfilter`模型如下:
+Linux uses `Netfilter` to manage the network. The `Netfilter` model is as follows:

-**假设使用路由器作为网关(即我们平时的上网方式),那么:**
+**Assuming a router is used as the gateway (which is our usual way of accessing the Internet):**
-局域网设备通过路由器访问互联网的流量方向:
+Traffic direction for LAN devices accessing the Internet via the router:
-`PREROUTING链->FORWARD链->POSTINGROUTING链`
+`PREROUTING Chain -> FORWARD Chain -> POSTROUTING Chain`
-局域网设备访问路由器的流量(如登陆路由器 web 管理界面/ssh 连接路由器/访问路由器的 dns 服务器等)方向:
+Traffic direction for LAN devices accessing the router itself (e.g., logging into the router web UI / SSH connection to router / accessing the router's DNS server):
-`PREROUTING链->INPUT链->网关本机`
+`PREROUTING Chain -> INPUT Chain -> Gateway Local Process`
-路由器访问互联网的流量方向:
+Traffic direction for the router accessing the Internet:
-`网关本机->OUTPUT链->POSTINGROUTING链`
+`Gateway Local Process -> OUTPUT Chain -> POSTROUTING Chain`
-**通过使用 iptables 操控`PREROUTING链`和`OUTPUT链`的流量走向,转发到 Xray,就可以代理局域网设备和网关本机。**
+**By using iptables to manipulate the traffic flow in the `PREROUTING Chain` and `OUTPUT Chain` and forwarding it to Xray, we can proxy both LAN devices and the gateway itself.**
-## 透明代理难在哪里
+## Where is the Difficulty?
-透明代理的难点就在于路由,所谓路由,就是区分哪些流量是直连的,哪些该被代理,所以我个人认为叫做**分流**更加合适。
+The difficulty of transparent proxy lies in routing. Routing essentially means distinguishing which traffic should be direct and which should be proxied. Therefore, I personally think calling it **Traffic Splitting** is more appropriate.
-我们可以把路由由易到难分为以下几个阶段:
+We can divide routing into the following stages, from easy to difficult:
-1. 代理全部请求
+1. Proxy all requests.
-2. 本地局域网 IP/组播 IP 请求直连,其它请求代理
+2. Direct connection for local LAN IPs/Multicast IPs; proxy other requests.
-3. 在 2 的基础上直连 Xray 发起的连接请求
+3. Based on 2, direct connection for connection requests initiated by Xray itself.
-4. 在 3 的基础上直连指向中国大陆 IP 的连接请求,并对国内外域名选择国内外 DNS 服务器解析。
+4. Based on 3, direct connection for requests pointing to Mainland China IPs, and selecting domestic/foreign DNS servers for parsing domestic/foreign domains respectively.
-上面说的三篇教程,都是在第四阶段。所以新手直接阅读可能显得有点难懂。
+The three tutorials mentioned above are all at the fourth stage. Therefore, it might seem a bit difficult for beginners to read directly.
-## 从零开始一步步实现基于 iptables-tproxy 的透明代理
+## Implementing iptables-tproxy Transparent Proxy Step by Step from Scratch
-### 在开始之前,你需要有一定的基础知识:
+### Before you start, you need some basic knowledge
-1. 大概知道什么是 TCP/IP 协议、域名和 DNS 服务器
+1. Roughly know what TCP/IP protocol, domain names, and DNS servers are.
-2. 知道什么是 WAN 口,LAN 口,LAN_IP,WAN_IP 以及 DHCP 服务器。对于旁路由,只有一个网口,这里称其为 LAN 口
+2. Know what WAN port, LAN port, LAN_IP, WAN_IP, and DHCP server are. For a "Side Router" (single-arm router), there is only one network port, which we call the LAN port here.
-3. 对 Linux 系统有最基础的了解(知道怎么运行命令)
+3. Have a basic understanding of the Linux system (know how to run commands).
-4. 能够手写客户端 json 文件配置,至少要能看懂
+4. Be able to hand-write client JSON configuration files, or at least understand them.
-### 前期准备工作
+### Preparation Work
-**1. 准备一个运行 Linux 系统的网关**
+::: warning
+Before starting operations, remember to use `sysctl -w net.ipv4.ip_forward=1` to enable Linux IPv4 packet forwarding.
+:::
+**1. Prepare a gateway running a Linux system**
-比如,刷了 OpenWRT 的路由器
+For example, a router flashed with OpenWrt.
-**2. 在网关(路由器)准备好 Xray 可执行文件以及配置文件**
+**2. Prepare the Xray executable and configuration file on the gateway (router)**
-配置文件监听 12345 端口,开启 tproxy:
+The configuration file should listen on port 12345 and enable tproxy:
```json
{
@@ -122,19 +125,23 @@ Linux 使用`Netfilter`来管理网络,`Netfilter`模型如下:
],
"outbounds": [
{
- 你的服务器配置
+ Your_Server_Configuration
}
]
}
```
-我们由易到难,不写 routing,只写一个 inbound 一个 outbound。
+Moving from easy to difficult, we won't write `routing` for now, just one `inbound` and one `outbound`.
-### 首先,我们先试试做到第一阶段
+### First, let's try to achieve Stage 1
-将所有`PREROUTING链`的流量,都转发到 Xray 中。
+::: warning
+If you cannot accept that your machine needs to be rebooted, it is best to start a virtual machine for practice first.
+:::
-运行 Xray,执行以下指令:
+Forward all traffic from the `PREROUTING Chain` to Xray.
+
+Run Xray, and execute the following commands:
```bash
ip rule add fwmark 1 table 100
@@ -145,43 +152,43 @@ iptables -t mangle -A XRAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j XRAY
```
-当你输入完之后,如果你是使用 ssh 连接到网关上的,你会发现 ssh 的连接断开了(不用紧张,断电重启即可恢复),并且透明代理无法上网;如果你是的网关是虚拟机,你会发现网关本身也无法上网,并且 Xray 日志 access_log 中出现许多源地址为目标地址,目标地址为 WAN_IP 的请求。
+After entering these commands, if you are connected to the gateway via SSH, you will find that the SSH connection is disconnected (don't panic, a power cycle will restore it), and the transparent proxy cannot access the Internet. If your gateway is a virtual machine, you will find that the gateway itself cannot access the Internet, and many requests with the source address as the destination address and the destination address as the WAN_IP appear in the Xray `access_log`.
-理论上网关本机访问公网只会经过`OUTPUT链`和`POSTROUTING链`,为什么操控`PREROUTING链`会导致网关无法上网呢?这是因为网络通讯往往是双向的,虽然网关访问公网 IP 不需要经过`PREROUTING链`,但被访问的服务器向网关返回信息时要经过`PREROUTING链`,且这部分被转发到 Xray 了,因此出现了日志中的反向请求。
+Theoretically, the gateway's local access to the public network should only pass through the `OUTPUT Chain` and `POSTROUTING Chain`. Why does manipulating the `PREROUTING Chain` cause the gateway to lose Internet access? This is because network communication is often bidirectional. Although the gateway does not need to pass through the `PREROUTING Chain` to access a public IP, the information returned by the accessed server to the gateway must pass through the `PREROUTING Chain`. Since this part is forwarded to Xray, the reverse requests appear in the log.
-我们修改一下规则,源 IP 不是来自局域网的则返回。重启网关,运行 Xray,执行以下指令:
+Let's modify the rules to return (skip Xray) if the source IP is not from the LAN. Reboot the gateway, run Xray, and execute the following commands:
```bash
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N XRAY
-# "网关LAN_IP地址段" 通过运行命令"ip address | grep -w "inet" | awk '{print $2}'"获得,是其中的一个
-iptables -t mangle -A XRAY ! -s 网关LAN_IP地址段 -j RETURN
+# "Gateway_LAN_IP_Range" can be obtained by running "ip address | grep -w "inet" | awk '{print $2}'". Pick the correct one.
+iptables -t mangle -A XRAY ! -s Gateway_LAN_IP_Range -j RETURN
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A XRAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j XRAY
```
-然后你会发现,虽然 ssh 连接断开了,但是透明代理已经可用了。只要我们修改系统 dns 为公共 dns,就能正常上网了(因为现在网关访问不了,所以 dns 设置为网关是不行的)。
+Then you will find that although the SSH connection is disconnected, the transparent proxy is now available. As long as we change the system DNS to a public DNS, we can surf the Internet normally (because the gateway itself cannot be accessed now, setting the DNS to the gateway won't work).
-至此,第一阶段就完成了。之所以无法访问网关,是因为代理规则代理了全部流量,包括访问网关的流量。试想在 VPS 上访问你本地的网关,肯定是访问不了的,所以我们要对这部分流量直连,请看第二阶段:
+At this point, Stage 1 is complete. The reason the gateway cannot be accessed is that the proxy rules cover *all* traffic, including traffic accessing the gateway. Imagine trying to access your local gateway on a VPS; it certainly won't work. So, we need to make this part of the traffic direct. Please see Stage 2.
-### 第二阶段
+### Stage 2
-重启网关,运行 Xray,执行以下指令:
+Reboot the gateway, run Xray, and execute the following commands:
```bash
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N XRAY
-# 所有目标地址在网关所在网段的请求直连
-# 通过运行命令"ip address | grep -w "inet" | awk '{print $2}'"获得,一般来说有多个
-iptables -t mangle -A XRAY -d 网关所在网段1 -j RETURN
-iptables -t mangle -A XRAY -d 网关所在网段2 -j RETURN
+# Direct connection for all requests where the destination address is in the gateway's subnet
+# Obtained via "ip address | grep -w "inet" | awk '{print $2}'". Generally, there are multiple.
+iptables -t mangle -A XRAY -d Gateway_Subnet_1 -j RETURN
+iptables -t mangle -A XRAY -d Gateway_Subnet_2 -j RETURN
...
-# 目标地址为组播IP/E类地址/广播IP的请求直连
+# Direct connection for Multicast IPs / Class E addresses / Broadcast IPs
iptables -t mangle -A XRAY -d 224.0.0.0/3 -j RETURN
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
@@ -189,86 +196,93 @@ iptables -t mangle -A XRAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j XRAY
```
-使用这条规则后,上一条规则`iptables -t mangle -A XRAY ! -s 网关LAN_IP地址段 -j RETURN`便成为了多余规则,可以删去。
+After using this rule, the previous rule `iptables -t mangle -A XRAY ! -s Gateway_LAN_IP_Range -j RETURN` becomes redundant and can be removed.
-至此,第二阶段完成。网关已经可以访问,ssh 不会断开。
+At this point, Stage 2 is complete. The gateway is accessible, and SSH will not disconnect.
-### 第三阶段
+### Stage 3
-我们平时用的 DNS 一般来自路由器,但这个 iptables 规则只代理了局域网中的设备,却没有代理网关本机,这样返回的 DNS 查询结果可能是错误的或者污染的。
+The DNS we usually use generally comes from the router, but these iptables rules only proxy devices in the LAN and do not proxy the gateway itself. Thus, the returned DNS query results might be incorrect or polluted.
-iptables-tproxy 不支持对`OUTPUT链`操作,但是`Netfilter`有个特性,在`OUTPUT链`给包打标记为`1`后相应的包会重路由到`PREROUTING链`上。所以我们就给网关本机需要代理的请求在`OUTPUT链`上标记`1`即可。
-
-如果要代理网关本机发出的的全部请求,就会引入一个问题,Xray 运行在网关,Xray 向代理服务端发送请求,这个请求又被代理了,就形成了回环。
-
-因此要代理网关本机,就要避免回环发生,即代理规则中规避 Xray 请求的流量。
-
-**常见的方法有三种:**
-
-1. 直连目标地址为 VPS 的流量
-
-重启网关,运行 Xray,执行以下指令:
+`iptables-tproxy` does not support operations on the `OUTPUT Chain`, but we can reroute packets from the `OUTPUT Chain` to the `PREROUTING Chain` by configuring `Policy Routing`.
```bash
-#代理局域网设备
-#继承上一个阶段的成果
+# Add policy routing: Packets marked as 1 go to routing table 100
+ip rule add fwmark 1 table 100
+# Add route entry to table 100: All packets route to local
+ip route add local 0.0.0.0/0 dev lo table 100
+```
+
+By configuring the above `Policy Routing`, we only need to mark packets with `1` in the `OUTPUT Chain`, and the corresponding packets will be routed to the local gateway, i.e., the `PREROUTING Chain`. So, we just need to mark requests from the gateway itself that need proxying with `1` on the `OUTPUT Chain`.
+
+If we proxy all requests originating from the gateway, a problem arises: Xray runs on the gateway and sends requests to the proxy server. If this request is also proxied, a loop is formed.
+
+Therefore, to proxy the gateway itself, we must avoid loops, which means avoiding Xray's own traffic in the proxy rules.
+
+**There are three common methods:**
+
+1. Direct connection for traffic destined for the VPS address
+
+Reboot the gateway, run Xray, and execute the following commands:
+
+```bash
+# Proxy LAN devices
+# Inherit results from the previous stage
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N XRAY
-iptables -t mangle -A XRAY -d 网关所在网段1 -j RETURN
-iptables -t mangle -A XRAY -d 网关所在网段2 -j RETURN
+iptables -t mangle -A XRAY -d Gateway_Subnet_1 -j RETURN
+iptables -t mangle -A XRAY -d Gateway_Subnet_2 -j RETURN
...
iptables -t mangle -A XRAY -d 224.0.0.0/3 -j RETURN
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A XRAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j XRAY
-#代理网关本机
+# Proxy the gateway itself
iptables -t mangle -N XRAY_MASK
-iptables -t mangle -A XRAY_MASK -d 网关所在网段1 -j RETURN
-iptables -t mangle -A XRAY_MASK -d 网关所在网段2 -j RETURN
+iptables -t mangle -A XRAY_MASK -d Gateway_Subnet_1 -j RETURN
+iptables -t mangle -A XRAY_MASK -d Gateway_Subnet_2 -j RETURN
...
iptables -t mangle -A XRAY_MASK -d 224.0.0.0/3 -j RETURN
-iptables -t mangle -A XRAY_MASK -d VPS公网ip/32 -j RETURN
+iptables -t mangle -A XRAY_MASK -d VPS_Public_IP/32 -j RETURN
iptables -t mangle -A XRAY_MASK -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -p tcp -j XRAY_MASK
iptables -t mangle -A OUTPUT -p udp -j XRAY_MASK
```
-但是这么配置有个缺点,如果使用 CDN 或者 VPS 很多的话,就不好写规则了。
+However, this configuration has a downside: if you use CDNs or many VPSs, writing rules becomes difficult.
-2. 通过 mark 规避
+1. Bypass via fwmark
-三个白话文教程都是使用这种方法规避,自行参考,这里不再赘述。
+The three "Plain Language" tutorials all use this method to avoid loops. Please refer to them; I won't repeat it here.
-3. 通过 gid 规避(推荐)
+1. Bypass via GID (Recommended)
-参考 **[[透明代理]通过 gid 规避 Xray 流量](../iptables_gid.md)**
+Refer to **[[Transparent Proxy] Bypassing Xray Traffic via GID](../iptables_gid.md)**.
-这样就完成了第三阶段的代理,也就是平时说的全局代理。但是记得把网关的 DNS 服务器设置为国外的 DNS 服务器,否则可能依然返回被污染的结果。
+This completes Stage 3 proxying, which is what we call Global Proxy. However, remember to set the gateway's DNS server to a foreign DNS server; otherwise, it may still return polluted results.
-### 第四阶段
+### Stage 4
-其实,并不是所有人都需要实现第四阶段。全局代理对于大部分情况已经适用。
+In fact, not everyone needs to implement Stage 4. Global proxy is suitable for most situations.
-特别是对于旁路由而言。需要代理时,将网关调成旁路由的 IP,不需要代理时,将网关换回主路由 IP。
+Especially for "Side Routers" (Gateway Servers). When proxying is needed, set the device gateway to the Side Router's IP; when not needed, set the gateway back to the Main Router's IP.
-至于第四阶段的具体实现,那三篇白话文教程讲的都是。在理解了上面的内容后,再去看那三篇白话文教程,就比较容易理解了。
+As for the specific implementation of Stage 4, those three "Plain Language" tutorials cover it. After understanding the content above, reading those tutorials should be much easier.
-### 代理 ipv6
+### Proxying IPv6
-上面的规则只对 ipv4 生效,如果还想要代理 ipv6 请求,则使用 ip6tables 命令,用法与 iptables 基本相同。参考 **[[透明代理]通过 gid 规避 Xray 流量#4-设置 iptables 规则](../iptables_gid#4-设置iptables规则.md)**
+The rules above only apply to IPv4. If you also want to proxy IPv6 requests, use the `ip6tables` command. The usage is basically the same as `iptables`. Refer to **[[Transparent Proxy] Bypassing Xray Traffic via GID#4-Set iptables rules](../iptables_gid#4-设置iptables规则.md)**.
-# iptables 透明代理的其它注意事项
+# Other Notes on iptables Transparent Proxy
-1. 如果作为代理的网关作为主路由,要在`PREROUTING链`规则中加一条`iptables -t mangle -A XRAY ! -s 网关LAN_IP地址段 -j RETURN`,即在第一阶段使用、第二阶段被删除的指令。如果不写,WAN 口中同网段的其它人可以将网关填写成你的 WAN_IP,从而蹭你的透明代理用,还可能带来一定的危险性。
+1. If the gateway acting as the proxy is the **Main Router**, you must add `iptables -t mangle -A XRAY ! -s Gateway_LAN_IP_Range -j RETURN` to the `PREROUTING Chain` rules. This is the command used in Stage 1 but removed in Stage 2. If you don't write this, other people in the same subnet on the WAN port can set their gateway to your WAN_IP, thereby leeching off your transparent proxy, which may also pose certain dangers.
-2. **[新 V2Ray 白话文指南-透明代理(TPROXY)#设置网关](https://guide.v2fly.org/app/tproxy.html#设置网关)** 中的第三条说:`手动配置 PC 的网络,将默认网关指向树莓派的地址即 192.168.1.22。此时 PC 应当能正常上网(由于还没设置代理,“正常”是指可以上国内的网站)`。实际上,Ubuntu、CentOS、debian 等系统就算开启了 IP 转发,PC 也不能正常上网,这是正常的。事实上只有 OpenWRT 能做到文中所描述的那样,据 **[@BioniCosmos](https://github.com/BioniCosmos)** 点拨,这是由于一般的 Linux 系统没有 Masquery 规则。
+2. **[New V2Ray Plain Guide - Transparent Proxy (TPROXY) #Set Gateway](https://guide.v2fly.org/app/tproxy.html#设置网关)**, item 3 states: `Manually configure the PC's network, pointing the default gateway to the Raspberry Pi's address, i.e., 192.168.1.22. At this time, the PC should be able to access the Internet normally (since no proxy is set yet, "normal" means accessing domestic websites).` In reality, on systems like Ubuntu, CentOS, Debian, etc., even if IP Forwarding is enabled, the PC cannot access the Internet normally. This is expected. Only OpenWrt can achieve what is described in the article. As pointed out by **[@BioniCosmos](https://github.com/BioniCosmos)**, this is because general Linux systems do not have Masquerade rules.
-3. **[too many open files 问题](https://guide.v2fly.org/app/tproxy.html#解决-too-many-open-files-问题)** ,解决方法见 **[[透明代理]通过 gid 规避 Xray 流量-配置最大文件大开数&运行 Xray 客户端](../iptables_gid#3-配置最大文件大开数运行xray客户端)**
+3. **[too many open files issue](https://guide.v2fly.org/app/tproxy.html#解决-too-many-open-files-问题)**. For the solution, see **[[Transparent Proxy] Bypassing Xray Traffic via GID - Config Max Open Files & Run Xray Client](../iptables_gid#3-配置最大文件大开数运行xray客户端)**.
-4. 关于开启 ip_forward,待补充...
+4. Avoid double TPROXY for existing connections. To be added...
-5. 避免已有连接的包二次通过 TPROXY ,待补充...
-
-6. 主路由、单臂路由与旁路由,待补充...
+5. Main Router vs. Single-Arm Router vs. Side Router. To be added...
diff --git a/docs/en/document/level-2/warp.md b/docs/en/document/level-2/warp.md
index 50bd6349..6875d581 100644
--- a/docs/en/document/level-2/warp.md
+++ b/docs/en/document/level-2/warp.md
@@ -1,60 +1,153 @@
---
-title: Enhancing Proxy Security with Cloudflare Warp
+title: Enhancing Proxy Security via Cloudflare Warp
---
-# Enhancing Proxy Security with Cloudflare Warp
+# Enhancing Proxy Security via Cloudflare Warp
-Xray (1.6.5+) has added outbound WireGuard support. Although the added code and dependencies will increase the core size, we believe that this is a necessary new feature for three reasons:
+Xray (1.6.5+) has added a WireGuard outbound. Although the additional code and dependencies increase the core size, we believe this is a highly necessary new feature for three reasons:
-1. Through recent discussions and [experiments](https://github.com/net4people/bbs/issues/129#issuecomment-1308102504), we know that proxying the traffic back to China is not safe. One way to deal with this is to route the back-to-China traffic to a black hole, but the downside is that due to the delay in geosite and geoip updates or the lack of knowledge on how to properly split the traffic on the client side, the traffic ends up going to the black hole, affecting the user experience. In this case, we only need to import the back-to-China traffic into Cloudflare Warp, which can achieve the same level of security without affecting the user experience.
-2. As we all know, most airports will log the domain names visited by users, and some airports will even audit and block some user traffic. One way to protect user privacy is to use chain proxies on the client side. The WireGuard lightweight VPN protocol used by Warp adds an extra layer of encryption within the proxy layer. For airports, the target of all user traffic is Warp, thereby maximizing privacy protection.
-3. It is easy to use, and only one core is needed to complete the split, Wireguard Tun, and chain proxy settings.
+1. Through recent discussions and [experiments](https://github.com/net4people/bbs/issues/129#issuecomment-1308102504), we know that routing traffic back to China via a proxy is insecure. One countermeasure is to route return traffic to a blackhole. The downside is that if `geosite` and `geoip` rules are not updated in time, or if beginners don't know how to configure routing properly on the client side, legitimate traffic enters the blackhole, affecting the user experience.
+ By routing return traffic (traffic destined for China) to Cloudflare Warp instead, we can achieve the same level of security without impacting the user experience.
+2. It is well known that most proxy providers ("Airports") log user domain access history, and some even audit and block certain user traffic. One way to protect user privacy is to use a chain proxy on the client side.
+ The WireGuard lightweight VPN protocol used by Warp adds a layer of encryption within the proxy layer. For the proxy provider, the destination of all user traffic appears to be Warp, thereby maximizing privacy protection.
+3. Ease of use. A single core can handle routing, WireGuard Tun, and chain proxy settings.
## Applying for a Warp Account
-1. Thank you Cloudflare for promoting a free internet. Now you can use the Warp service for free, and the nearest server will be automatically selected based on the exit.
-2. Use a VPS and download [wgcf](https://github.com/ViRb3/wgcf/releases).
-3. Run `wgcf register` to generate `wgcf-account.toml`.
-4. Run `wgcf generate` to generate `wgcf-profile.conf`. Copy the following content:
+### Thanks to Cloudflare for promoting a free internet. You can now use the Warp service for free, and it will automatically select the nearest server when connecting
-```
+#### Method 1
+
+1. Use a VPS to download [wgcf](https://github.com/ViRb3/wgcf/releases).
+2. Run `wgcf register` to generate `wgcf-account.toml`.
+3. Run `wgcf generate` to generate `wgcf-profile.conf`. Copy the content as follows:
+
+```ini
[Interface]
-PrivateKey = my private key
+PrivateKey = My_Private_Key
Address = 172.16.0.2/32
Address = 2606:4700:110:8949:fed8:2642:a640:c8e1/128
DNS = 1.1.1.1
MTU = 1280
[Peer]
-PublicKey = Warp public key
+PublicKey = Warp_Public_Key
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
Endpoint = engage.cloudflareclient.com:2408
```
-## Diverting inbound traffic to warp on the server side
+#### Method 2
-Add a new WireGuard outbound in the existing ones.
+1. Use [warp-reg.sh](https://github.com/chise0713/warp-reg.sh), run:
+
+```
+bash -c "$(curl -L warp-reg.vercel.app)"
+```
+
+- Output:
+
+```json
+{
+ "endpoint": {
+ "v4": "162.159.192.7",
+ "v6": "[2606:4700:d0::a29f:c007]"
+ },
+ "reserved_dec": [35, 74, 190],
+ "reserved_hex": "0x234abe",
+ "reserved_str": "I0q+",
+ "private_key": "yL0kApRiZW4VFfNkKAQ/nYxnMFT3AH0dfVkj1GAlr1k=",
+ "public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
+ "v4": "172.16.0.2",
+ "v6": "2606:4700:110:81f3:2a5b:3cad:9d4:9ea6"
+}
+```
+
+1. Copy the output content.
+
+#### Method 3
+
+1. Use [wgcf-cli](https://github.com/ArchiveNetwork/wgcf-cli). Run the following to install:
+
+```
+bash -c "$(curl -L wgcf-cli.vercel.app)"
+```
+
+1. Run `wgcf-cli register` to register. Output:
+
+```json
+❯ wgcf-cli register
+{
+ "endpoint": {
+ "v4": "162.159.192.7:0",
+ "v6": "[2606:4700:d0::a29f:c007]:0"
+ },
+ "reserved_str": "6nT5",
+ "reserved_hex": "0xea74f9",
+ "reserved_dec": [
+ 234,
+ 116,
+ 249
+ ],
+ "private_key": "WIAKvgUlq5fBazhttCvjhEGpu8MmGHcb1H0iHSGlU0Q=",
+ "public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
+ "addresses": {
+ "v4": "172.16.0.2",
+ "v6": "2606:4700:110:8d9c:3c4e:2190:59d1:2d3c"
+ }
+}
+```
+
+- The complete file will be saved to `wgcf.json` in the working directory.
+
+1. Run `wgcf-cli generate --xray` to generate a WireGuard outbound config. It will save the content to `wgcf.xray.json`.
+
+- Example file:
```json
{
"protocol": "wireguard",
"settings": {
- "secretKey": "My private key",
+ "secretKey": "6CRVRLgFwGajnikoVOPTDNZnDhx3EydhPsMgpxHfBCY=",
+ "address": ["172.16.0.2/32", "2606:4700:110:857a:6a95:fe27:1870:2a9d/128"],
+ "peers": [
+ {
+ "publicKey": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
+ "allowedIPs": ["0.0.0.0/0", "::/0"],
+ "endpoint": "162.159.192.1:2408"
+ }
+ ],
+ "reserved": [240, 25, 146],
+ "mtu": 1280
+ },
+ "tag": "wireguard"
+}
+```
+
+## Routing Traffic Back to China via Warp on the Server Side
+
+Add a new WireGuard outbound to your existing outbounds:
+
+```json
+{
+ "protocol": "wireguard",
+ "settings": {
+ "secretKey": "My_Private_Key",
"address": ["172.16.0.2/32", "2606:4700:110:8949:fed8:2642:a640:c8e1/128"],
"peers": [
{
- "publicKey": "Warp public key",
+ "publicKey": "Warp_Public_Key",
"endpoint": "engage.cloudflareclient.com:2408"
}
- ]
+ ],
+ "reserved": [0, 0, 0] // If you have it, paste 'reserved' here
},
"tag": "wireguard-1"
}
```
-Recommended routing strategy is `IPIfNonMatch`.
+Recommended routing strategy: `IPIfNonMatch`.
-Add the following to the existing router:
+Add the following to your existing routing rules:
```json
{
@@ -79,13 +172,14 @@ Add the following to the existing router:
{
"protocol":"wireguard",
"settings":{
- "secretKey":"My private key",
+ "secretKey":"My_Private_Key",
"peers":[
{
- "publicKey":"Warp public key",
+ "publicKey":"Warp_Public_Key",
"endpoint":"engage.cloudflareclient.com:2408"
}
- ]
+ ],
+ "reserved":[0, 0, 0] // If you have it, paste 'reserved' here
},
"streamSettings":{
"sockopt":{
@@ -100,11 +194,11 @@ Add the following to the existing router:
"settings":{
"vnext":[
{
- "address":"My IP",
- "port":My port,
+ "address":"My_Server_IP",
+ "port":My_Port,
"users":[
{
- "id":"My UUID",
+ "id":"My_UUID",
"security":"auto"
}
]