diff --git a/docs/en/config/transports/finalmask.md b/docs/en/config/transports/finalmask.md index 9c90c967..aac94b4a 100644 --- a/docs/en/config/transports/finalmask.md +++ b/docs/en/config/transports/finalmask.md @@ -1,6 +1,6 @@ # FinalMask -FinalMask performs the last stage of traffic obfuscation after the core has already processed transport-layer security, including TLS and REALITY. +FinalMask performs the last stage of traffic camouflage after the core has already processed transport-layer encryption, including TLS and REALITY. It can be used for multiple kinds of TCP and UDP camouflage, as well as QUIC-related parameter tuning. @@ -55,19 +55,31 @@ It can be used for multiple kinds of TCP and UDP camouflage, as well as QUIC-rel } ``` -> `tcp[n].type`: header-custom | fragment | sudoku +## TCPMask -The first item in the array is the outermost camouflage layer. +An array used to camouflage TCP traffic emitted by the core. The first item in the array is the outermost camouflage layer. -Used together with `raw`, `httpupgrade`, `websocket`, `grpc`, and `xhttp`. +```json +{ + "finalmask": { + // [!code focus:6] + "tcp": [ + { + "type": "", + "settings": {} + } + ] + } +} +``` -`header-custom`: +> `type`: header-custom | fragment | sudoku -`fragment`: +The type of this camouflage layer. -`sudoku`: +> `settings`: header-custom | fragment | sudoku -> `tcp[n].settings`: header-custom | fragment | sudoku +The concrete settings for this camouflage type. See the fields for each type below. ### header-custom @@ -130,6 +142,20 @@ Used together with `raw`, `httpupgrade`, `websocket`, `grpc`, and `xhttp`. } ``` +Controls outgoing TCP fragmentation. In some cases it can deceive censorship systems, for example by bypassing SNI blacklists. + +`"length"`, `"delay"`, and `"maxSplit"` are all [Int32Range](../../development/intro/guide.md#int32range) values. + +`"packets"`: supports two fragmentation modes. `"1-3"` slices the TCP stream and applies to the client's 1st through 3rd write operations. `"tlshello"` fragments the TLS handshake packet. + +`"length"`: fragment size in bytes. It must not be `0`. + +`"delay"`: delay between fragments in milliseconds. + +When it is `0` and `"packets": "tlshello"` is set, the fragmented Client Hello will be sent in a single TCP packet, as long as its original size does not exceed the MSS or MTU and the system does not fragment it automatically. + +`"maxSplit"`: maximum number of splits. This limits how many pieces a single packet can be broken into. `0` means unlimited. + ### sudoku ```json @@ -147,52 +173,36 @@ Used together with `raw`, `httpupgrade`, `websocket`, `grpc`, and `xhttp`. For the meaning of these fields, see the [upstream documentation](https://github.com/SUDOKU-ASCII/sudoku/blob/main/configs/README.md). -> `udp[n].type`: header-custom | header-dns | header-dtls | header-srtp | header-utp | header-wechat | header-wireguard | mkcp-original | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp +## UDPMask -The first item in the array is the outermost camouflage layer. +An array used to camouflage UDP traffic emitted by the core. The first item in the array is the outermost camouflage layer. -Used together with `raw` UDP, `kcp`, `hysteria`, and `xhttp` H3. +```json +{ + "finalmask": { + // [!code focus:6] + "udp": [ + { + "type": "", + "settings": {} + } + ] + } +} +``` -`header-custom`: always prepended to the packet as a combined header. +> `type`: header-custom | header-dns | header-dtls | header-srtp | header-utp | header-wechat | header-wireguard | mkcp-original | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp -`header-dns`: the old mKCP DNS camouflage. Some campus networks permit DNS requests before login, so this adds a DNS header to KCP. +The type of this camouflage layer. -`header-dtls`: the old mKCP DTLS camouflage. It imitates DTLS 1.2 packets. No extra settings. +> `settings`: header-custom | header-dns | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp -`header-srtp`: the old mKCP SRTP camouflage. It imitates SRTP packets and tends to look like video-call traffic such as FaceTime. No extra settings. - -`header-utp`: the old mKCP uTP camouflage. It imitates uTP packets and tends to look like BitTorrent traffic. No extra settings. - -`header-wechat`: the old mKCP WeChat Video camouflage. It imitates WeChat video-call packets. No extra settings. - -`header-wireguard`: the old mKCP WireGuard camouflage. It imitates WireGuard packets, though it is not the real WireGuard protocol. No extra settings. - -`mkcp-original`: the simple obfuscation that used to be the default in mKCP. You may need it to connect to older mKCP servers. No extra settings. - -`mkcp-aes128gcm`: the old mKCP `seed` feature. It uses AES-128-GCM for obfuscation. - -`noise`: noise sent before the actual payload. - -`salamander`: Salamander obfuscation from Hysteria2. - -`sudoku`: - -`xdns`: transmits data through DNS queries in a way similar to DNSTT. It performs standard DNS TXT queries to carry payload. - -Because of technical limitations, the effective MTU is very small and QUIC is not usable. It is recommended to pair it with mKCP. Recommended MTU values are 130 on the client and 900 on the server. - -Since the queries are standard DNS requests, they can be forwarded by any UDP DNS server, although the efficiency may be very poor. - -To use this feature, the server must listen on port 53, the proxy protocol must target a DNS server such as `8.8.8.8:53`, and you must own the `domain` used by xdns and point its NS record to the server. - -For example, if you own `example.com`, create an A record like `a.example.com` pointing to your server IP, then create an NS record like `t.example.com` pointing to `t.example.com`, and use `t.example.com` as the domain. The A record must not be a subdomain of the NS record. - -`xicmp`: requires at least `CAP_NET_RAW`, must be the outermost layer, which means the first array element, and cannot be used together with `udpHop` or `dialerProxy`. - -> `udp[n].settings`: header-custom | header-dns | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp +The concrete settings for this camouflage type. See the fields for each type below. ### header-custom +Always merged into the packet header. + ```json { "client": [ @@ -224,14 +234,42 @@ For example, if you own `example.com`, create an A record like `a.example.com` p ### header-dns +The old mKCP DNS camouflage. Some campus networks allow DNS queries before login, so this adds a DNS header to KCP. + ```json { "domain": "www.example.com" } ``` +### header-dtls + +The old mKCP DTLS camouflage. It disguises packets as DTLS 1.2 traffic. No extra settings. + +### header-srtp + +The old mKCP SRTP camouflage. It disguises packets as SRTP traffic and may be recognized as video-call traffic such as FaceTime. No extra settings. + +### header-utp + +The old mKCP uTP camouflage. It disguises packets as uTP traffic and may be recognized as BitTorrent download traffic. No extra settings. + +### header-wechat + +The old mKCP WeChat Video camouflage. It disguises packets as WeChat video-call traffic. No extra settings. + +### header-wireguard + +The old mKCP WireGuard camouflage. It disguises packets as WireGuard traffic, though it is not the real WireGuard protocol. No extra settings. + +### mkcp-original + +The simple obfuscation that used to be the default in mKCP. You may need it to connect to older mKCP servers. No extra settings. + ### mkcp-aes128gcm +Corresponds to the old mKCP `seed` feature. It uses AES-128-GCM for obfuscation. + ```json { "password": "your-password" @@ -240,9 +278,11 @@ For example, if you own `example.com`, create an A record like `a.example.com` p ### noise +Noise sent before the actual data. + ```json { - "reset": 0, + "reset": "30-60", "noise": [ { "rand": "1-8192", @@ -255,18 +295,22 @@ For example, if you own `example.com`, create an A record like `a.example.com` p } ``` -`noise[n].rand`: adds random bytes, or a specified random length of bytes. Conflicts with `packet`. +`reset`: an [Int32Range](../../development/intro/guide.md#int32range) value in seconds. After noise is sent, it resets after this duration so noise can be sent again to the same address. `0` means no reset, so it is sent only once. -`noise[n].randRange`: range of random-byte values. The default is `0-255`. +`rand`: adds random bytes, or random bytes of a specified length. Conflicts with `packet`. -`noise[n].type`: the type of `packet`. Supported values are `array`, `str`, `hex`, and `base64`. The default is `array`. +`randRange`: range of random-byte values. The default is `0-255`. -`noise[n].packet`: adds fixed data. Conflicts with `rand`. +`type`: the type of `packet`. Supported values are `array`, `str`, `hex`, and `base64`. The default is `array`. -`noise[n].delay`: delay in milliseconds. After sending one noise item, Xray waits for the specified time before sending the next one. +`packet`: adds fixed data. Conflicts with `rand`. + +`delay`: delay in milliseconds. After one noise item is sent, wait for the specified time before sending the next one. ### salamander +Salamander obfuscation. From Hysteria2. + ```json { "password": "your-password" @@ -288,18 +332,37 @@ For example, if you own `example.com`, create an A record like `a.example.com` p } ``` -The same meanings as in the TCP version apply here. +Same as the TCP version. ### xdns +Uses DNS queries to transmit data, similar to DNSTT. It performs standard DNS queries to carry payloads and supports TXT, A, and AAAA query types. + +Because of technical limitations, the effective MTU is very small, QUIC cannot be used, and pairing it with mKCP is recommended. Recommended MTU values are 130 on the client side; on the server side, use 900 for TXT, which carries almost raw byte data, reduce appropriately to below 1/2 for AAAA, and below 1/8 for A. The theoretical encoding efficiency differs, while actual results depend on how many AAAA or A records intermediate forwarders tolerate in responses. + +Since the queries are standard, they can be forwarded through any UDP DNS server, although the efficiency may be quite poor. + +To use this feature, the server needs to listen on port 53, then the proxy protocol should point to a DNS server such as `8.8.8.8:53`, and you must own one of the domains in `domains`, then point its NS record to the server. + +For example, if you own `example.com`, set an A record like `a.example.com` to the server IP, set an NS record like `t.example.com` to `t.example.com`, and then use `t.example.com`. The host used for the A record must not be a subdomain of the host used for the NS record. + ```json { - "domain": "www.example.com" + "domains": ["t.example.com"], + "resolvers": ["t.example.com+udp://8.8.8.8:53"] } ``` +`domains`: used on the server side. A list of domains. It supports specifying a query type as `domain:method`, where `method` can be `txt`, `a`, or `aaaa`. If omitted, the query type is unrestricted. + +`resolvers`: used on the client side. A list of DNS resolvers. The format is `domain[:method]+udp://server:port`, where `method` can be `txt` (default), `a`, or `aaaa`. + +At least one of `domains` and `resolvers` must be set. + ### xicmp +Requires at least `CAP_NET_RAW` permissions and must be the outermost layer, which means the first item in the array. It cannot be used together with `udpHop` or `dialerProxy`. + ```json { "listenIp": "0.0.0.0", @@ -307,35 +370,38 @@ The same meanings as in the TCP version apply here. } ``` -`listenIp`: the IP address to listen on. Defaults to `"0.0.0.0"`. +`listenIp`: the IP address to listen on. The default is `"0.0.0.0"`. -Note that this differs from the usual TCP/UDP listening on `"0.0.0.0"` and `"::"`. Because ICMP over IPv4 and ICMPv6 over IPv6 are not interchangeable protocols, specifying `"0.0.0.0"` here means listening only for ICMP over IPv4, and vice versa. +Note that this differs from the usual TCP/UDP listening addresses `"0.0.0.0"` and `"::"`. Because ICMP over IPv4 and ICMPv6 over IPv6 are not interchangeable protocols, specifying `"0.0.0.0"` here means listening only for IPv4 ICMP, and the same applies in reverse. -`id`: when multiple clients share the same IP, it is recommended that the server keep this value at `0`. +`id`: if multiple clients share the same IP, it is recommended that the server keep this as `0`. -> `quicParams`: [quicParamsObject](#quicParams) - -### quicParams +## quicParams ```json { - "congestion": "force-brutal", - "bbrProfile": "standard", - "debug": false, - "brutalUp": "60 mbps", - "brutalDown": 0, - "udpHop": { - "ports": "20000-50000", - "interval": "5-10" - }, - "initStreamReceiveWindow": 8388608, - "maxStreamReceiveWindow": 8388608, - "initConnectionReceiveWindow": 20971520, - "maxConnectionReceiveWindow": 20971520, - "maxIdleTimeout": 30, - "keepAlivePeriod": 0, - "disablePathMTUDiscovery": false, - "maxIncomingStreams": 1024 + "finalmask": { + // [!code focus:19] + "quicParams": { + "congestion": "force-brutal", + "bbrProfile": "standard", + "debug": false, + "brutalUp": "60 mbps", + "brutalDown": 0, + "udpHop": { + "ports": "20000-50000", + "interval": "5-10" + }, + "initStreamReceiveWindow": 8388608, + "maxStreamReceiveWindow": 8388608, + "initConnectionReceiveWindow": 20971520, + "maxConnectionReceiveWindow": 20971520, + "maxIdleTimeout": 30, + "keepAlivePeriod": 0, + "disablePathMTUDiscovery": false, + "maxIncomingStreams": 1024 + } + } } ``` @@ -343,21 +409,23 @@ Used for QUIC parameter tuning in XHTTP H3 and Hysteria. > `congestion`: reno | bbr | brutal | force-brutal -Congestion-control algorithm. Hysteria defaults to `brutal`. XHTTP H3 defaults to `bbr`. +Congestion-control algorithm. Hysteria defaults to `brutal`, while XHTTP H3 defaults to `bbr`. `reno` and `bbr` are well-known algorithms. -`brutal` negotiates a fixed packet-sending rate with the peer, or falls back to BBR. It is supported only by Hysteria, because XHTTP has no negotiation mechanism. +`brutal`: negotiates a fixed packet-sending rate with the peer, or falls back to BBR. -`force-brutal` is the same as `brutal`, but it forcibly uses the fixed upstream rate from `brutalUp` and ignores peer negotiation. +`force-brutal`: same as `brutal`, but it forces upstream traffic to use the fixed packet-sending rate from `brutalUp`, ignoring peer negotiation. + +Note that XHTTP H3 cannot use `brutal` because it has no negotiation mechanism, but it does support `force-brutal`, which does not require negotiation. > `bbrProfile`: conservative | standard | aggressive -Controls the BBR preset when QUIC congestion control is set to BBR. Defaults to `standard`. `conservative` is slightly more cautious, `aggressive` is slightly more aggressive. +When QUIC congestion control is set to BBR, this controls the BBR preset. The default is `standard`. `conservative` is slightly more cautious, while `aggressive` is slightly more aggressive. > `debug`: false | true -Enable logging for the `bbr` and `brutal` congestion-control implementations. +Enables logs for `bbr` and `brutal` congestion control. > `brutalUp`: string @@ -365,23 +433,23 @@ Enable logging for the `bbr` and `brutal` congestion-control implementations. Upload and download rate limits. The default value is `0`. -The format is user-friendly and supports common bit-rate forms such as `1000000`, `100kb`, `20 mb`, `100 mbps`, `1g`, and `1 tbps`. It is case-insensitive, spaces are optional, and when no unit is given the default is `bps`. The value must not be lower than 65535 bps. +The format is user-friendly and supports many common bits-per-second notations, including `1000000`, `100kb`, `20 mb`, `100 mbps`, `1g`, and `1 tbps`. It is case-insensitive, spaces between units are optional, and if no unit is specified, the default is `bps`. The value must not be lower than 65535 bps. The negotiation behavior is the same as Hysteria Brutal: -The server-side value limits the highest Brutal-mode rate the client is allowed to choose. `0` means the client is not limited by the server. +The server-side value limits the highest Brutal-mode rate the client may choose. A value of `0` means the server does not limit the client. -When the client value is `0`, it uses BBR mode. When it is non-zero, it uses Brutal mode and is still constrained by the server-side limit. +If the client-side value is `0`, BBR mode is used. If it is non-zero, Brutal mode is used and is still constrained by the server-side limit. -Remember the directions are relative: the server's upload is the client's download, and the server's download is the client's upload. +Remember that direction is relative: the server's upload is the client's download, and the server's download is the client's upload. > `udpHop`: {"ports": string, "interval": number} UDP port-hopping configuration. -`ports` specifies the hopping range. It can be a single numeric string like `"1234"`, or a range like `"1145-1919"`, which means ports 1145 through 1919. Commas can be used to combine ranges, for example `11,13,15-17`. +`ports` is the hopping port range. It can be a numeric string such as `"1234"`, or a numeric range such as `"1145-1919"` for ports 1145 through 1919. Commas can be used to separate segments, for example `11,13,15-17`. -`interval` is the port-hopping interval in seconds. The minimum is 5. The default is 30 seconds. +`interval` is the port-hopping interval in seconds. It must be at least 5, and the default is 30 seconds. > `initStreamReceiveWindow`: number @@ -391,7 +459,7 @@ UDP port-hopping configuration. > `maxConnectionReceiveWindow`: number -These four are low-level QUIC window parameters. **Do not change them unless you fully understand what you are doing.** If you do need to change them, it is recommended to keep the ratio between stream and connection receive windows at 2:5. +These four are the concrete QUIC window parameters. **Do not change them unless you fully understand what you are doing.** If you do need to change them, it is recommended to keep the ratio between the stream receive window and the connection receive window at 2:5. > `maxIdleTimeout`: number @@ -403,10 +471,10 @@ QUIC KeepAlive interval in seconds. The supported range is 2 to 60 seconds. Disa > `disablePathMTUDiscovery`: bool -Whether to disable path MTU discovery. +Whether to disable Path MTU Discovery. -Other implementations forcibly disable this on systems other than Linux, Windows, and Darwin, while Xray does not enforce that. If your operating system is outside those three, you may need to disable it manually. +Other implementations forcibly disable this on operating systems other than Linux, Windows, and Darwin, while Xray does not force-disable it. If your OS is not one of `linux`, `windows`, or `darwin`, you may need to disable it manually. > `maxIncomingStreams`: number -Server-side only. If set, it must not be smaller than `8`. +Server-side parameter. If set, it must not be smaller than `8`. diff --git a/docs/ru/config/transports/finalmask.md b/docs/ru/config/transports/finalmask.md index fdf29d39..41502e28 100644 --- a/docs/ru/config/transports/finalmask.md +++ b/docs/ru/config/transports/finalmask.md @@ -1,8 +1,8 @@ # FinalMask -FinalMask добавляет последний слой маскировки после того, как ядро уже обработало защиту транспорта, включая TLS и REALITY. +FinalMask добавляет последний слой маскировки после того, как ядро уже обработало шифрование транспортного уровня, включая TLS и REALITY. -Он используется для разных вариантов TCP- и UDP-маскировки, а также для настройки параметров QUIC. +Его можно использовать для разных видов маскировки TCP- и UDP-трафика, а также для настройки параметров QUIC. ## FinalMaskObject @@ -55,19 +55,31 @@ FinalMask добавляет последний слой маскировки п } ``` -> `tcp[n].type`: header-custom | fragment | sudoku +## TCPMask -Первый элемент массива является самым внешним слоем маскировки. +Массив для маскировки TCP-трафика, исходящего из ядра. Первый элемент массива является самым внешним слоем маскировки. -Используется вместе с `raw`, `httpupgrade`, `websocket`, `grpc` и `xhttp`. +```json +{ + "finalmask": { + // [!code focus:6] + "tcp": [ + { + "type": "", + "settings": {} + } + ] + } +} +``` -`header-custom`: +> `type`: header-custom | fragment | sudoku -`fragment`: +Тип этого слоя маскировки. -`sudoku`: +> `settings`: header-custom | fragment | sudoku -> `tcp[n].settings`: header-custom | fragment | sudoku +Конкретные настройки для этого типа маскировки. Поля каждого типа приведены ниже. ### header-custom @@ -111,13 +123,13 @@ FinalMask добавляет последний слой маскировки п `clients[n][m].delay`: задержка в миллисекундах. Если значение равно `0`, данные отправляются слитно с предыдущим пакетом. -`clients[n][m].rand`: добавить заданное число случайных байт. Несовместимо с `packet`. +`clients[n][m].rand`: добавляет указанное количество случайных байтов. Несовместимо с `packet`. -`clients[n][m].randRange`: диапазон значений случайных байт. По умолчанию `0-255`. +`clients[n][m].randRange`: диапазон значений случайных байтов. По умолчанию `0-255`. -`clients[n][m].type`: тип `packet`. Поддерживаются `array`, `str`, `hex` и `base64`. Значение по умолчанию — `array`. +`clients[n][m].type`: тип `packet`. Поддерживаются `array`, `str`, `hex` и `base64`. Значение по умолчанию - `array`. -`clients[n][m].packet`: добавить фиксированные данные. Несовместимо с `rand`. +`clients[n][m].packet`: добавляет фиксированные данные. Несовместимо с `rand`. ### fragment @@ -130,6 +142,20 @@ FinalMask добавляет последний слой маскировки п } ``` +Управляет исходящей TCP-фрагментацией. В некоторых случаях это может обмануть системы цензуры, например помочь обойти SNI-блоклисты. + +`"length"`, `"delay"` и `"maxSplit"` имеют тип [Int32Range](../../development/intro/guide.md#int32range). + +`"packets"`: поддерживаются два режима фрагментации. `"1-3"` разрезает TCP-поток и применяется к 1-й, 2-й и 3-й операциям записи клиента. `"tlshello"` фрагментирует пакет TLS-рукопожатия. + +`"length"`: длина фрагмента в байтах. Не может быть `0`. + +`"delay"`: интервал между фрагментами в миллисекундах. + +Если значение равно `0` и задано `"packets": "tlshello"`, фрагментированный Client Hello будет отправлен в одном TCP-пакете, если его исходный размер не превышает MSS или MTU и система не фрагментирует его автоматически. + +`"maxSplit"`: максимальное количество фрагментов. Ограничивает, на сколько частей можно разделить один пакет. `0` означает без ограничений. + ### sudoku ```json @@ -137,62 +163,46 @@ FinalMask добавляет последний слой маскировки п "password": "", "ascii": "", - "customTable": "", // в upstream документации поле называется custom_table - "customTables": [""], // в upstream документации поле называется custom_tables + "customTable": "", // в upstream-документации поле называется custom_table + "customTables": [""], // в upstream-документации поле называется custom_tables - "paddingMin": 0, // в upstream документации поле называется padding_min - "paddingMax": 0 // в upstream документации поле называется padding_max + "paddingMin": 0, // в upstream-документации поле называется padding_min + "paddingMax": 0 // в upstream-документации поле называется padding_max } ``` -Смысл этих полей описан в [upstream-документации](https://github.com/SUDOKU-ASCII/sudoku/blob/main/configs/README.md). +Значение этих полей см. в [upstream-документации](https://github.com/SUDOKU-ASCII/sudoku/blob/main/configs/README.md). -> `udp[n].type`: header-custom | header-dns | header-dtls | header-srtp | header-utp | header-wechat | header-wireguard | mkcp-original | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp +## UDPMask -Первый элемент массива является самым внешним слоем маскировки. +Массив для маскировки UDP-трафика, исходящего из ядра. Первый элемент массива является самым внешним слоем маскировки. -Используется вместе с `raw` UDP, `kcp`, `hysteria` и `xhttp` H3. +```json +{ + "finalmask": { + // [!code focus:6] + "udp": [ + { + "type": "", + "settings": {} + } + ] + } +} +``` -`header-custom`: всегда добавляется как объединенный заголовок пакета. +> `type`: header-custom | header-dns | header-dtls | header-srtp | header-utp | header-wechat | header-wireguard | mkcp-original | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp -`header-dns`: старая DNS-маскировка mKCP. В некоторых кампусных сетях DNS-запросы разрешены до авторизации, поэтому этот режим добавляет DNS-заголовок к KCP. +Тип этого слоя маскировки. -`header-dtls`: старая DTLS-маскировка mKCP. Имитирует пакеты DTLS 1.2. Дополнительных настроек нет. +> `settings`: header-custom | header-dns | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp -`header-srtp`: старая SRTP-маскировка mKCP. Похожа на трафик видеозвонков вроде FaceTime. Дополнительных настроек нет. - -`header-utp`: старая uTP-маскировка mKCP. Похожа на BitTorrent-трафик. Дополнительных настроек нет. - -`header-wechat`: старая маскировка под WeChat Video из mKCP. Дополнительных настроек нет. - -`header-wireguard`: старая WireGuard-маскировка mKCP. Выглядит как пакеты WireGuard, хотя реальным протоколом WireGuard не является. Дополнительных настроек нет. - -`mkcp-original`: простая обфускация, которая раньше была значением по умолчанию в mKCP. Может понадобиться для подключения к старым mKCP-серверам. Дополнительных настроек нет. - -`mkcp-aes128gcm`: старый режим `seed` в mKCP. Использует AES-128-GCM для обфускации. - -`noise`: шум, отправляемый перед реальной полезной нагрузкой. - -`salamander`: обфускация Salamander из Hysteria2. - -`sudoku`: - -`xdns`: передает данные через DNS-запросы по схеме, похожей на DNSTT. Для переноса полезной нагрузки выполняются обычные DNS TXT-запросы. - -Из-за технических ограничений эффективный MTU очень маленький, поэтому QUIC здесь непрактичен. Рекомендуется сочетать режим с mKCP. Рекомендуемые MTU — 130 на клиенте и 900 на сервере. - -Так как запросы являются стандартными DNS-запросами, их может пересылать любой UDP DNS-сервер, хотя эффективность будет низкой. - -Для использования этого режима сервер должен слушать порт 53, прокси-протокол должен указывать целью DNS-сервер вроде `8.8.8.8:53`, а вы должны владеть доменом `domain` и направить его NS-запись на сервер. - -Например, если у вас есть `example.com`, можно создать A-запись вроде `a.example.com`, указывающую на IP сервера, затем NS-запись вроде `t.example.com`, указывающую на `t.example.com`, и использовать `t.example.com` как рабочий домен. A-запись не должна быть поддоменом NS-записи. - -`xicmp`: требует как минимум `CAP_NET_RAW`, должен быть самым внешним слоем, то есть первым элементом массива, и несовместим с `udpHop` и `dialerProxy`. - -> `udp[n].settings`: header-custom | header-dns | mkcp-aes128gcm | noise | salamander | sudoku | xdns | xicmp +Конкретные настройки для этого типа маскировки. Поля каждого типа приведены ниже. ### header-custom +Всегда объединяется с заголовком пакета. + ```json { "client": [ @@ -214,24 +224,52 @@ FinalMask добавляет последний слой маскировки п } ``` -`client[n].rand`: добавить заданное число случайных байт. Несовместимо с `packet`. +`client[n].rand`: добавляет указанное количество случайных байтов. Несовместимо с `packet`. -`client[n].randRange`: диапазон значений случайных байт. По умолчанию `0-255`. +`client[n].randRange`: диапазон значений случайных байтов. По умолчанию `0-255`. -`client[n].type`: тип `packet`. Поддерживаются `array`, `str`, `hex` и `base64`. Значение по умолчанию — `array`. +`client[n].type`: тип `packet`. Поддерживаются `array`, `str`, `hex` и `base64`. Значение по умолчанию - `array`. -`client[n].packet`: добавить фиксированные данные. Несовместимо с `rand`. +`client[n].packet`: добавляет фиксированные данные. Несовместимо с `rand`. ### header-dns +Старая DNS-маскировка из mKCP. В некоторых кампусных сетях DNS-запросы разрешены до авторизации, поэтому этот режим добавляет DNS-заголовок к KCP. + ```json { "domain": "www.example.com" } ``` +### header-dtls + +Старая DTLS-маскировка из mKCP. Маскирует пакеты под DTLS 1.2. Дополнительных настроек нет. + +### header-srtp + +Старая SRTP-маскировка из mKCP. Маскирует пакеты под SRTP и может определяться как трафик видеозвонков, например FaceTime. Дополнительных настроек нет. + +### header-utp + +Старая uTP-маскировка из mKCP. Маскирует пакеты под uTP и может определяться как трафик загрузки BitTorrent. Дополнительных настроек нет. + +### header-wechat + +Старая маскировка WeChat Video из mKCP. Маскирует пакеты под трафик видеозвонков WeChat. Дополнительных настроек нет. + +### header-wireguard + +Старая маскировка WireGuard из mKCP. Маскирует пакеты под трафик WireGuard, хотя это не настоящий протокол WireGuard. Дополнительных настроек нет. + +### mkcp-original + +Простая обфускация, которая раньше применялась в mKCP по умолчанию. Она может понадобиться для подключения к старым серверам mKCP. Дополнительных настроек нет. + ### mkcp-aes128gcm +Соответствует старой функции `seed` в mKCP. Использует AES-128-GCM для обфускации. + ```json { "password": "your-password" @@ -240,9 +278,11 @@ FinalMask добавляет последний слой маскировки п ### noise +Шум, отправляемый перед реальными данными. + ```json { - "reset": 0, + "reset": "30-60", "noise": [ { "rand": "1-8192", @@ -255,18 +295,22 @@ FinalMask добавляет последний слой маскировки п } ``` -`noise[n].rand`: добавить случайные байты или случайное число байт. Несовместимо с `packet`. +`reset`: значение типа [Int32Range](../../development/intro/guide.md#int32range) в секундах. После отправки шума состояние сбрасывается через указанное время, и шум можно снова отправить на тот же адрес. `0` означает не сбрасывать, то есть отправить только один раз. -`noise[n].randRange`: диапазон значений случайных байт. По умолчанию `0-255`. +`rand`: добавляет случайные байты или случайные байты заданной длины. Несовместимо с `packet`. -`noise[n].type`: тип `packet`. Поддерживаются `array`, `str`, `hex` и `base64`. Значение по умолчанию — `array`. +`randRange`: диапазон значений случайных байтов. По умолчанию `0-255`. -`noise[n].packet`: добавить фиксированные данные. Несовместимо с `rand`. +`type`: тип `packet`. Поддерживаются `array`, `str`, `hex` и `base64`. Значение по умолчанию - `array`. -`noise[n].delay`: задержка в миллисекундах. После отправки одного элемента шума Xray ждет указанное время перед следующим. +`packet`: добавляет фиксированные данные. Несовместимо с `rand`. + +`delay`: задержка в миллисекундах. После отправки одного элемента шума Xray ждёт указанное время перед отправкой следующего. ### salamander +Обфускация Salamander. Используется в Hysteria2. + ```json { "password": "your-password" @@ -288,18 +332,37 @@ FinalMask добавляет последний слой маскировки п } ``` -Здесь действуют те же значения, что и в TCP-версии. +Значения те же, что и в TCP-версии. ### xdns +Использует DNS-запросы для передачи данных, подобно DNSTT. Для переноса полезной нагрузки выполняются стандартные DNS-запросы; поддерживаются типы TXT, A и AAAA. + +Из-за технических ограничений эффективный MTU очень мал, QUIC использовать нельзя, поэтому рекомендуется сочетать этот режим с mKCP. Рекомендуемые значения MTU: на клиенте 130; на сервере 900 для TXT, который почти передаёт исходные байты, для AAAA разумно уменьшить значение примерно до половины или ниже, а для A - примерно до одной восьмой или ниже. Теоретическая эффективность кодирования различается, а реальные значения зависят от того, сколько AAAA- или A-записей промежуточные форвардеры готовы терпеть в ответах. + +Поскольку выполняются стандартные запросы, они могут пересылаться через любой UDP DNS-сервер, хотя эффективность может быть очень низкой. + +Чтобы использовать эту функцию, сервер должен слушать порт 53, затем прокси-протокол должен указывать на DNS-сервер, например `8.8.8.8:53`, и у вас должен быть домен из `domains`, после чего его NS-запись нужно направить на сервер. + +Например, если у вас есть `example.com`, задайте A-запись `a.example.com`, указывающую на IP сервера, затем задайте NS-запись `t.example.com`, указывающую на `t.example.com`, и используйте `t.example.com`. Хост, используемый в A-записи, не должен быть поддоменом хоста, используемого в NS-записи. + ```json { - "domain": "www.example.com" + "domains": ["t.example.com"], + "resolvers": ["t.example.com+udp://8.8.8.8:53"] } ``` +`domains`: используется на стороне сервера. Список доменов. Поддерживает указание типа запроса в формате `domain:method`, где `method` может быть `txt`, `a` или `aaaa`. Если `method` не указан, тип запроса не ограничивается. + +`resolvers`: используется на стороне клиента. Список DNS-резолверов. Формат: `domain[:method]+udp://server:port`, где `method` может быть `txt` по умолчанию, `a` или `aaaa`. + +Хотя бы одно из `domains` и `resolvers` должно быть заполнено. + ### xicmp +Требует как минимум права `CAP_NET_RAW` и должен быть самым внешним слоем, то есть первым элементом массива. Его нельзя использовать вместе с `udpHop` и `dialerProxy`. + ```json { "listenIp": "0.0.0.0", @@ -307,35 +370,38 @@ FinalMask добавляет последний слой маскировки п } ``` -`listenIp`: IP-адрес, на котором выполняется прослушивание. По умолчанию `"0.0.0.0"`. +`listenIp`: IP-адрес для прослушивания. По умолчанию `"0.0.0.0"`. -Обратите внимание, что это отличается от обычного TCP/UDP-прослушивания на `"0.0.0.0"` и `"::"`. Поскольку ICMP на основе IPv4 и ICMPv6 на основе IPv6 не являются взаимозаменяемыми протоколами, указание `"0.0.0.0"` здесь означает прослушивание только ICMP поверх IPv4, и наоборот. +Обратите внимание, что это отличается от обычных адресов прослушивания TCP/UDP `"0.0.0.0"` и `"::"`. Поскольку ICMP по IPv4 и ICMPv6 по IPv6 несовместимы, указание `"0.0.0.0"` здесь означает прослушивание только IPv4 ICMP, и наоборот. -`id`: если несколько клиентов используют один IP, серверу рекомендуется оставлять здесь `0`. +`id`: если один IP используется несколькими клиентами, серверу рекомендуется оставлять это значение равным `0`. -> `quicParams`: [quicParamsObject](#quicParams) - -### quicParams +## quicParams ```json { - "congestion": "force-brutal", - "bbrProfile": "standard", - "debug": false, - "brutalUp": "60 mbps", - "brutalDown": 0, - "udpHop": { - "ports": "20000-50000", - "interval": "5-10" - }, - "initStreamReceiveWindow": 8388608, - "maxStreamReceiveWindow": 8388608, - "initConnectionReceiveWindow": 20971520, - "maxConnectionReceiveWindow": 20971520, - "maxIdleTimeout": 30, - "keepAlivePeriod": 0, - "disablePathMTUDiscovery": false, - "maxIncomingStreams": 1024 + "finalmask": { + // [!code focus:19] + "quicParams": { + "congestion": "force-brutal", + "bbrProfile": "standard", + "debug": false, + "brutalUp": "60 mbps", + "brutalDown": 0, + "udpHop": { + "ports": "20000-50000", + "interval": "5-10" + }, + "initStreamReceiveWindow": 8388608, + "maxStreamReceiveWindow": 8388608, + "initConnectionReceiveWindow": 20971520, + "maxConnectionReceiveWindow": 20971520, + "maxIdleTimeout": 30, + "keepAlivePeriod": 0, + "disablePathMTUDiscovery": false, + "maxIncomingStreams": 1024 + } + } } ``` @@ -343,45 +409,47 @@ FinalMask добавляет последний слой маскировки п > `congestion`: reno | bbr | brutal | force-brutal -Алгоритм управления перегрузкой. В Hysteria по умолчанию используется `brutal`, в XHTTP H3 — `bbr`. +Алгоритм управления перегрузкой. В Hysteria по умолчанию используется `brutal`, а в XHTTP H3 - `bbr`. -`reno` и `bbr` — обычные известные алгоритмы. +`reno` и `bbr` - известные алгоритмы. -`brutal` согласует фиксированную скорость отправки пакетов с другой стороной или откатывается к BBR. Поддерживается только в Hysteria, потому что у XHTTP нет механизма согласования. +`brutal`: согласует с другой стороной фиксированную скорость отправки пакетов или откатывается к BBR. -`force-brutal` работает так же, как `brutal`, но принудительно использует фиксированную исходящую скорость из `brutalUp`, игнорируя переговоры с другой стороной. +`force-brutal`: то же, что и `brutal`, но принудительно использует для исходящего трафика фиксированную скорость отправки из `brutalUp`, игнорируя согласование с другой стороной. + +Обратите внимание: XHTTP H3 не может использовать режим `brutal`, потому что у него нет механизма согласования, но поддерживает `force-brutal`, которому согласование не требуется. > `bbrProfile`: conservative | standard | aggressive -Управляет пресетом BBR, когда QUIC использует алгоритм BBR. По умолчанию — `standard`. `conservative` — чуть более осторожный, `aggressive` — чуть более агрессивный. +Когда для QUIC выбран алгоритм BBR, этот параметр управляет BBR-профилем. Значение по умолчанию - `standard`. `conservative` немного осторожнее, `aggressive` немного агрессивнее. > `debug`: false | true -Включает логирование для реализаций `bbr` и `brutal`. +Включает логи для управления перегрузкой `bbr` и `brutal`. > `brutalUp`: string > `brutalDown`: string -Ограничения исходящей и входящей скорости. Значение по умолчанию — `0`. +Ограничения скорости загрузки и отдачи. Значение по умолчанию - `0`. -Формат дружелюбный: поддерживаются записи вроде `1000000`, `100kb`, `20 mb`, `100 mbps`, `1g`, `1 tbps`. Регистр неважен, пробелы необязательны. Если единицы измерения не указаны, используется `bps`. Значение не может быть ниже 65535 bps. +Формат удобен для пользователя и поддерживает разные распространённые записи битрейта, включая `1000000`, `100kb`, `20 mb`, `100 mbps`, `1g` и `1 tbps`. Регистр не важен, пробелы между значением и единицей можно ставить или не ставить, а если единица не указана, по умолчанию используется `bps`. Значение не может быть меньше 65535 bps. -Переговоры работают так же, как у Hysteria Brutal: +Поведение согласования такое же, как в Hysteria Brutal: -Серверное значение ограничивает максимальную скорость режима Brutal, которую клиент может выбрать. `0` означает отсутствие ограничения со стороны сервера. +Значение на стороне сервера ограничивает максимальную скорость режима Brutal, которую может выбрать клиент. `0` означает, что сервер не ограничивает клиента. -Если на клиенте указано `0`, используется режим BBR. Если значение не нулевое, используется Brutal-режим, но он все равно ограничивается серверной стороной. +Если на стороне клиента указано `0`, используется режим BBR. Если значение не нулевое, используется режим Brutal и он всё равно ограничивается значением на стороне сервера. -Не забывайте про относительность направлений: серверный upload — это клиентский download, а серверный download — это клиентский upload. +Помните, что направления относительны: исходящая скорость сервера соответствует входящей скорости клиента, а входящая скорость сервера - исходящей скорости клиента. > `udpHop`: {"ports": string, "interval": number} Настройка прыжков по UDP-портам. -`ports` задает диапазон портов. Это может быть одиночная строка вроде `"1234"`, диапазон вроде `"1145-1919"` или несколько сегментов через запятую, например `11,13,15-17`. +`ports` задаёт диапазон портов. Это может быть строка с одним числом, например `"1234"`, или диапазон, например `"1145-1919"` для портов с 1145 по 1919. Можно использовать запятые для разбиения на сегменты, например `11,13,15-17`. -`interval` — интервал переключения портов в секундах. Минимум — 5, значение по умолчанию — 30 секунд. +`interval` - интервал прыжков по портам в секундах. Минимум `5`, значение по умолчанию - `30` секунд. > `initStreamReceiveWindow`: number @@ -391,22 +459,22 @@ FinalMask добавляет последний слой маскировки п > `maxConnectionReceiveWindow`: number -Это низкоуровневые параметры QUIC-окон. **Не меняйте их, если не понимаете точно, что делаете.** Если менять их все же нужно, рекомендуется сохранять соотношение окна потока и окна соединения на уровне 2:5. +Это четыре конкретных параметра QUIC-окон. **Не меняйте их, если вы не понимаете, что делаете.** Если менять всё же нужно, рекомендуется сохранять соотношение окна приёма потока и окна приёма соединения как 2:5. > `maxIdleTimeout`: number -Максимальный таймаут простоя в секундах. Это время, после которого сервер закроет соединение, если не получает данные от клиента. Допустимый диапазон — от 4 до 120 секунд. Значение по умолчанию — 30 секунд. +Максимальный таймаут простоя в секундах. Это время, после которого сервер закроет соединение, если не получает никаких данных от клиента. Допустимый диапазон - от 4 до 120 секунд. Значение по умолчанию - `30` секунд. > `keepAlivePeriod`: number -Интервал QUIC KeepAlive в секундах. Допустимый диапазон — от 2 до 60 секунд. По умолчанию выключено. +Интервал QUIC KeepAlive в секундах. Допустимый диапазон - от 2 до 60 секунд. По умолчанию отключено. > `disablePathMTUDiscovery`: bool Отключать ли Path MTU Discovery. -Во многих других реализациях на системах вне Linux, Windows и Darwin этот режим отключается принудительно, тогда как Xray не делает этого автоматически. Если ваша ОС не входит в эти три, возможно, придется отключить его вручную. +В других реализациях этот режим принудительно отключается на системах, отличных от Linux, Windows и Darwin, тогда как Xray не делает этого автоматически. Если ваша ОС не входит в `linux`, `windows` или `darwin`, возможно, вам придётся отключить его вручную. > `maxIncomingStreams`: number -Только для сервера. Если параметр задан, он не должен быть меньше `8`. +Параметр стороны сервера. Если задан, он не должен быть меньше `8`.