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,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/fakedns.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/fakedns.md
|
|
4
|
+
title: FakeDNS
|
|
5
|
+
category: basic
|
|
6
|
+
slug: fakedns
|
|
7
|
+
fetched_at: 2026-05-04T18:42:39.509Z
|
|
8
|
+
---
|
|
9
|
+
# FakeDNS
|
|
10
|
+
|
|
11
|
+
FakeDNS obtains target domain names by forging DNS responses. It can reduce latency during DNS queries and assist transparent proxies in acquiring target domain names.
|
|
12
|
+
|
|
13
|
+
::: warning
|
|
14
|
+
FakeDNS may pollute the local DNS cache, causing "no network access" after Xray is closed.
|
|
15
|
+
:::
|
|
16
|
+
|
|
17
|
+
## FakeDNSObject
|
|
18
|
+
|
|
19
|
+
`FakeDNSObject` corresponds to the `fakedns` item in the configuration file.
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"ipPool": "198.18.0.0/16",
|
|
24
|
+
"poolSize": 65535
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`FakeDnsObject` can also be configured as an array containing multiple FakeIP Pools. When a DNS query request is received, FakeDNS will return a set of FakeIPs derived from multiple FakeIP Pools simultaneously.
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
"ipPool": "198.18.0.0/15",
|
|
34
|
+
"poolSize": 65535
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"ipPool": "fc00::/18",
|
|
38
|
+
"poolSize": 65535
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> `ipPool`: CIDR
|
|
44
|
+
|
|
45
|
+
FakeDNS will allocate addresses using the IP block specified in this option.
|
|
46
|
+
|
|
47
|
+
> `poolSize`: int
|
|
48
|
+
|
|
49
|
+
Specifies the maximum number of Domain-IP mappings stored by FakeDNS. When the number of mappings exceeds this value, mappings will be evicted according to LRU rules. Default is 65535.
|
|
50
|
+
|
|
51
|
+
::: warning
|
|
52
|
+
`poolSize` must be less than or equal to the total number of addresses in the `ipPool`.
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
::: tip
|
|
56
|
+
If `fakedns` is set in the `dns` item of the configuration file but `FakeDnsObject` is not configured, Xray will initialize `FakeDnsObject` based on the `queryStrategy` of the DNS component.
|
|
57
|
+
|
|
58
|
+
When `queryStrategy` is `UseIP`, the initialized FakeIP Pool is equivalent to:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
[
|
|
62
|
+
{
|
|
63
|
+
"ipPool": "198.18.0.0/15",
|
|
64
|
+
"poolSize": 32768
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"ipPool": "fc00::/18",
|
|
68
|
+
"poolSize": 32768
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
When `queryStrategy` is `UseIPv4`, the initialized FakeIP Pool is equivalent to:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"ipPool": "198.18.0.0/15",
|
|
78
|
+
"poolSize": 65535
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
When `queryStrategy` is `UseIPv6`, the initialized FakeIP Pool is equivalent to:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"ipPool": "fc00::/18",
|
|
87
|
+
"poolSize": 65535
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
:::
|
|
92
|
+
|
|
93
|
+
### How to use?
|
|
94
|
+
|
|
95
|
+
FakeDNS is essentially a [DNS Server](./dns.md#serverobject) that can be used in conjunction with any DNS rules.
|
|
96
|
+
|
|
97
|
+
It only works when DNS queries are routed to FakeDNS.
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"dns": {
|
|
102
|
+
"servers": [
|
|
103
|
+
"fakedns", // fakedns comes first
|
|
104
|
+
"8.8.8.8"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"outbounds": [
|
|
108
|
+
{
|
|
109
|
+
"protocol": "dns",
|
|
110
|
+
"tag": "dns-out"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"routing": {
|
|
114
|
+
"rules": [
|
|
115
|
+
{
|
|
116
|
+
"inboundTag": ["dns-in"], // Hijack DNS traffic from DNS query entry points, or hijack DNS traffic from transparent proxy inbounds.
|
|
117
|
+
"port": 53,
|
|
118
|
+
"outboundTag": "dns-out"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
When an external DNS request enters the FakeDNS component, it returns an IP address within its `ipPool` as the fictitious resolution result for the domain and records the mapping between the domain and the fictitious IP.
|
|
126
|
+
|
|
127
|
+
Additionally, you need to enable `Sniffing` on the inbound of the **client** that receives traffic to be proxied, and use `fakedns` for destination address resetting.
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
"sniffing": {
|
|
131
|
+
"enabled": true,
|
|
132
|
+
"destOverride": ["fakedns"], // Use "fakedns", or combine with other sniffers
|
|
133
|
+
"metadataOnly": false // When this is true, destOverride can only use fakedns
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
::: warning
|
|
138
|
+
If the FakeIP is not correctly reverted to the domain name, connection to the server will fail.
|
|
139
|
+
:::
|
|
140
|
+
|
|
141
|
+
### Using with other DNS types
|
|
142
|
+
|
|
143
|
+
#### Coexisting with DNS Routing
|
|
144
|
+
|
|
145
|
+
When using DNS routing (traffic splitting), to ensure `fakedns` has high priority, you need to add the same `domains` to it as you would for other DNS types.
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"servers": [
|
|
150
|
+
{
|
|
151
|
+
"address": "fakedns",
|
|
152
|
+
"domains": [
|
|
153
|
+
// Consistent with the content used for routing below
|
|
154
|
+
"geosite:cn",
|
|
155
|
+
"domain:example.com"
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"address": "1.2.3.4",
|
|
160
|
+
"domains": ["geosite:cn"],
|
|
161
|
+
"expectIPs": ["geoip:cn"]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"address": "1.1.1.1",
|
|
165
|
+
"domains": ["domain:example.com"]
|
|
166
|
+
},
|
|
167
|
+
"8.8.8.8"
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### FakeDNS Blacklist
|
|
173
|
+
|
|
174
|
+
If you do not want certain domains to use FakeDNS, you can add `domains` configuration to other types of DNS servers. This gives other DNS servers higher priority than FakeDNS when matching specific domains, thereby implementing a FakeDNS blacklist mechanism.
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"servers": [
|
|
179
|
+
"fakedns",
|
|
180
|
+
{
|
|
181
|
+
"address": "1.2.3.4",
|
|
182
|
+
"domains": ["domain:do-not-use-fakedns.com"]
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### FakeDNS Whitelist
|
|
189
|
+
|
|
190
|
+
If you want only certain domains to use FakeDNS, you can add `domains` configuration to `fakedns`. This gives `fakedns` higher priority than other DNS servers when matching specific domains, thereby implementing a FakeDNS whitelist mechanism.
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"servers": [
|
|
195
|
+
"1.2.3.4",
|
|
196
|
+
{
|
|
197
|
+
"address": "fakedns",
|
|
198
|
+
"domains": ["domain:only-this-use-fakedns.com"]
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/geodata.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/geodata.md
|
|
4
|
+
title: Geodata Files
|
|
5
|
+
category: basic
|
|
6
|
+
slug: geodata
|
|
7
|
+
fetched_at: 2026-05-04T18:42:44.635Z
|
|
8
|
+
---
|
|
9
|
+
# Geodata Files
|
|
10
|
+
|
|
11
|
+
Reloads geodata files on a schedule, and can download new `.dat` files before reloading. It is intended for cases where restarting Xray is inconvenient but geodata still needs periodic updates.
|
|
12
|
+
|
|
13
|
+
Use with caution on low-memory devices.
|
|
14
|
+
|
|
15
|
+
## GeodataObject
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"cron": "0 4 * * *",
|
|
20
|
+
"outbound": "proxy",
|
|
21
|
+
"assets": [
|
|
22
|
+
{ "url": "https://example.com/geoip.dat", "file": "geoip.dat" },
|
|
23
|
+
{ "url": "https://example.com/geosite.dat", "file": "geosite.dat" }
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> `cron`: string
|
|
29
|
+
|
|
30
|
+
A standard 5-field cron expression, evaluated in the local time zone of the Xray runtime environment. For example:
|
|
31
|
+
|
|
32
|
+
- `"0 4 * * *"`: run every day at 04:00.
|
|
33
|
+
- `"30 3 * * 1"`: run every Monday at 03:30.
|
|
34
|
+
|
|
35
|
+
If omitted, the scheduled task is not enabled. If the previous task is still running, the next trigger is skipped.
|
|
36
|
+
|
|
37
|
+
> `outbound`: string
|
|
38
|
+
|
|
39
|
+
The outbound proxy `tag` used when downloading geodata files. If omitted, downloads go through the routing module.
|
|
40
|
+
|
|
41
|
+
> `assets`: \[ [AssetObject](#assetobject) \]
|
|
42
|
+
|
|
43
|
+
The list of geodata files to download and replace.
|
|
44
|
+
|
|
45
|
+
If reloading fails after the download, all files replaced by this update are rolled back together.
|
|
46
|
+
|
|
47
|
+
### AssetObject
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"url": "https://example.com/geoip.dat",
|
|
52
|
+
"file": "geoip.dat"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
> `url`: string
|
|
57
|
+
|
|
58
|
+
The resource download URL. It must be an HTTPS URL.
|
|
59
|
+
|
|
60
|
+
> `file`: string
|
|
61
|
+
|
|
62
|
+
The resource filename to write, such as `geoip.dat` or `geosite.dat`.
|
|
63
|
+
|
|
64
|
+
The file is resolved using the [Resource File Path](./features/env.md#resource-file-path). It must be an existing regular file inside the resource directory; absolute paths and paths escaping the resource directory are not supported.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/inbound.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/inbound.md
|
|
4
|
+
title: Inbound Proxy
|
|
5
|
+
category: basic
|
|
6
|
+
slug: inbound
|
|
7
|
+
fetched_at: 2026-05-04T18:42:40.036Z
|
|
8
|
+
---
|
|
9
|
+
# Inbound Proxy
|
|
10
|
+
|
|
11
|
+
Inbound connections are used to receive incoming data. For available protocols, please refer to [Inbound Protocols](./inbounds/).
|
|
12
|
+
|
|
13
|
+
## InboundObject
|
|
14
|
+
|
|
15
|
+
`InboundObject` corresponds to a child element of the `inbounds` item in the configuration file.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"inbounds": [
|
|
20
|
+
{
|
|
21
|
+
"listen": "127.0.0.1",
|
|
22
|
+
"port": 1080,
|
|
23
|
+
"protocol": "protocol_name",
|
|
24
|
+
"settings": {},
|
|
25
|
+
"streamSettings": {},
|
|
26
|
+
"tag": "identifier",
|
|
27
|
+
"sniffing": {
|
|
28
|
+
"enabled": true,
|
|
29
|
+
"destOverride": ["http", "tls"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> `listen`: address
|
|
37
|
+
|
|
38
|
+
The listening address, which can be an IP address or a Unix domain socket. The default value is `"0.0.0.0"`, which means listening on all network interfaces.
|
|
39
|
+
|
|
40
|
+
You can specify an IP address available on the system.
|
|
41
|
+
|
|
42
|
+
`"::"` is equivalent to `"0.0.0.0"`; both will listen on IPv6 and IPv4 simultaneously. However, if you only want to listen on IPv6, you can set `v6only` in `sockopt` to true. If you only want to listen on IPv4, you can use commands like `ip a` to view the specific IP on the network card (usually the machine's public IP address or a private network address like 10.x.x.x) and listen on that. Of course, you can do the same for IPv6.
|
|
43
|
+
|
|
44
|
+
Note that because UDP is not connection-oriented, if the inbound is based on UDP and there are multiple IP addresses on the network card, and the external connection is to a non-preferred address on the card, Xray might incorrectly use the preferred address as the source address for the reply instead of the target of the external connection, causing the connection to fail.
|
|
45
|
+
The solution is not to listen on `0.0.0.0` but to listen on the specific IP address on the network card.
|
|
46
|
+
|
|
47
|
+
Supports Unix domain sockets in absolute path format, such as `"/dev/shm/domain.socket"`. You can add `@` at the beginning to represent [abstract](https://www.man7.org/linux/man-pages/man7/unix.7.html), and `@@` for abstract with padding.
|
|
48
|
+
|
|
49
|
+
When filling in a Unix domain socket, `port` and `allocate` will be ignored. The protocol can currently be VLESS, VMess, or Trojan, and applies only to TCP-based underlying transports, such as `tcp`, `websocket`, `grpc`. UDP-based transports like `mkcp` are not supported.
|
|
50
|
+
|
|
51
|
+
When filling in a Unix domain socket, you can use the format `"/dev/shm/domain.socket,0666"`, i.e., adding a comma and access permission indicators after the socket, to specify the access permissions of the socket. This can be used to solve socket permission issues that occur by default.
|
|
52
|
+
|
|
53
|
+
> `port`: number | "env:variable" | string
|
|
54
|
+
|
|
55
|
+
Port. Accepted formats are as follows:
|
|
56
|
+
|
|
57
|
+
- Integer value: The actual port number.
|
|
58
|
+
- Environment variable: Starts with `"env:"`, followed by the name of an environment variable, such as `"env:PORT"`. Xray will parse this environment variable as a string.
|
|
59
|
+
- String: Can be a numeric string, such as `"1234"`; or a numerical range, such as `"5-10"` indicating ports 5 to 10 (6 ports in total). Commas can be used for segmentation, such as `11,13,15-17` indicating port 11, port 13, and ports 15 to 17 (5 ports in total).
|
|
60
|
+
|
|
61
|
+
When only one port is specified, Xray will listen for inbound connections on this port. When a port range is specified, Xray will listen on all ports within the range.
|
|
62
|
+
|
|
63
|
+
Note that listening on a port is a relatively expensive operation. Listening on a port range that is too large may cause a significant increase in resource usage or even cause Xray to fail to work properly. Generally speaking, problems may begin to appear when the number of listening ports approaches four digits. If you need to use a very large range, please consider using iptables for redirection instead of setting it here.
|
|
64
|
+
|
|
65
|
+
> `protocol`: "dokodemo-door" | "http" | "shadowsocks" | "socks" | "vless" | "vmess" | "trojan" | "wireguard" | "hysteria"
|
|
66
|
+
|
|
67
|
+
Connection protocol name. See the list of available [Inbound Protocols](./inbounds/) on the left.
|
|
68
|
+
|
|
69
|
+
> `settings`: InboundConfigurationObject
|
|
70
|
+
|
|
71
|
+
Specific configuration content, which varies by protocol. See `InboundConfigurationObject` in each protocol section for details.
|
|
72
|
+
|
|
73
|
+
> `streamSettings`: [StreamSettingsObject](./transport.md#streamsettingsobject)
|
|
74
|
+
|
|
75
|
+
Underlying transport method (transport) is the way the current Xray node connects with other nodes.
|
|
76
|
+
|
|
77
|
+
> `tag`: string
|
|
78
|
+
> The identifier of this inbound connection, used to locate this connection in other configurations.
|
|
79
|
+
|
|
80
|
+
::: danger
|
|
81
|
+
When it is not empty, its value must be **unique** among all `tag`s.
|
|
82
|
+
:::
|
|
83
|
+
|
|
84
|
+
> `sniffing`: [SniffingObject](#sniffingobject)
|
|
85
|
+
|
|
86
|
+
Traffic sniffing is mainly used for transparent proxies and similar purposes. A typical flow is as follows:
|
|
87
|
+
|
|
88
|
+
1. If a device accesses the internet and visits abc.com, the device first queries DNS to get the IP of abc.com as 1.2.3.4, and then the device initiates a connection to 1.2.3.4.
|
|
89
|
+
2. If sniffing is not configured, the connection request received by Xray is for 1.2.3.4, which cannot be used for routing traffic based on domain rules.
|
|
90
|
+
3. When `enabled` in sniffing is set to `true`, Xray will sniff the domain name, i.e., abc.com, from the traffic data when processing this connection.
|
|
91
|
+
4. Xray will reset 1.2.3.4 to abc.com. The routing can then divert traffic according to the domain rules.
|
|
92
|
+
|
|
93
|
+
Because it becomes a connection requesting abc.com, more things can be done. Besides routing domain rule diversion, it can also re-perform DNS resolution and other tasks.
|
|
94
|
+
|
|
95
|
+
When `enabled` in sniffing is set to `true`, it can also sniff Bittorrent type traffic. Then you can configure the "protocol" item in routing to set rules for handling unencrypted BT traffic. For example, the server side can be used to intercept unencrypted BT traffic, or the client side can fixedly forward BT traffic to a certain VPS, etc.
|
|
96
|
+
|
|
97
|
+
Note: Newer browsers may use ECH to encrypt the Client Hello. In this case, Xray can only see the domain in the Outer Hello. You may need to consider hijacking DNS or manually disabling ECH in the browser configuration.
|
|
98
|
+
|
|
99
|
+
### SniffingObject
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"enabled": true,
|
|
104
|
+
"destOverride": ["http", "tls", "fakedns"],
|
|
105
|
+
"metadataOnly": false,
|
|
106
|
+
"domainsExcluded": [],
|
|
107
|
+
"ipsExcluded": [],
|
|
108
|
+
"routeOnly": false
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> `enabled`: true | false
|
|
113
|
+
|
|
114
|
+
Whether to enable traffic sniffing.
|
|
115
|
+
|
|
116
|
+
> `destOverride`: \["http" | "tls" | "quic" | "fakedns"\]
|
|
117
|
+
|
|
118
|
+
When the traffic is of the specified type, reset the destination of the current connection based on the destination address contained within it.
|
|
119
|
+
|
|
120
|
+
::: tip
|
|
121
|
+
Xray will only sniff the domains of protocols in `destOverride` for routing purposes. If you only want to sniff for routing but do not want to reset the destination address (e.g., resetting the destination address when using the Tor browser will cause connection failure), please add the corresponding protocol here and enable `routeOnly`.
|
|
122
|
+
:::
|
|
123
|
+
|
|
124
|
+
> `metadataOnly`: true | false
|
|
125
|
+
|
|
126
|
+
When enabled, only the connection metadata will be used to sniff the destination address. At this time, sniffers other than `fakedns` will not be activated.
|
|
127
|
+
|
|
128
|
+
If disabled (using more than just metadata to infer the destination address), the client must send data first before the proxy server actually establishes a connection. This behavior is incompatible with protocols where the server must initiate the first message, such as the SMTP protocol.
|
|
129
|
+
|
|
130
|
+
> `domainsExcluded`: [string]
|
|
131
|
+
|
|
132
|
+
A list of domains. If the result of traffic sniffing is in this list, the destination address will **not** be reset. The domain format is the same as in [Routing Configuration](./routing.md#ruleobject).
|
|
133
|
+
|
|
134
|
+
::: tip
|
|
135
|
+
Filling in some domains may solve issues with iOS push notifications, Mijia smart devices, and voice chat in certain games (Rainbow Six).<br>
|
|
136
|
+
If you need to troubleshoot the cause of certain problems, you can test by disabling `"sniffing"` or enabling `"routeOnly"`.
|
|
137
|
+
:::
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
"domainsExcluded": [
|
|
141
|
+
"courier.push.apple.com", // iOS push notifications
|
|
142
|
+
"Mijia Cloud", // Mijia smart devices
|
|
143
|
+
"dlg.io.mi.com"
|
|
144
|
+
]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
> `ipsExcluded`: [string]
|
|
148
|
+
|
|
149
|
+
A list of IPs. If the destination address is in this list, the destination address will **not** be reset. The format is the same as in [Routing Configuration](./routing.md#ruleobject).
|
|
150
|
+
|
|
151
|
+
> `routeOnly`: true | false
|
|
152
|
+
|
|
153
|
+
Use the sniffed domain only for routing; the proxy destination address remains the IP. The default value is `false`.
|
|
154
|
+
|
|
155
|
+
This item requires `destOverride` to be enabled to work.
|
|
156
|
+
|
|
157
|
+
::: tip
|
|
158
|
+
When it is guaranteed that **the proxied connection can obtain correct DNS resolution**, using `routeOnly` while enabling `destOverride`, and setting the routing matching strategy `domainStrategy` to `AsIs`, allows for domain and IP traffic splitting without DNS resolution throughout the process. In this case, the IP used when matching IP rules is the original IP of the domain name.
|
|
159
|
+
:::
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/index.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/index.md
|
|
4
|
+
title: Configuration File
|
|
5
|
+
category: basic
|
|
6
|
+
slug: index
|
|
7
|
+
fetched_at: 2026-05-04T18:42:37.430Z
|
|
8
|
+
---
|
|
9
|
+
# Configuration File
|
|
10
|
+
|
|
11
|
+
> **This chapter will tell you all the details of Xray configuration. Mastering this content will allow you to unleash the greater power of Xray.**
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
The configuration file for Xray is in JSON format. There is no difference in the configuration format between the client and the server; only the actual configuration content differs.
|
|
16
|
+
The format is as follows:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"version": {},
|
|
21
|
+
"log": {},
|
|
22
|
+
"api": {},
|
|
23
|
+
"dns": {},
|
|
24
|
+
"routing": {},
|
|
25
|
+
"policy": {},
|
|
26
|
+
"inbounds": [],
|
|
27
|
+
"outbounds": [],
|
|
28
|
+
"transport": {},
|
|
29
|
+
"stats": {},
|
|
30
|
+
"reverse": {},
|
|
31
|
+
"fakedns": {},
|
|
32
|
+
"metrics": {},
|
|
33
|
+
"observatory": {},
|
|
34
|
+
"burstObservatory": {},
|
|
35
|
+
"geodata": {}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
::: warning
|
|
40
|
+
If you are new to Xray, you can click to view [Configuration & Run in Quick Start](../document/install.md) first to learn the most basic configuration methods, and then check the content of this chapter to master all configuration methods of Xray.
|
|
41
|
+
:::
|
|
42
|
+
|
|
43
|
+
::: details Click to expand: Learn how to make AI write the correct configuration file directly
|
|
44
|
+
It is recommended to copy the following content and send it to the AI, which can significantly improve the usability of the generated configuration:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
[https://xtls.github.io/llms-full.txt](https://xtls.github.io/llms-full.txt) This link is the official full documentation of Xray-core.
|
|
48
|
+
|
|
49
|
+
【Role Setting】
|
|
50
|
+
You are an expert proficient in network protocols and Xray-core configuration.
|
|
51
|
+
|
|
52
|
+
【Task Requirements】
|
|
53
|
+
1. Knowledge Base: Please read and deeply understand the content of this link, and use it as the sole basis for answering questions and writing configurations.
|
|
54
|
+
2. No Hallucinations: Absolutely do not fabricate fields that do not exist in the documentation. If the documentation does not mention it, please tell me directly "Documentation does not mention".
|
|
55
|
+
3. Default Format: Although Xray supports multiple formats, please output standard JSON format configuration by default (unless I explicitly request YAML or TOML), and add key comments.
|
|
56
|
+
4. Exception Handling: If you cannot access this link, please inform me clearly and prompt me to manually download the documentation and upload it to you.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
:::
|
|
60
|
+
|
|
61
|
+
## Basic Configuration Modules
|
|
62
|
+
|
|
63
|
+
> version
|
|
64
|
+
|
|
65
|
+
Optional. Controls the version on which this config can run. This prevents accidental running on unexpected client versions when sharing the config. The client will check if the current version matches this requirement at runtime.
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
"version": {
|
|
69
|
+
"min": "25.8.3",
|
|
70
|
+
"max": ""
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Both `min` and `max` are optional. Not setting them or leaving them empty means no restrictions. It does not need to be an actual existing version, as long as it complies with the Xray version syntax x.y.z.
|
|
75
|
+
|
|
76
|
+
25.8.3 is the version where Xray added this feature. Setting a version lower than this is meaningless (older versions will not check it).
|
|
77
|
+
|
|
78
|
+
> log:[LogObject](./log.md)
|
|
79
|
+
|
|
80
|
+
Log configuration, controls how Xray outputs logs.
|
|
81
|
+
|
|
82
|
+
> api:[ApiObject](./api.md)
|
|
83
|
+
|
|
84
|
+
Provides some API interfaces for remote calls.
|
|
85
|
+
|
|
86
|
+
> dns: [DnsObject](./dns.md)
|
|
87
|
+
|
|
88
|
+
Built-in DNS server. If this item is not configured, the system DNS settings are used.
|
|
89
|
+
|
|
90
|
+
> routing: [RoutingObject](./routing.md)
|
|
91
|
+
|
|
92
|
+
Routing function. You can set rules to divert data to be sent out from different outbounds.
|
|
93
|
+
|
|
94
|
+
> policy: [PolicyObject](./policy.md)
|
|
95
|
+
|
|
96
|
+
Local policy. You can set different user levels and corresponding policy settings.
|
|
97
|
+
|
|
98
|
+
> inbounds: \[ [InboundObject](./inbound.md) \]
|
|
99
|
+
|
|
100
|
+
An array. Each element is an inbound connection configuration.
|
|
101
|
+
|
|
102
|
+
> outbounds: \[ [OutboundObject](./outbound.md) \]
|
|
103
|
+
|
|
104
|
+
An array. Each element is an outbound connection configuration.
|
|
105
|
+
|
|
106
|
+
> transport: [TransportObject](./transport.md)
|
|
107
|
+
|
|
108
|
+
Used to configure how Xray establishes and uses network connections with other servers.
|
|
109
|
+
|
|
110
|
+
> stats: [StatsObject](./stats.md)
|
|
111
|
+
|
|
112
|
+
Used to configure traffic statistics.
|
|
113
|
+
|
|
114
|
+
> reverse: [ReverseObject](./reverse.md)
|
|
115
|
+
|
|
116
|
+
Reverse proxy. Can forward server-side traffic to the client, i.e., reverse traffic forwarding.
|
|
117
|
+
|
|
118
|
+
> fakedns: [FakeDnsObject](./fakedns.md)
|
|
119
|
+
|
|
120
|
+
FakeDNS configuration. Can be used with transparent proxies to obtain the actual domain name.
|
|
121
|
+
|
|
122
|
+
> metrics: [metricsObject](./metrics.md)
|
|
123
|
+
|
|
124
|
+
Metrics configuration. A more direct (hopefully better) way to export statistics.
|
|
125
|
+
|
|
126
|
+
> observatory: [ObservatoryObject](./observatory.md#observatoryobject)
|
|
127
|
+
|
|
128
|
+
Background connection observatory. Detects the connection status of outbound proxies.
|
|
129
|
+
|
|
130
|
+
> burstObservatory: [BurstObservatoryObject](./observatory.md#burstobservatoryobject)
|
|
131
|
+
|
|
132
|
+
Burst connection observatory. Detects the connection status of outbound proxies.
|
|
133
|
+
|
|
134
|
+
> geodata: [GeodataObject](./geodata.md)
|
|
135
|
+
|
|
136
|
+
Automatic update and hot reload for geodata files.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://xtls.github.io/en/config/log.html
|
|
3
|
+
source_url: https://raw.githubusercontent.com/XTLS/Xray-docs-next/main/docs/en/config/log.md
|
|
4
|
+
title: Log Configuration
|
|
5
|
+
category: basic
|
|
6
|
+
slug: log
|
|
7
|
+
fetched_at: 2026-05-04T18:42:37.922Z
|
|
8
|
+
---
|
|
9
|
+
# Log Configuration
|
|
10
|
+
|
|
11
|
+
Log configuration controls how Xray outputs logs.
|
|
12
|
+
|
|
13
|
+
Xray has two types of logs: access logs and error logs. You can configure the output method for each type independently.
|
|
14
|
+
|
|
15
|
+
## LogObject
|
|
16
|
+
|
|
17
|
+
`LogObject` corresponds to the `log` entry in the configuration file.
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"log": {
|
|
22
|
+
"access": "file_path",
|
|
23
|
+
"error": "file_path",
|
|
24
|
+
"loglevel": "warning",
|
|
25
|
+
"dnsLog": false,
|
|
26
|
+
"maskAddress": ""
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> `access`: string
|
|
32
|
+
|
|
33
|
+
The file path for the access log. Its value must be a valid file path, such as `"/var/log/Xray/access.log"` (Linux) or `"C:\\Temp\\Xray\\_access.log"` (Windows). When this item is unspecified or empty, logs are output to stdout.
|
|
34
|
+
|
|
35
|
+
- Special value `none`: disables the access log.
|
|
36
|
+
|
|
37
|
+
> `error`: string
|
|
38
|
+
|
|
39
|
+
The file path for the error log. Its value must be a valid file path, such as `"/var/log/Xray/error.log"` (Linux) or `"C:\\Temp\\Xray\\_error.log"` (Windows). When this item is unspecified or empty, logs are output to stdout.
|
|
40
|
+
|
|
41
|
+
- Special value `none`: disables the error log.
|
|
42
|
+
|
|
43
|
+
> `loglevel`: "debug" | "info" | "warning" | "error" | "none"
|
|
44
|
+
|
|
45
|
+
The level of the error log, indicating the information that needs to be recorded.
|
|
46
|
+
The default value is `"warning"`.
|
|
47
|
+
|
|
48
|
+
- `"debug"`: Output information used for debugging. Includes all `"info"` content.
|
|
49
|
+
- `"info"`: Runtime status information, etc., which does not affect normal usage. Includes all `"warning"` content.
|
|
50
|
+
- `"warning"`: Information output when issues occur that do not affect normal operation but may impact user experience. Includes all `"error"` content.
|
|
51
|
+
- `"error"`: Xray encountered a problem where it cannot operate normally and requires immediate resolution.
|
|
52
|
+
- `"none"`: Do not record any content.
|
|
53
|
+
|
|
54
|
+
> `dnsLog`: bool
|
|
55
|
+
|
|
56
|
+
Whether to enable DNS query logs, for example: `DOH//doh.server got answer: domain.com -> [ip1, ip2] 2.333ms`
|
|
57
|
+
|
|
58
|
+
> `maskAddress`: "quarter" | "half" | "full"
|
|
59
|
+
|
|
60
|
+
IP address mask. When enabled, it automatically replaces IP addresses appearing in the log to protect privacy when sharing logs. The default is empty (disabled).
|
|
61
|
+
|
|
62
|
+
Currently, the available levels are `quarter`, `half`, and `full`. The masking formats correspond as follows:
|
|
63
|
+
|
|
64
|
+
- ipv4 `1.2.*.*` `1.*.*.*` `[Masked IPv4]`
|
|
65
|
+
- ipv6 `1234:5678::/32` `1234::/16` `[Masked IPv6]`
|
|
66
|
+
|
|
67
|
+
For more specific requirements, you can use a custom format such as `/16+/32`. The format defines the number of bits to keep unmasked; the first number is for IPv4 and the second for IPv6. Note that the IPv4 value must be divisible by 8. Using /32 (IPv4) or /128 (IPv6) means no masking, while /0 will display as `[Masked IPv4/IPv6]`.
|