mirror of
https://github.com/XTLS/Xray-docs-next.git
synced 2025-01-19 09:11:40 +03:00
Englishize sidebar and navbar, fixe a typo, translate some docs (#357)
* translate transpots docs into english * p1 * p1 * fix typo * Englishize sidebar and navbar, fixe a typo, translate some docs * prettiered
This commit is contained in:
parent
381030ac6e
commit
0a80e89354
@ -100,32 +100,37 @@ export default defineUserConfig<DefaultThemeOptions>({
|
||||
},
|
||||
"/en/": {
|
||||
repoLabel: "Source",
|
||||
editLinkText: "Help us improve this page on GitHub!",
|
||||
tip: "Tip",
|
||||
warning: "Warning",
|
||||
danger: "Danger",
|
||||
lastUpdatedText: "Last Updated",
|
||||
selectLanguageName: "English (WIP)",
|
||||
// TODO: translation
|
||||
sidebar: {
|
||||
"/en/config/": sidebar.getConfigSidebar(
|
||||
"特性详解",
|
||||
"基础配置",
|
||||
"入站代理",
|
||||
"出站代理",
|
||||
"底层传输",
|
||||
"Xray Features",
|
||||
"Config Reference",
|
||||
"Inbound Protocol",
|
||||
"Outbound Protocol",
|
||||
"Stream Transport Protocol",
|
||||
"/en/config/"
|
||||
),
|
||||
"/en/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
||||
"小小白白话文",
|
||||
"Beginner Tutorial",
|
||||
"/en/document/level-0/"
|
||||
),
|
||||
"/en/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
||||
"入门技巧",
|
||||
"Getting Started Tips",
|
||||
"/en/document/level-1/"
|
||||
),
|
||||
"/en/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
||||
"进阶技巧",
|
||||
"Advanced Documentation",
|
||||
"/en/document/level-2/"
|
||||
),
|
||||
"/en/development/": sidebar.getDevelopmentSidebar(
|
||||
"开发指南",
|
||||
"协议详解",
|
||||
"Developer Guide",
|
||||
"Protocol Details",
|
||||
"/en/development/"
|
||||
),
|
||||
},
|
||||
|
@ -10,9 +10,9 @@ export const hans: NavbarConfig = [
|
||||
|
||||
// TODO: translation
|
||||
export const en: NavbarConfig = [
|
||||
{ text: "首页", link: "/en" },
|
||||
{ text: "大史记", link: "/en/about/news.md" },
|
||||
{ text: "配置指南", link: "/en/config/" },
|
||||
{ text: "开发指南", link: "/en/development/" },
|
||||
{ text: "使用指南", link: "/en/document/" },
|
||||
{ text: "Homepage", link: "/en" },
|
||||
{ text: "Website History", link: "/en/about/news.md" },
|
||||
{ text: "Config Reference", link: "/en/config/" },
|
||||
{ text: "Developer Guide", link: "/en/development/" },
|
||||
{ text: "Quick Start", link: "/en/document/" },
|
||||
];
|
||||
|
@ -32,7 +32,7 @@ Websocket 会识别 HTTP 请求的 X-Forwarded-For 头来覆写流量的源地
|
||||
|
||||
填写 `true` 时,最底层 TCP 连接建立后,请求方必须先发送 PROXY protocol v1 或 v2,否则连接会被关闭。
|
||||
|
||||
> `path` string
|
||||
> `path`: string
|
||||
|
||||
WebSocket 所使用的 HTTP 协议路径,默认值为 `"/"`。
|
||||
|
||||
|
@ -4,34 +4,33 @@
|
||||
|
||||
## Background
|
||||
|
||||
基于 [一年前的想法](https://github.com/v2ray/discussion/issues/754#issuecomment-647934994) ,利用原生 JS 实现了简洁的 WSS Browser Dialer,达到了真实浏览器的 TLS 指纹、行为特征。
|
||||
|
||||
不过 WSS 仍存在 ALPN 明显的问题,所以下一步是浏览器转发 `HTTP/2`,`QUIC`。
|
||||
Based on [an idea from 2020](https://github.com/v2ray/discussion/issues/754#issuecomment-647934994), a concise `WSS Browser Dialer` has been implemented using native `JS`, achieving true browser TLS fingerprints and behavioral characteristics.
|
||||
However, `WSS` still has significant issues with `ALPN`, so the next step is to forward `HTTP/2` and `QUIC` through the browser."
|
||||
|
||||
## Xray & JS
|
||||
|
||||
创造了一个非常简单、巧妙的通信机制:
|
||||
A very simple and clever communication mechanism has been created:
|
||||
|
||||
- Xray 监听地址端口 A,作为 HTTP 服务,浏览器访问 A,加载网页中的 JS。
|
||||
- JS 主动向 A 建立 WebSocket 连接,成功后,Xray 将连接发给 channel。
|
||||
- 需要建立连接时,Xray 从 channel 接收一个可用的连接,并发送目标 URL 和可选的 early data。
|
||||
- JS 成功连接到目标后告知 Xray,并继续用这个 conn 全双工双向转发数据,连接关闭行为同步。
|
||||
- 连接使用后就会被关闭,但 JS 会确保始终有新空闲连接可用。
|
||||
- Xray listens on address port `A` as an `HTTP` service, and the browser accesses `A` to load the `JS` in the webpage.
|
||||
- The `JS` actively establishes a WebSocket connection to `A`. After a successful connection, Xray sends the connection to the channel.
|
||||
- When a connection needs to be established, Xray receives an available connection from the channel and sends the target URL and optional early data.
|
||||
- Once the `JS` successfully connects to the target, it informs Xray and continues to use this conn to bi-directionally forward data. Connection closing behavior is synchronized.
|
||||
- After the connection is used, it will be closed, but the JS ensures that there is always a new idle connection available."
|
||||
|
||||
## Early data
|
||||
|
||||
根据浏览器的需求,对 early data 机制进行了如下调整:
|
||||
According to the browser's needs, the early data mechanism has been adjusted as follows:
|
||||
|
||||
- 服务端响应头会带有请求的 `Sec-WebSocket-Protocol`,这也初步混淆了 WSS 握手响应的长度特征。
|
||||
- 用于浏览器的 early data 编码是 `base64.RawURLEncoding` 而不是 `StdEncoding`,服务端做了兼容。
|
||||
- 此外,由于 [Xray-core#375](https://github.com/XTLS/Xray-core/pull/375) 推荐 `?ed=2048`,这个 PR 顺便将服务端一处 `MaxHeaderBytes` 扩至了 4096。 ~~(虽然好像不改也没问题)~~
|
||||
- The server response header will contain the requested `Sec-WebSocket-Protocol`, which also initially obfuscates the length characteristic of the WSS handshake response.
|
||||
- The encoding used for early data for browsers is `base64.RawURLEncoding` instead of `StdEncoding`, and the server has made it compatible.
|
||||
- In addition, due to [Xray-core#375](https://github.com/XTLS/Xray-core/pull/375) recommendations for `?ed=2048`, this PR also increased server `MaxHeaderBytes` by 4096. ~~(Although it seems like it would work without modification.)~~
|
||||
|
||||
## Configuration <Badge text="v1.4.1" type="warning"/>
|
||||
|
||||
这是一个探索的过程,目前两边都是 Xray-core v1.4.1 时的配置方式:
|
||||
This is an exploratory process, and the configuration method used when both sides are Xray-core v1.4.1 is as follows:
|
||||
|
||||
- 准备一份可用的 WSS 配置,注意 address 必须填域名,若需要指定 IP,请配置 DNS 或系统 hosts。
|
||||
- 若浏览器的流量也会经过 Xray-core,务必将这个域名设为直连,否则会造成流量回环。
|
||||
- 设置环境变量指定要监听的地址端口,比如 `XRAY_BROWSER_DIALER = 127.0.0.1:8080`。
|
||||
- 先运行 Xray-core,再用任意浏览器访问上面指定的地址端口,还可以 `F12` 看 `Console` 和 `Network`。
|
||||
- 浏览器会限制 WebSocket 连接数,所以建议开启 `Mux.Cool`。
|
||||
- Prepare a usable WSS configuration, making sure to fill in the domain name for the address. If you need to specify an IP address, configure DNS or system hosts.
|
||||
- If browser traffic will also pass through Xray-core, be sure to set this domain name as a direct connection, otherwise it will cause traffic looping.
|
||||
- Set the environment variable to specify the address port to listen on, such as `XRAY_BROWSER_DIALER = 127.0.0.1:8080`.
|
||||
- First run Xray-core, then use any browser to access the specified address port, and you can also check `Console` and Network with `F12`.
|
||||
- The browser will limit the number of WebSocket connections, so it is recommended to enable `Mux.Cool`.
|
||||
|
@ -1,14 +1,13 @@
|
||||
# 环境变量
|
||||
# Environment Variables
|
||||
|
||||
Xray 提供以下环境变量以供修改 Xray 的一些底层配置。
|
||||
Xray provides the following environment variables for modifying some of its underlying configurations.
|
||||
|
||||
## 资源文件路径
|
||||
## Xray Asset Location
|
||||
|
||||
- 名称:`xray.location.asset` 或 `XRAY_LOCATION_ASSET`。
|
||||
- 默认值:特定 [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) 目录或 Xray 文件同路径。
|
||||
- Name:`xray.location.asset` or `XRAY_LOCATION_ASSET`。
|
||||
- Default value:specified [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) directory or the same path as the Xray file.
|
||||
|
||||
这个环境变量指定了一个文件夹位置,这个文件夹应当包含 geoip.dat 和 geosite.dat 文件。
|
||||
若无指定变量值,程序将会按以下顺序寻找资源文件:
|
||||
This environment variable specifies a folder location that should contain the `geoip.dat` and `geosite.dat` files. If no variable value is specified, the program will search for resource files in the following order:
|
||||
|
||||
```
|
||||
./
|
||||
@ -16,16 +15,16 @@ Xray 提供以下环境变量以供修改 Xray 的一些底层配置。
|
||||
/usr/share/xray
|
||||
```
|
||||
|
||||
## 配置文件位置
|
||||
## Configuration File Location
|
||||
|
||||
- 名称:`xray.location.config` 或 `XRAY_LOCATION_CONFIG`。
|
||||
- 默认值:和 Xray 文件同路径。
|
||||
- Name:`xray.location.config` or `XRAY_LOCATION_CONFIG`。
|
||||
- Default value: Same path as the Xray file.
|
||||
|
||||
这个环境变量指定了一个文件夹位置,这个文件夹应当包含 config.json 文件。
|
||||
This environment variable specifies a folder location that should contain the `config.json` file.
|
||||
|
||||
## 多配置目录
|
||||
## Multiple Configuration Directories
|
||||
|
||||
- 名称:`xray.location.confdir` 或 `XRAY_LOCATION_CONFDIR`。
|
||||
- 默认值:`""`。
|
||||
- Name:`xray.location.confdir` or `XRAY_LOCATION_CONFDIR`。
|
||||
- Default value:`""`。
|
||||
|
||||
这个目录内的 `.json` 文件会按文件名顺序读取,作为多配置选项。
|
||||
The `.json` files in this directory will be read in alphabetical order by filename and used as options for multiple configurations.
|
||||
|
@ -1,14 +1,14 @@
|
||||
# Fallback 回落
|
||||
# Fallback
|
||||
|
||||
> **Fallback 是 Xray 的最强大功能之一, 可有效防止主动探测, 自由配置常用端口多服务共享**
|
||||
> **Fallback is one of the most powerful features of Xray, which can effectively prevent active probing and allows you to use one port for multiple services**
|
||||
|
||||
fallback 为 Xray 提供了高强度的防主动探测性, 并且具有独创的首包回落机制.
|
||||
Fallback provides Xray with high-strength anti-active probing capabilities and has a unique first-packet fallback mechanism.
|
||||
|
||||
fallback 也可以将不同类型的流量根据 path 进行分流, 从而实现一个端口, 多种服务共享.
|
||||
Fallback can also divide traffic of different types based on path for multi-service sharing on a single port.
|
||||
|
||||
目前您可以在使用 VLESS 或者 trojan 协议时, 通过配置 fallbacks 来使用回落这一特性, 并且创造出非常丰富的组合玩法.
|
||||
Currently, you can use the fallback feature by configuring fallbacks when using VLESS or Trojan protocols, thus creating an unimaginable combo of services becomes REALITY.
|
||||
|
||||
## fallbacks 配置
|
||||
## fallbacks configuration
|
||||
|
||||
```json
|
||||
"fallbacks": [
|
||||
@ -20,7 +20,7 @@ fallback 也可以将不同类型的流量根据 path 进行分流, 从而实现
|
||||
|
||||
> `fallbacks`: \[ [FallbackObject](#fallbackobject) \]
|
||||
|
||||
一个数组,包含一系列强大的回落分流配置。
|
||||
**`fallbacks` is an array, and here is an example configuration of one of its child elements.**
|
||||
|
||||
### FallbackObject
|
||||
|
||||
@ -34,67 +34,65 @@ fallback 也可以将不同类型的流量根据 path 进行分流, 从而实现
|
||||
}
|
||||
```
|
||||
|
||||
**`fallbacks` 是一个数组,这里是其中一个子元素的配置说明。**
|
||||
The `fallbacks` object is optional and can only be used for the `TCP+TLS` transport combination.
|
||||
|
||||
`fallbacks` 项是可选的,只能用于 TCP+TLS 传输组合
|
||||
- When `fallbacks` configure with any child elements,`"alpn":["http/1.1"]` needs to be configured in [Inbound TLS](../transport.md#tlsobject).
|
||||
|
||||
- 该项有子元素时,[Inbound TLS](../transport.md#tlsobject) 需设置 `"alpn":["http/1.1"]`。\*\*
|
||||
Usually, you need to set up a default fallback with both `alpn` and `path` omitted or empty, and then configure other routing rules as needed.
|
||||
|
||||
通常,你需要先设置一组 `alpn` 和 `path` 均省略或为空的默认回落,然后再按需配置其它分流。
|
||||
VLESS will forward traffic with TLS decrypted first packet length <18, invalid protocol version, or failed authentication to the address specified by `dest`.
|
||||
|
||||
VLESS 会把 TLS 解密后首包长度 < 18 或协议版本无效、身份认证失败的流量转发到 `dest` 指定的地址。
|
||||
|
||||
其它传输组合必须删掉 `fallbacks` 项或所有子元素,此时也不会开启 Fallback,VLESS 会等待读够所需长度,协议版本无效或身份认证失败时,将直接断开连接。
|
||||
For other transport combinations, you must remove the `fallbacks` object or all its child elements. At this point, no `fallbacks` will be enabled, and VLESS will wait until it reads enough data. If the protocol version is invalid or authentication fails, the connection will be terminated directly.
|
||||
|
||||
> `name`: string
|
||||
|
||||
尝试匹配 TLS SNI(Server Name Indication),空为任意,默认为 ""
|
||||
Attempt to match the TLS SNI (Server Name Indication), where an empty value matches any SNI. The default value is `""`, which means empty value.
|
||||
|
||||
> `alpn`: string
|
||||
|
||||
尝试匹配 TLS ALPN 协商结果,空为任意,默认为 ""
|
||||
Attempt to match the result of TLS ALPN negotiation, where an empty value matches any ALPN result. The default value is `""` , which means empty value.
|
||||
|
||||
有需要时,VLESS 才会尝试读取 TLS ALPN 协商结果,若成功,输出 info `realAlpn =` 到日志。
|
||||
用途:解决了 Nginx 的 h2c 服务不能同时兼容 http/1.1 的问题,Nginx 需要写两行 listen,分别用于 1.1 和 h2c。
|
||||
注意:fallbacks alpn 存在 `"h2"` 时,[Inbound TLS](../transport.md#tlsobject) 需设置 `"alpn":["h2","http/1.1"]`,以支持 h2 访问。
|
||||
VLESS will read the TLS ALPN negotiation result only when necessary. If successful, it will output `realAlpn =` info to the log.
|
||||
Purpose: To solve the problem of Nginx's inability to simultaneously support http/1.1 and h2c services. Nginx needs to write two lines of listen, one for 1.1 and one for h2c.
|
||||
Note: When `"h2"` is included in fallbacks alpn, the Inbound TLS needs to be set as `"alpn":["h2","http/1.1"]` to support `h2` access.
|
||||
|
||||
::: tip
|
||||
Fallback 内设置的 `alpn` 是匹配实际协商出的 ALPN,而 Inbound TLS 设置的 `alpn` 是握手时可选的 ALPN 列表,两者含义不同。
|
||||
The `alpn` set in the Fallback is used to match the actual negotiated ALPN, while the `alpn` set in the Inbound TLS represents the list of optional ALPNs during the handshake. These two have different meanings.
|
||||
:::
|
||||
|
||||
> `path`: string
|
||||
|
||||
尝试匹配首包 HTTP PATH,空为任意,默认为空,非空则必须以 `/` 开头,不支持 h2c。
|
||||
Attempt to match the first packet HTTP PATH, where an empty value matches any PATH and a default value is empty. If non-empty, it must start with `/`, and h2c is not supported.
|
||||
|
||||
智能:有需要时,VLESS 才会尝试看一眼 PATH(不超过 55 个字节;最快算法,并不完整解析 HTTP),若成功,输出 INFO 日志 `realPath =`。
|
||||
用途:分流其它 inbound 的 WebSocket 流量或 HTTP 伪装流量,没有多余处理、纯粹转发流量,理论性能比 Nginx 更强。
|
||||
Smart: VLESS will only attempt to check the PATH (no more than 55 bytes; the fastest algorithm that does not fully parse HTTP) when necessary. If successful, it will output `realPath =` in the INFO log.
|
||||
Purpose: To route other inbound WebSocket traffic or HTTP disguised traffic, without additional processing, purely forwarding traffic, and theoretically better performance than Nginx.
|
||||
|
||||
注意:**fallbacks 所在入站本身必须是 TCP+TLS**,这是分流至其它 WS 入站用的,被分流的入站则无需配置 TLS。
|
||||
Note: **The inbound where fallbacks is located must be TCP+TLS**. This is for routing to other WebSocket inbound, while the inbound being routed doesn't need to configure TLS.
|
||||
|
||||
> `dest`: string | number
|
||||
|
||||
决定 TLS 解密后 TCP 流量的去向,目前支持两类地址:(该项必填,否则无法启动)
|
||||
Determines the destination of decrypted TLS TCP traffic, which currently supports two types of addresses: (this field is required, otherwise it cannot be started)
|
||||
|
||||
1. TCP,格式为 `"addr:port"`,其中 addr 支持 IPv4、域名、IPv6,若填写域名,也将直接发起 TCP 连接(而不走内置的 DNS)。
|
||||
2. Unix domain socket,格式为绝对路径,形如 `"/dev/shm/domain.socket"`,可在开头加 `@` 代表 [abstract](https://www.man7.org/linux/man-pages/man7/unix.7.html),`@@` 则代表带 padding 的 abstract。
|
||||
1. TCP, in the format of `"addr:port"`, where addr supports IPv4, domain names, and IPv6. If a domain name is entered, a direct TCP connection will be made (rather than using the built-in DNS resolver).
|
||||
2. Unix domain socket, in the format of an absolute path, such as `"/dev/shm/domain.socket"`, which can be prefixed with `@` to represent [abstract](https://www.man7.org/linux/man-pages/man7/unix.7.html), and `@@` to represent padded abstract.
|
||||
|
||||
若只填 port,数字或字符串均可,形如 `80`、`"80"`,通常指向一个明文 http 服务(addr 会被补为 `"127.0.0.1"`)。
|
||||
If only the port is specified, both numbers and strings are accepted, such as `80` or `"80"`. This usually points to a plaintext HTTP service (and the addr will be filled in as `"127.0.0.1"`).
|
||||
|
||||
> `xver`: number
|
||||
|
||||
发送 [PROXY protocol](https://www.haproxy.org/download/2.2/doc/proxy-protocol.txt),专用于传递请求的真实来源 IP 和端口,填版本 1 或 2,默认为 0,即不发送。若有需要建议填 1。
|
||||
Sends the [PROXY protocol](https://www.haproxy.org/download/2.2/doc/proxy-protocol.txt) protocol, which is used to transmit the real source IP and port of the request. The version can be set to `1` or `2`, with a default value of `0`, which means no PROXY protocol is sent. Version `1` is recommended if needed.
|
||||
|
||||
目前填 1 或 2,功能完全相同,只是结构不同,且前者可打印,后者为二进制。Xray 的 TCP 和 WS 入站均已支持接收 PROXY protocol。
|
||||
Currently, versions `1` and `2` have the same functionality but different structures, where version `1` is printable while version 2 is `binary`. Xray's `TCP` and `WebSocket` inbound already support receiving the PROXY protocol.
|
||||
|
||||
::: warning
|
||||
若你正在 [配置 Nginx 接收 PROXY protocol](https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#configuring-nginx-to-accept-the-proxy-protocol),除了设置 proxy_protocol 外,还需设置 set_real_ip_from,否则可能会出问题。
|
||||
If you are [configuring Nginx to receive the PROXY protocol](https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#configuring-nginx-to-accept-the-proxy-protocol), you need to not only set `proxy_protocol`, but also `set_real_ip_from` to avoid potential issues.
|
||||
:::
|
||||
|
||||
### 补充说明
|
||||
### Additional Information
|
||||
|
||||
- 将匹配到最精确的子元素,与子元素的排列顺序无关。若配置了几个 alpn 和 path 均相同的子元素,则会以最后的为准。
|
||||
- 回落分流均是解密后 TCP 层的转发,而不是 HTTP 层,只在必要时检查首包 PATH。
|
||||
- 您可以查看更多的关于 Fallbacks 的使用技巧和心得
|
||||
- [Fallbacks 功能简析](../../document/level-1/fallbacks-lv1)
|
||||
- Matches the most precise sub-element, regardless of the order of arrangement of the sub-elements. If several sub-elements have the same `alpn` and `path` configurations, the last one specified will be used.
|
||||
- Fallback routing is performed at the decrypted TCP layer rather than the HTTP layer, and the first packet PATH is only checked when necessary.
|
||||
- You can learn more about tips and experiences in using Fallbacks by visiting
|
||||
- [An Analysis of Fallback Functionality.](../../document/level-1/fallbacks-lv1)
|
||||
|
||||
## Fallbacks 设计理论 <Badge text="WIP" type="warning"/>
|
||||
## Fallbacks design theory <Badge text="WIP" type="warning"/>
|
||||
|
@ -1,32 +1,32 @@
|
||||
# 多文件配置
|
||||
# Multi-file configuration
|
||||
|
||||
Xray 程序支持使用多个配置文件。
|
||||
The Xray program supports the use of multiple configuration files.
|
||||
|
||||
多配置文件的主要作用在于分散不同作用模块配置,便于管理和维护。
|
||||
The main purpose of using multiple configuration files is to distribute different module configurations, making it easier to manage and maintain.
|
||||
|
||||
该功能主要考虑是为了丰富 Xray 的生态链,比如对于 GUI 的客户端,一般只实现节点选择等固定的功能,对于太复杂的配置难以图形化实现;只需留一个 `confdir` 的自定义配置目录供配置复杂的功能;对于服务器的部署脚本,只需往 `confdir` 添加文件即可实现配置多种协议。
|
||||
This feature is mainly designed to enrich the Xray ecosystem. For example, for GUI-based clients, only fixed functions such as node selection are usually implemented, and complex configurations are difficult to implement graphically. By leaving a custom `confdir` configuration directory for complex functions, server deployment scripts can simply add files to `confdir` to implement multiple protocol configurations.
|
||||
|
||||
## 多文件启动
|
||||
## Multi-file startup
|
||||
|
||||
::: tip
|
||||
启动信息中会提示依次读入的每个配置文件,留意启动信息是否符合你预设的顺序。
|
||||
The startup information will indicate each configuration file being read in sequence. Please pay attention to whether the startup information matches the order you have set.
|
||||
:::
|
||||
|
||||
```shell
|
||||
$ xray run -confdir /etc/xray/confs
|
||||
```
|
||||
|
||||
也可使用 `Xray.location.confdir` 或 `Xray_LOCATION_CONFDIR` 指定 `confdir`。
|
||||
You can also use `Xray.location.confdir` or `Xray_LOCATION_CONFDIR` to specify the `confdir`.
|
||||
|
||||
参数 `-confdir` 的作用优先于环境变量,如果参数指定了有效的目录则不再读取环境变量中的路径。
|
||||
The `-confdir` parameter takes precedence over the environment variable. If a valid directory is specified by the parameter, the path in the environment variable will not be read.
|
||||
|
||||
## 规则说明
|
||||
## Rule Explaination
|
||||
|
||||
### 普通对象(`{}`)
|
||||
### Normal Objects(`{}`)
|
||||
|
||||
**在 json 的顶级对象当中,后者覆盖或补充前者。**
|
||||
**In the top-level object of `JSON`, the latter overrides or supplements the former.**
|
||||
|
||||
比如:
|
||||
For ecample:
|
||||
|
||||
- base.json
|
||||
|
||||
@ -51,15 +51,15 @@ $ xray run -confdir /etc/xray/confs
|
||||
}
|
||||
```
|
||||
|
||||
以多配置启动 Xray:
|
||||
When starting Xray with multiple configurations, use the following command:
|
||||
|
||||
```bash
|
||||
$ xray run -confdir /etc/xray/confs
|
||||
```
|
||||
|
||||
这两个配置文件的就等效于合成一起的整配置。当需要修改出口节点,只需要修改 `outbounds.json` 内容。
|
||||
These two configuration files are equivalent to a single combined configuration. If you need to modify the outbound nodes, simply modify the content of `outbounds.json`.
|
||||
|
||||
如果需要改编日志 log 的级别,也不需要改 `base.json`,只需后续增加一个配置:
|
||||
If you need to change the log level for debugging purposes, there is no need to modify `base.json`. You can add an additional configuration file:
|
||||
|
||||
- debuglog.json
|
||||
|
||||
@ -71,20 +71,20 @@ $ xray run -confdir /etc/xray/confs
|
||||
}
|
||||
```
|
||||
|
||||
启动顺序放置在 base 后,即可输出 debug 级别的日志
|
||||
Start the program in sequence after `base.json` to output logs at the debug level.
|
||||
|
||||
### 数组(`[]`)
|
||||
### Arrays(`[]`)
|
||||
|
||||
在 json 配置中的`inbounds`和`outbounds`是数组结构,他们有特殊的规则:
|
||||
In the JSON configuration, `inbounds` and `outbounds` are array structures with special rules:
|
||||
|
||||
- 当配置中的数组元素有 2 或以上,覆盖前者的 inbounds/oubounds;
|
||||
- 当配置中的数组元素只有 1 个时,查找原有`tag`相同的元素进行覆盖;若无法找到:
|
||||
- 对于 inbounds,添加至最后(inbounds 内元素顺序无关)
|
||||
- 对于 outbounds,添加至最前(outbounds 默认首选出口);但如果文件名含有 tail(大小写均可),添加至最后。
|
||||
- When there are two or more elements in the array, the latter overrides the former for `inbounds`/`outbounds`.
|
||||
- When there is only one element in the array, it searches for an existing element with the same `tag` to override. If it cannot be found:
|
||||
- For `inbounds`, add it to the end (the order of elements in `inbounds` is irrelevant).
|
||||
- For `outbounds`, add it to the beginning (the default first-choice outbound). However, if the filename contains "tail" (case-insensitive), add it to the end.
|
||||
|
||||
借助多配置,可以很方便为原有的配置添加不同协议的 inbound,而不必修改原有配置。
|
||||
With multiple configurations, it is easy to add inbound for different protocols to the original configuration without modifying the original configuration.
|
||||
|
||||
以下例子不是有效配置,只为展示上述规则。
|
||||
The following example is not a valid configuration but is provided to demonstrate the above rules.
|
||||
|
||||
- 000.json
|
||||
|
||||
@ -127,7 +127,7 @@ $ xray run -confdir /etc/xray/confs
|
||||
}
|
||||
```
|
||||
|
||||
三个配置将会合成为:
|
||||
The three configurations will be combined into:
|
||||
|
||||
```json
|
||||
{
|
||||
@ -145,15 +145,15 @@ $ xray run -confdir /etc/xray/confs
|
||||
}
|
||||
```
|
||||
|
||||
## 推荐的多文件列表
|
||||
## Recommended Multi-file List
|
||||
|
||||
执行:
|
||||
Execute:
|
||||
|
||||
```bash
|
||||
for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do echo '{}' > "/etc/Xray/$BASE.json"; done
|
||||
```
|
||||
|
||||
或
|
||||
or
|
||||
|
||||
```bash
|
||||
for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do echo '{}' > "/usr/local/etc/Xray/$BASE.json"; done
|
||||
|
@ -1,5 +1,5 @@
|
||||
# XTLS 深度剖析
|
||||
# Deep analysis of XTLS
|
||||
|
||||
> **XTLS 是 Xray 的原创黑科技, 也是使 Xray 性能一骑绝尘的核心动力**
|
||||
> **"XTLS is the original black technology of Xray, and also the core driving force that makes Xray's performance far superior."**
|
||||
|
||||
<Badge text="WIP" type="warning"/>
|
||||
|
@ -128,7 +128,7 @@ Type of obfuscation. Corresponding inbound and outbound must have the same value
|
||||
|
||||
The original KCP protocol uses a fixed header of 24 bytes, while mKCP modifies it to 18 bytes for data packets and 16 bytes for acknowledgement (ACK) packets. A smaller header helps evade feature detection and speeds up transmission.
|
||||
|
||||
In addition, the original KCP can only confirm that one packet has been received with a single ACK packet. This means that when KCP needs to confirm that 100 packets have been received, it will send out 2400 bytes of data (24 _ 100), including a large amount of repeated header information that wastes bandwidth. mKCP compresses multiple ACK packets, so 100 ACK packets only require 418 bytes (16 + 2 + 100 _ 4), which is equivalent to one-sixth of the original KCP.
|
||||
In addition, the original KCP can only confirm that one packet has been received with a single ACK packet. This means that when KCP needs to confirm that 100 packets have been received, it will send out 2400 bytes of data (24 x 100), including a large amount of repeated header information that wastes bandwidth. mKCP compresses multiple ACK packets, so 100 ACK packets only require 418 bytes (16 + 2 + 100 x 4), which is equivalent to one-sixth of the original KCP.
|
||||
|
||||
### ACK packet retransmission
|
||||
|
||||
|
@ -32,7 +32,7 @@ Common reverse proxy software (such as HAProxy and Nginx) can be configured to s
|
||||
|
||||
When filled in as `true`, after the underlying TCP connection is established, the requesting party must first send PROXY protocol v1 or v2, otherwise the connection will be closed.
|
||||
|
||||
> `path` string
|
||||
> `path`: string
|
||||
|
||||
The HTTP protocol path used by WebSocket. Default is `"/"`
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user