mcp-xray-pilot 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +502 -0
- package/data/docs/_index.json +533 -0
- package/data/docs/basic__api.md +148 -0
- package/data/docs/basic__dns.md +366 -0
- package/data/docs/basic__fakedns.md +202 -0
- package/data/docs/basic__geodata.md +64 -0
- package/data/docs/basic__inbound.md +159 -0
- package/data/docs/basic__index.md +136 -0
- package/data/docs/basic__log.md +67 -0
- package/data/docs/basic__metrics.md +262 -0
- package/data/docs/basic__observatory.md +115 -0
- package/data/docs/basic__outbound.md +164 -0
- package/data/docs/basic__policy.md +140 -0
- package/data/docs/basic__reverse.md +268 -0
- package/data/docs/basic__routing.md +474 -0
- package/data/docs/basic__stats.md +61 -0
- package/data/docs/basic__transport.md +1283 -0
- package/data/docs/features__features_browser_dialer.md +61 -0
- package/data/docs/features__features_env.md +66 -0
- package/data/docs/features__features_fallback.md +110 -0
- package/data/docs/features__features_index.md +17 -0
- package/data/docs/features__features_multiple.md +144 -0
- package/data/docs/features__features_xtls.md +13 -0
- package/data/docs/inbounds__inbounds_dokodemo.md +11 -0
- package/data/docs/inbounds__inbounds_http.md +80 -0
- package/data/docs/inbounds__inbounds_hysteria.md +60 -0
- package/data/docs/inbounds__inbounds_index.md +22 -0
- package/data/docs/inbounds__inbounds_shadowsocks.md +118 -0
- package/data/docs/inbounds__inbounds_socks.md +87 -0
- package/data/docs/inbounds__inbounds_trojan.md +78 -0
- package/data/docs/inbounds__inbounds_tun.md +47 -0
- package/data/docs/inbounds__inbounds_tunnel.md +86 -0
- package/data/docs/inbounds__inbounds_vless.md +135 -0
- package/data/docs/inbounds__inbounds_vmess.md +95 -0
- package/data/docs/inbounds__inbounds_wireguard.md +78 -0
- package/data/docs/outbounds__outbounds_blackhole.md +42 -0
- package/data/docs/outbounds__outbounds_dns.md +97 -0
- package/data/docs/outbounds__outbounds_freedom.md +170 -0
- package/data/docs/outbounds__outbounds_http.md +70 -0
- package/data/docs/outbounds__outbounds_hysteria.md +39 -0
- package/data/docs/outbounds__outbounds_index.md +24 -0
- package/data/docs/outbounds__outbounds_loopback.md +65 -0
- package/data/docs/outbounds__outbounds_shadowsocks.md +105 -0
- package/data/docs/outbounds__outbounds_socks.md +58 -0
- package/data/docs/outbounds__outbounds_trojan.md +49 -0
- package/data/docs/outbounds__outbounds_vless.md +122 -0
- package/data/docs/outbounds__outbounds_vmess.md +76 -0
- package/data/docs/outbounds__outbounds_wireguard.md +141 -0
- package/data/docs/transports__transports_grpc.md +137 -0
- package/data/docs/transports__transports_h2.md +11 -0
- package/data/docs/transports__transports_http.md +11 -0
- package/data/docs/transports__transports_httpupgrade.md +61 -0
- package/data/docs/transports__transports_hysteria.md +110 -0
- package/data/docs/transports__transports_index.md +19 -0
- package/data/docs/transports__transports_mkcp.md +125 -0
- package/data/docs/transports__transports_quic.md +11 -0
- package/data/docs/transports__transports_raw.md +156 -0
- package/data/docs/transports__transports_splithttp.md +11 -0
- package/data/docs/transports__transports_tcp.md +11 -0
- package/data/docs/transports__transports_websocket.md +75 -0
- package/data/docs/transports__transports_xhttp.md +11 -0
- package/dist/data/compatibility.js +170 -0
- package/dist/data/compatibility.js.map +1 -0
- package/dist/data/geocatalogue.js +191 -0
- package/dist/data/geocatalogue.js.map +1 -0
- package/dist/docs.js +339 -0
- package/dist/docs.js.map +1 -0
- package/dist/handlers.js +217 -0
- package/dist/handlers.js.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/lint.js +737 -0
- package/dist/lint.js.map +1 -0
- package/dist/schemas/protocols/blackhole.js +16 -0
- package/dist/schemas/protocols/blackhole.js.map +1 -0
- package/dist/schemas/protocols/common.js +32 -0
- package/dist/schemas/protocols/common.js.map +1 -0
- package/dist/schemas/protocols/dns.js +14 -0
- package/dist/schemas/protocols/dns.js.map +1 -0
- package/dist/schemas/protocols/dokodemo.js +17 -0
- package/dist/schemas/protocols/dokodemo.js.map +1 -0
- package/dist/schemas/protocols/freedom.js +45 -0
- package/dist/schemas/protocols/freedom.js.map +1 -0
- package/dist/schemas/protocols/http.js +38 -0
- package/dist/schemas/protocols/http.js.map +1 -0
- package/dist/schemas/protocols/hysteria.js +51 -0
- package/dist/schemas/protocols/hysteria.js.map +1 -0
- package/dist/schemas/protocols/index.js +50 -0
- package/dist/schemas/protocols/index.js.map +1 -0
- package/dist/schemas/protocols/loopback.js +11 -0
- package/dist/schemas/protocols/loopback.js.map +1 -0
- package/dist/schemas/protocols/shadowsocks.js +60 -0
- package/dist/schemas/protocols/shadowsocks.js.map +1 -0
- package/dist/schemas/protocols/socks.js +42 -0
- package/dist/schemas/protocols/socks.js.map +1 -0
- package/dist/schemas/protocols/trojan.js +34 -0
- package/dist/schemas/protocols/trojan.js.map +1 -0
- package/dist/schemas/protocols/tun.js +19 -0
- package/dist/schemas/protocols/tun.js.map +1 -0
- package/dist/schemas/protocols/vless.js +44 -0
- package/dist/schemas/protocols/vless.js.map +1 -0
- package/dist/schemas/protocols/vmess.js +48 -0
- package/dist/schemas/protocols/vmess.js.map +1 -0
- package/dist/schemas/protocols/wireguard.js +34 -0
- package/dist/schemas/protocols/wireguard.js.map +1 -0
- package/dist/schemas/security/index.js +16 -0
- package/dist/schemas/security/index.js.map +1 -0
- package/dist/schemas/security/reality.js +35 -0
- package/dist/schemas/security/reality.js.map +1 -0
- package/dist/schemas/security/tls.js +46 -0
- package/dist/schemas/security/tls.js.map +1 -0
- package/dist/schemas/security/xtls.js +17 -0
- package/dist/schemas/security/xtls.js.map +1 -0
- package/dist/schemas/transports/grpc.js +18 -0
- package/dist/schemas/transports/grpc.js.map +1 -0
- package/dist/schemas/transports/httpupgrade.js +14 -0
- package/dist/schemas/transports/httpupgrade.js.map +1 -0
- package/dist/schemas/transports/hysteria.js +25 -0
- package/dist/schemas/transports/hysteria.js.map +1 -0
- package/dist/schemas/transports/index.js +32 -0
- package/dist/schemas/transports/index.js.map +1 -0
- package/dist/schemas/transports/mkcp.js +34 -0
- package/dist/schemas/transports/mkcp.js.map +1 -0
- package/dist/schemas/transports/raw.js +19 -0
- package/dist/schemas/transports/raw.js.map +1 -0
- package/dist/schemas/transports/websocket.js +15 -0
- package/dist/schemas/transports/websocket.js.map +1 -0
- package/dist/schemas/transports/xhttp.js +34 -0
- package/dist/schemas/transports/xhttp.js.map +1 -0
- package/dist/search.js +78 -0
- package/dist/search.js.map +1 -0
- package/dist/state.js +87 -0
- package/dist/state.js.map +1 -0
- package/dist/tools.js +274 -0
- package/dist/tools.js.map +1 -0
- package/dist/tools_impl/diff.js +55 -0
- package/dist/tools_impl/diff.js.map +1 -0
- package/dist/tools_impl/github.js +416 -0
- package/dist/tools_impl/github.js.map +1 -0
- package/dist/tools_impl/merge.js +181 -0
- package/dist/tools_impl/merge.js.map +1 -0
- package/dist/tools_impl/refresh.js +46 -0
- package/dist/tools_impl/refresh.js.map +1 -0
- package/dist/tools_impl/suggest.js +169 -0
- package/dist/tools_impl/suggest.js.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.js +81 -0
- package/dist/utils.js.map +1 -0
- package/dist/validate.js +408 -0
- package/dist/validate.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/features/browser_dialer.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/features/browser_dialer.md
|
|
4
|
+
title: Browser Dialer
|
|
5
|
+
category: features
|
|
6
|
+
slug: features/browser_dialer
|
|
7
|
+
fetched_at: 2026-05-04T18:42:46.683Z
|
|
8
|
+
---
|
|
9
|
+
# Browser Dialer
|
|
10
|
+
|
|
11
|
+
## Background
|
|
12
|
+
|
|
13
|
+
Through uTLS, Xray can simulate the TLS handshake fingerprints of mainstream browsers (see the `fingerprint` option in TLS for details). However, it still cannot guarantee that the simulated browser behavior is perfectly consistent with a real browser at all times.
|
|
14
|
+
|
|
15
|
+
In response to this, the [Browser Dialer](https://github.com/v2ray/discussion/issues/754#issuecomment-647934994) was created. Users open a page at `localhost:8080` in their own browser. This page uses native JS to act as Xray's network stack, establishing TLS and HTTP connections with the proxy server.
|
|
16
|
+
|
|
17
|
+
This method concisely implements real browser TLS fingerprints and behavioral characteristics, providing maximum anti-detection and anti-blocking capabilities.
|
|
18
|
+
|
|
19
|
+
However, the current Browser Dialer has the following drawbacks:
|
|
20
|
+
|
|
21
|
+
- Users need to manually open the browser.
|
|
22
|
+
- Connections initiated by the browser must be direct. Users using `tun` need to pay special attention to avoid creating infinite routing loops.
|
|
23
|
+
- The browser can only initiate HTTP connections, so currently, only [WebSocket](../transports/websocket.md) and [XHTTP](https://github.com/XTLS/Xray-core/discussions/4113) transport methods are supported.
|
|
24
|
+
- When the browser connects from the `localhost:8080` page to the proxy server, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) needs to be considered.
|
|
25
|
+
- Since data is processed via JS, there will be some performance overhead.
|
|
26
|
+
- Custom SNI or Host cannot be used; that is, `SNI == host == address`. Custom HTTP headers and other `tlsSettings` items will be ignored.
|
|
27
|
+
|
|
28
|
+
## Configuration Method
|
|
29
|
+
|
|
30
|
+
1. Prepare a WebSocket or XHTTP configuration. Note that the `address` must be a domain name. If you need to specify an IP, please configure DNS or the system `hosts` file.
|
|
31
|
+
2. Start Xray using the environment variable `XRAY_BROWSER_DIALER=127.0.0.1:8080`.
|
|
32
|
+
- On Windows: `set XRAY_BROWSER_DIALER=127.0.0.1:8080`
|
|
33
|
+
- On Linux: `XRAY_BROWSER_DIALER=127.0.0.1:8080 ./xray -c config.json`
|
|
34
|
+
3. Ensure the browser connects directly (or configure the routing so that the server address is sent directly via `freedom`). Open the page `localhost:8080`. You can also use `F12` to check `Console` and `Network`.
|
|
35
|
+
4. Browsers limit the number of outbound connections, so it is recommended to enable `Mux.Cool`.
|
|
36
|
+
|
|
37
|
+
## Internal Communication Mechanism
|
|
38
|
+
|
|
39
|
+
- Xray listens on the address/port `http://127.0.0.1:8080` as an HTTP server. The browser visits this address and loads the JS in the webpage.
|
|
40
|
+
- The JS actively establishes a WebSocket connection to `http://127.0.0.1:8080`. Upon success, Xray sends the connection to a channel.
|
|
41
|
+
- When a connection needs to be established, Xray retrieves an available connection from the channel and sends the target URL and optional early data.
|
|
42
|
+
- After the JS successfully connects to the target, it notifies Xray and continues to use this connection to forward data in full-duplex mode. Connection closure is synchronized.
|
|
43
|
+
- The connection is closed after use, but the JS ensures that new idle connections are always available.
|
|
44
|
+
|
|
45
|
+
## WebSocket
|
|
46
|
+
|
|
47
|
+
<Badge text="v1.4.1+" type="warning"/>
|
|
48
|
+
|
|
49
|
+
Based on browser requirements, the following adjustments were made to the early data mechanism:
|
|
50
|
+
|
|
51
|
+
- The server response header will carry the requested `Sec-WebSocket-Protocol`, which preliminarily obfuscates the length characteristics of the WSS handshake response.
|
|
52
|
+
- The early data encoding used for browsers is `base64.RawURLEncoding` instead of `StdEncoding`. The server has made compatibility adjustments.
|
|
53
|
+
- Additionally, due to [Xray-core#375](https://github.com/XTLS/Xray-core/pull/375) recommending `?ed=2048`, this PR also expanded a `MaxHeaderBytes` limit on the server side to 4096. ~~ (Although it seems fine without changing it) ~~
|
|
54
|
+
|
|
55
|
+
## XHTTP
|
|
56
|
+
|
|
57
|
+
<Badge text="v1.8.19+" type="warning"/>
|
|
58
|
+
|
|
59
|
+
[XHTTP](https://github.com/XTLS/Xray-core/discussions/4113) itself supports QUIC. If you want to use the browser's own QUIC network stack, Chrome users can configure it in `chrome://flags`. Other browsers also have relevant options.
|
|
60
|
+
|
|
61
|
+
In principle, `tlsSettings` items will be ignored, and the HTTP version used will be determined entirely by the browser.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/features/env.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/features/env.md
|
|
4
|
+
title: Environment Variables
|
|
5
|
+
category: features
|
|
6
|
+
slug: features/env
|
|
7
|
+
fetched_at: 2026-05-04T18:42:47.197Z
|
|
8
|
+
---
|
|
9
|
+
# Environment Variables
|
|
10
|
+
|
|
11
|
+
Xray provides the following environment variables to modify some underlying configurations of Xray.
|
|
12
|
+
|
|
13
|
+
## Resource File Path
|
|
14
|
+
|
|
15
|
+
- Name: `xray.location.asset` or `XRAY_LOCATION_ASSET`.
|
|
16
|
+
- Default value: Specific [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) directories or the same path as the Xray executable.
|
|
17
|
+
|
|
18
|
+
This environment variable specifies a folder location that should contain the `geoip.dat` and `geosite.dat` files.
|
|
19
|
+
If no variable value is specified, the program will look for resource files in the following order:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
./
|
|
23
|
+
/usr/local/share/xray
|
|
24
|
+
/usr/share/xray
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Configuration File Location
|
|
28
|
+
|
|
29
|
+
- Name: `xray.location.config` or `XRAY_LOCATION_CONFIG`.
|
|
30
|
+
- Default value: The same path as the Xray executable.
|
|
31
|
+
|
|
32
|
+
This environment variable specifies a folder location that should contain the `config.json` file.
|
|
33
|
+
|
|
34
|
+
## Multiple Configuration Directory
|
|
35
|
+
|
|
36
|
+
- Name: `xray.location.confdir` or `XRAY_LOCATION_CONFDIR`.
|
|
37
|
+
- Default value: `""`.
|
|
38
|
+
|
|
39
|
+
The `.json` files in this directory will be read in alphabetical order of their filenames as multiple configuration options.
|
|
40
|
+
|
|
41
|
+
This item has lower priority than the startup argument `confdir`.
|
|
42
|
+
|
|
43
|
+
## Strict JSON Parser
|
|
44
|
+
|
|
45
|
+
- Name: `xray.json.strict` or `XRAY_JSON_STRICT`.
|
|
46
|
+
- Default value: `false`.
|
|
47
|
+
|
|
48
|
+
By default, on startup Xray uses a custom JSON parser that strips comments and other non-standard characters from the configuration. If you are sure that your configuration file strictly conforms to the JSON standard (RFC 8259), you can enable this option to use the standard JSON parser, which is faster when working with large configurations.
|
|
49
|
+
|
|
50
|
+
## Other Available Configurations
|
|
51
|
+
|
|
52
|
+
- xray.location.plugin
|
|
53
|
+
- xray.location.tool
|
|
54
|
+
- xray.location.cert
|
|
55
|
+
|
|
56
|
+
- xray.buf.readv
|
|
57
|
+
- xray.buf.splice
|
|
58
|
+
- xray.vmess.padding
|
|
59
|
+
- xray.cone.disabled
|
|
60
|
+
|
|
61
|
+
- xray.ray.buffer.size
|
|
62
|
+
- xray.browser.dialer
|
|
63
|
+
- xray.xudp.show
|
|
64
|
+
- xray.xudp.basekey
|
|
65
|
+
|
|
66
|
+
These options are open to users with special needs; you can read the source code to discover their usage. ~PR Welcome~
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/features/fallback.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/features/fallback.md
|
|
4
|
+
title: Fallback
|
|
5
|
+
category: features
|
|
6
|
+
slug: features/fallback
|
|
7
|
+
fetched_at: 2026-05-04T18:42:46.157Z
|
|
8
|
+
---
|
|
9
|
+
# Fallback
|
|
10
|
+
|
|
11
|
+
> **Fallback is one of Xray's most powerful features, effectively preventing active probing and allowing multiple services to share common ports.**
|
|
12
|
+
|
|
13
|
+
Fallback provides Xray with high-strength resistance against active probing and features a unique first-packet fallback mechanism.
|
|
14
|
+
|
|
15
|
+
Fallback can also split different types of traffic based on `path`, allowing a single port to be shared by multiple services.
|
|
16
|
+
|
|
17
|
+
Currently, you can use the fallback feature by configuring `fallbacks` when using VLESS or Trojan protocols, allowing for very rich configuration combinations.
|
|
18
|
+
|
|
19
|
+
## Fallbacks Configuration
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
"fallbacks": [
|
|
23
|
+
{
|
|
24
|
+
"dest": 80
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> `fallbacks`: \[ [FallbackObject](#fallbackobject) \]
|
|
30
|
+
|
|
31
|
+
An array containing a series of powerful fallback distribution configurations.
|
|
32
|
+
|
|
33
|
+
### FallbackObject
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"name": "",
|
|
38
|
+
"alpn": "",
|
|
39
|
+
"path": "",
|
|
40
|
+
"dest": 80,
|
|
41
|
+
"xver": 0
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**`fallbacks` is an array; this is the configuration description for one of its child elements.**
|
|
46
|
+
|
|
47
|
+
The `fallbacks` item is optional and can only be used with the TCP+TLS transport combination.
|
|
48
|
+
|
|
49
|
+
- When this item has child elements, [Inbound TLS](../transport.md#tlsobject) must set `"alpn":["http/1.1"]`.
|
|
50
|
+
|
|
51
|
+
Usually, you need to first set a default fallback with both `alpn` and `path` omitted or empty, and then configure other traffic splitting as needed.
|
|
52
|
+
|
|
53
|
+
VLESS will forward traffic to the address specified by `dest` if, after TLS decryption, the first packet length is < 18, the protocol version is invalid, or authentication fails.
|
|
54
|
+
|
|
55
|
+
For other transport combinations, the `fallbacks` item or all child elements must be deleted. In this case, Fallback will not be enabled. VLESS will wait to read the required length, and if the protocol version is invalid or authentication fails, it will directly disconnect.
|
|
56
|
+
|
|
57
|
+
> `name`: string
|
|
58
|
+
|
|
59
|
+
Attempts to match TLS SNI (Server Name Indication). Empty means any. Default is `""`.
|
|
60
|
+
|
|
61
|
+
> `alpn`: string
|
|
62
|
+
|
|
63
|
+
Attempts to match the TLS ALPN negotiation result. Empty means any. Default is `""`.
|
|
64
|
+
|
|
65
|
+
Xray will only attempt to read the TLS ALPN negotiation result when necessary. If successful, it outputs `realAlpn =` to the info log.
|
|
66
|
+
Usage: Solves the issue where Nginx's h2c service cannot be compatible with http/1.1 simultaneously. Nginx would require two `listen` lines, for 1.1 and h2c respectively.
|
|
67
|
+
Note: When `fallbacks` `alpn` contains `"h2"`, [Inbound TLS](../transport.md#tlsobject) needs to set `"alpn":["h2","http/1.1"]` to support h2 access.
|
|
68
|
+
|
|
69
|
+
::: tip
|
|
70
|
+
The `alpn` set in Fallback matches the _actually negotiated_ ALPN, whereas the `alpn` set in Inbound TLS is the list of _optional_ ALPNs during the handshake. The meanings are different.
|
|
71
|
+
:::
|
|
72
|
+
|
|
73
|
+
> `path`: string
|
|
74
|
+
|
|
75
|
+
Attempts to match the HTTP PATH of the first packet. Empty means any. Default is empty. If non-empty, it must start with `/`. h2c is not supported.
|
|
76
|
+
|
|
77
|
+
Smart: Xray will only attempt to peek at the PATH when necessary (not exceeding 55 bytes; uses the fastest algorithm, does not fully parse HTTP). If successful, it outputs the INFO log `realPath =`.
|
|
78
|
+
Usage: Offloading WebSocket traffic or HTTP camouflage traffic from other inbounds. It performs pure traffic forwarding without extra processing. Theoretical performance is stronger than Nginx.
|
|
79
|
+
|
|
80
|
+
Note: **The inbound where fallbacks is located must itself be TCP+TLS**. This is used for offloading to other WS inbounds; the offloaded inbound does not need to configure TLS.
|
|
81
|
+
|
|
82
|
+
> `dest`: string | number
|
|
83
|
+
|
|
84
|
+
Decides the destination of the TCP traffic after TLS decryption. Currently supports two types of addresses: (This item is mandatory, otherwise it will not start)
|
|
85
|
+
|
|
86
|
+
1. TCP, formatted as `"addr:port"`, where `addr` supports IPv4, domain name, and IPv6. If a domain name is filled, a TCP connection will be initiated directly (without going through the built-in DNS).
|
|
87
|
+
2. Unix domain socket, formatted as an absolute path, like `"/dev/shm/domain.socket"`. Can handle [abstract](https://www.man7.org/linux/man-pages/man7/unix.7.html) by adding `@` at the beginning, or `@@` for abstract with padding.
|
|
88
|
+
|
|
89
|
+
If only `port` is filled, it can be a number or a string, like `80` or `"80"`. It usually points to a cleartext http service (`addr` will be filled as `"localhost"`).
|
|
90
|
+
|
|
91
|
+
Note: Only after v25.7.26 does a `dest` containing only a port point to `localhost`. Before this, it was `127.0.0.1`. After the change, the actual target is likely `::1`. Some webserver templates copied online might listen on `::1` but only allow `127` to enter or apply the proxy protocol, which may lead to different behaviors.
|
|
92
|
+
|
|
93
|
+
> `xver`: number
|
|
94
|
+
|
|
95
|
+
Sends [PROXY protocol](https://www.haproxy.org/download/2.2/doc/proxy-protocol.txt), specifically used to pass the real source IP and port. Fill 1 or 2. Default is 0, meaning it is not sent. It is recommended to fill 1 if needed.
|
|
96
|
+
|
|
97
|
+
Currently, filling 1 or 2 functions identically, only the structure differs (the former is printable, the latter is binary). Both TCP and WS inbounds in Xray support receiving PROXY protocol.
|
|
98
|
+
|
|
99
|
+
::: warning
|
|
100
|
+
If you are [configuring Nginx to accept PROXY protocol](https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#configuring-nginx-to-accept-the-proxy-protocol), besides setting `proxy_protocol`, you also need to set `set_real_ip_from`, otherwise issues may occur.
|
|
101
|
+
:::
|
|
102
|
+
|
|
103
|
+
### Supplementary Explanation
|
|
104
|
+
|
|
105
|
+
- It will match the most precise child element, regardless of the order of child elements. If several child elements with identical `alpn` and `path` are configured, the last one will prevail.
|
|
106
|
+
- Fallback offloading is forwarding at the decrypted TCP layer, not the HTTP layer. It only checks the first packet's PATH when necessary.
|
|
107
|
+
- You can view more tips and insights on using Fallbacks here:
|
|
108
|
+
- [Analysis of Fallbacks Features](../../document/level-1/fallbacks-lv1)
|
|
109
|
+
|
|
110
|
+
## Fallbacks Design Theory <Badge text="WIP" type="warning"/>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/features/index.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/features/index.md
|
|
4
|
+
title: Xray Features in Detail
|
|
5
|
+
category: features
|
|
6
|
+
slug: features/index
|
|
7
|
+
fetched_at: 2026-05-04T18:42:45.154Z
|
|
8
|
+
---
|
|
9
|
+
# Xray Features in Detail
|
|
10
|
+
|
|
11
|
+
Xray has the following features:
|
|
12
|
+
|
|
13
|
+
- [XTLS Deep Dive](xtls.md)
|
|
14
|
+
- [Fallback](fallback.md)
|
|
15
|
+
- [Browser Dialer](browser_dialer.md)
|
|
16
|
+
- [Environment Variables](env.md)
|
|
17
|
+
- [Multiple File Configuration](multiple.md)
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/features/multiple.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/features/multiple.md
|
|
4
|
+
title: Multiple Configuration Files
|
|
5
|
+
category: features
|
|
6
|
+
slug: features/multiple
|
|
7
|
+
fetched_at: 2026-05-04T18:42:47.728Z
|
|
8
|
+
---
|
|
9
|
+
# Multiple Configuration Files
|
|
10
|
+
|
|
11
|
+
Xray supports the use of multiple configuration files.
|
|
12
|
+
|
|
13
|
+
The main purpose of multiple configuration files is to disperse the configuration of different functional modules, facilitating management and maintenance.
|
|
14
|
+
|
|
15
|
+
This feature is designed mainly to enrich Xray's ecosystem. For example, GUI clients usually only implement fixed functions like node selection, making it difficult to graphically implement complex configurations. By leaving a custom configuration directory `confdir`, complex functions can be configured there. For server deployment scripts, simply adding files to `confdir` can achieve multi-protocol configuration.
|
|
16
|
+
|
|
17
|
+
## Multi-file Startup
|
|
18
|
+
|
|
19
|
+
::: tip
|
|
20
|
+
The startup log will indicate each configuration file read in sequence. Pay attention to whether the startup information matches your expected order. You can control the order by adding numeric prefixes to file names, such as `01_filename`, `02_filename`. The larger the number, the later it is sorted.
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
$ xray run -confdir /etc/xray/confs
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You can also use `Xray.location.confdir` or `Xray_LOCATION_CONFDIR` to specify `confdir`.
|
|
28
|
+
|
|
29
|
+
The `-confdir` parameter takes precedence over environment variables. If the parameter specifies a valid directory, the path in the environment variable will not be read.
|
|
30
|
+
|
|
31
|
+
## Rules Explanation
|
|
32
|
+
|
|
33
|
+
### Ordinary Objects (`{}`)
|
|
34
|
+
|
|
35
|
+
Top-level objects in later files overwrite or supplement those in earlier files.
|
|
36
|
+
|
|
37
|
+
### Arrays (`[]`)
|
|
38
|
+
|
|
39
|
+
`inbounds` and `outbounds` in JSON configuration are array structures, and they have special rules:
|
|
40
|
+
|
|
41
|
+
- Look for existing elements with the same `tag` and overwrite them; if not found:
|
|
42
|
+
- For `inbounds`, append to the end (order within inbounds doesn't matter).
|
|
43
|
+
- For `outbounds`, prepend to the beginning (the first outbound is the default); however, if the filename contains "tail" (case-insensitive), append to the end.
|
|
44
|
+
|
|
45
|
+
## Configuration Example
|
|
46
|
+
|
|
47
|
+
Assume there are the following three configuration files in the `confs` folder.
|
|
48
|
+
|
|
49
|
+
- 01.json
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"log": {
|
|
54
|
+
"loglevel": "warning"
|
|
55
|
+
},
|
|
56
|
+
"inbounds": [
|
|
57
|
+
{
|
|
58
|
+
"tag": "socks",
|
|
59
|
+
"protocol": "socks",
|
|
60
|
+
"listen": "0.0.0.0",
|
|
61
|
+
"port": 8888
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"outbounds": [
|
|
65
|
+
{
|
|
66
|
+
"tag": "direct",
|
|
67
|
+
"protocol": "freedom"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- 02.json
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"log": {
|
|
78
|
+
"loglevel": "debug"
|
|
79
|
+
},
|
|
80
|
+
"inbounds": [
|
|
81
|
+
{
|
|
82
|
+
"tag": "socks",
|
|
83
|
+
"protocol": "socks",
|
|
84
|
+
"listen": "127.0.0.1",
|
|
85
|
+
"port": 1080
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"outbounds": [
|
|
89
|
+
{
|
|
90
|
+
"tag": "block",
|
|
91
|
+
"protocol": "blackhole"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- 03_tail.json
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"outbounds": [
|
|
102
|
+
{
|
|
103
|
+
"tag": "direct2",
|
|
104
|
+
"protocol": "freedom"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The three configurations will be merged as follows:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"log": {
|
|
115
|
+
"loglevel": "debug" // Top-level object overwrites the former
|
|
116
|
+
},
|
|
117
|
+
"inbounds": [
|
|
118
|
+
{
|
|
119
|
+
"tag": "socks", // Overwrites the former when tag is the same
|
|
120
|
+
"protocol": "socks",
|
|
121
|
+
"listen": "127.0.0.1",
|
|
122
|
+
"port": 1080
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"outbounds": [
|
|
126
|
+
{
|
|
127
|
+
"tag": "block", // outbounds added to the front
|
|
128
|
+
"protocol": "blackhole"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"tag": "direct",
|
|
132
|
+
"protocol": "freedom"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"tag": "direct2", // Filename of 03_tail.json contains 'tail' keyword, added to the end
|
|
136
|
+
"protocol": "freedom"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
::: tip
|
|
143
|
+
You can use the `xray run -confdir=./confs -dump` command to view the merged configuration. However, since the core uses the Protobuf data format internally, the configuration format output by the `-dump` option will look different.
|
|
144
|
+
:::
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/features/xtls.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/features/xtls.md
|
|
4
|
+
title: XTLS Deep Dive
|
|
5
|
+
category: features
|
|
6
|
+
slug: features/xtls
|
|
7
|
+
fetched_at: 2026-05-04T18:42:45.640Z
|
|
8
|
+
---
|
|
9
|
+
# XTLS Deep Dive
|
|
10
|
+
|
|
11
|
+
> **XTLS is Xray's original cutting-edge technology and the core driving force behind its unmatched performance.**
|
|
12
|
+
|
|
13
|
+
<Badge text="WIP" type="warning"/>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/inbounds/dokodemo.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/inbounds/dokodemo.md
|
|
4
|
+
title: Dokodemo-Door
|
|
5
|
+
category: inbounds
|
|
6
|
+
slug: inbounds/dokodemo
|
|
7
|
+
fetched_at: 2026-05-04T18:42:48.732Z
|
|
8
|
+
---
|
|
9
|
+
# Dokodemo-Door
|
|
10
|
+
|
|
11
|
+
See [Tunnel](./tunnel.md)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/inbounds/http.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/inbounds/http.md
|
|
4
|
+
title: HTTP
|
|
5
|
+
category: inbounds
|
|
6
|
+
slug: inbounds/http
|
|
7
|
+
fetched_at: 2026-05-04T18:42:49.716Z
|
|
8
|
+
---
|
|
9
|
+
# HTTP
|
|
10
|
+
|
|
11
|
+
HTTP protocol.
|
|
12
|
+
|
|
13
|
+
::: danger
|
|
14
|
+
**The HTTP protocol does not encrypt traffic and is not suitable for transmission over the public internet. Using it exposes you to the risk of becoming a zombie for attacks.**
|
|
15
|
+
:::
|
|
16
|
+
|
|
17
|
+
A more meaningful usage of `http` inbound is to listen within a LAN or on the local machine to provide local services for other programs.
|
|
18
|
+
|
|
19
|
+
::: tip TIP 1
|
|
20
|
+
`http proxy` can only proxy the TCP protocol; UDP-based protocols are not supported.
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
::: tip TIP 2
|
|
24
|
+
Use the following environment variables in Linux to enable a global HTTP proxy for the current session (supported by many software, but not all).
|
|
25
|
+
|
|
26
|
+
- `export http_proxy=http://127.0.0.1:8080/` (Address must be changed to your configured HTTP inbound proxy address)
|
|
27
|
+
- `export https_proxy=$http_proxy`
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
## InboundConfigurationObject
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"accounts": [
|
|
35
|
+
{
|
|
36
|
+
"user": "my-username",
|
|
37
|
+
"pass": "my-password"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"allowTransparent": false,
|
|
41
|
+
"userLevel": 0
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> `accounts`: \[[AccountObject](#accountobject)\]
|
|
46
|
+
|
|
47
|
+
An array where each element is a user account. Default value is empty.
|
|
48
|
+
|
|
49
|
+
When `accounts` is not empty, the HTTP proxy will perform Basic Authentication on inbound connections.
|
|
50
|
+
|
|
51
|
+
> `allowTransparent`: true | false
|
|
52
|
+
|
|
53
|
+
When set to `true`, all HTTP requests will be forwarded, not just proxy requests.
|
|
54
|
+
|
|
55
|
+
::: tip
|
|
56
|
+
If configured improperly, enabling this option can cause infinite loops.
|
|
57
|
+
:::
|
|
58
|
+
|
|
59
|
+
> `userLevel`: number
|
|
60
|
+
|
|
61
|
+
User level. Connections will use the [Local Policy](../policy.md#levelpolicyobject) corresponding to this user level.
|
|
62
|
+
|
|
63
|
+
The value of `userLevel` corresponds to the value of `level` in [policy](../policy.md#policyobject). If not specified, the default is 0.
|
|
64
|
+
|
|
65
|
+
### AccountObject
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"user": "my-username",
|
|
70
|
+
"pass": "my-password"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> `user`: string
|
|
75
|
+
|
|
76
|
+
Username, string type. Required.
|
|
77
|
+
|
|
78
|
+
> `pass`: string
|
|
79
|
+
|
|
80
|
+
Password, string type. Required.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/inbounds/hysteria.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/inbounds/hysteria.md
|
|
4
|
+
title: Hysteria
|
|
5
|
+
category: inbounds
|
|
6
|
+
slug: inbounds/hysteria
|
|
7
|
+
fetched_at: 2026-05-04T18:42:53.243Z
|
|
8
|
+
---
|
|
9
|
+
# Hysteria
|
|
10
|
+
|
|
11
|
+
::: tip
|
|
12
|
+
The `hysteria protocol` itself has no authentication; `clients` only take effect when used with the `hysteria` transport layer.
|
|
13
|
+
:::
|
|
14
|
+
|
|
15
|
+
## InboundConfigurationObject
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"version": 2,
|
|
20
|
+
"clients": [
|
|
21
|
+
{
|
|
22
|
+
"auth": "5783a3e7-e373-51cd-8642-c83782b807c5",
|
|
23
|
+
"level": 0,
|
|
24
|
+
"email": "love@xray.com"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> `version`: number
|
|
31
|
+
|
|
32
|
+
Hysteria version, must be 2.
|
|
33
|
+
|
|
34
|
+
> `clients`: \[ [ClientObject](#clientobject) \]
|
|
35
|
+
|
|
36
|
+
An array representing a group of users approved by the server.
|
|
37
|
+
|
|
38
|
+
### ClientObject
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"auth": "5783a3e7-e373-51cd-8642-c83782b807c5",
|
|
43
|
+
"level": 0,
|
|
44
|
+
"email": "love@xray.com"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> `auth`: string
|
|
49
|
+
|
|
50
|
+
A string of any length.
|
|
51
|
+
|
|
52
|
+
> `level`: number
|
|
53
|
+
|
|
54
|
+
User level. The connection will use the [local policy](../policy.md#levelpolicyobject) corresponding to this user level.
|
|
55
|
+
|
|
56
|
+
The value of `level` corresponds to the `level` value in [policy](../policy.md#policyobject). If not specified, the default is 0.
|
|
57
|
+
|
|
58
|
+
> `email`: string
|
|
59
|
+
|
|
60
|
+
User email, used to distinguish traffic from different users (reflected in logs and statistics).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/inbounds/index.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/inbounds/index.md
|
|
4
|
+
title: Xray Inbound Protocols
|
|
5
|
+
category: inbounds
|
|
6
|
+
slug: inbounds/index
|
|
7
|
+
fetched_at: 2026-05-04T18:42:48.232Z
|
|
8
|
+
---
|
|
9
|
+
# Xray Inbound Protocols
|
|
10
|
+
|
|
11
|
+
Xray supports the following inbound protocols:
|
|
12
|
+
|
|
13
|
+
- [Tunnel](tunnel.md)
|
|
14
|
+
- [HTTP](http.md)
|
|
15
|
+
- [Shadowsocks](shadowsocks.md)
|
|
16
|
+
- [Socks](socks.md)
|
|
17
|
+
- [Trojan](trojan.md)
|
|
18
|
+
- [VLESS (XTLS Vision Seed)](vless.md)
|
|
19
|
+
- [VMess](vmess.md)
|
|
20
|
+
- [WireGuard](wireguard.md)
|
|
21
|
+
- [Hysteria](hysteria.md)
|
|
22
|
+
- [TUN](tun.md)
|