diff --git a/docs/config/inbounds/http.md b/docs/config/inbounds/http.md index 760d17f5..8e495aec 100644 --- a/docs/config/inbounds/http.md +++ b/docs/config/inbounds/http.md @@ -23,14 +23,22 @@ HTTP 协议。 ```json { - "users": [ + "inbounds": [ { - "user": "my-username", - "pass": "my-password" + // ... + "settings": { + // [!code focus:8] + "users": [ + { + "user": "my-username", + "pass": "my-password" + } + ], + "allowTransparent": false, + "userLevel": 0 + } } - ], - "allowTransparent": false, - "userLevel": 0 + ] } ``` diff --git a/docs/config/inbounds/hysteria.md b/docs/config/inbounds/hysteria.md index ff2bf545..a645c558 100644 --- a/docs/config/inbounds/hysteria.md +++ b/docs/config/inbounds/hysteria.md @@ -8,12 +8,20 @@ ```json { - "version": 2, - "users": [ + "inbounds": [ { - "auth": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com" + // ... + "settings": { + // [!code focus:8] + "version": 2, + "users": [ + { + "auth": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com" + } + ] + } } ] } diff --git a/docs/config/inbounds/shadowsocks.md b/docs/config/inbounds/shadowsocks.md index 2ef0df53..986bf045 100644 --- a/docs/config/inbounds/shadowsocks.md +++ b/docs/config/inbounds/shadowsocks.md @@ -31,19 +31,25 @@ Shadowsocks 2022 新协议格式提升了性能并带有完整的重放保护, ```json { - "settings": { - "network": "tcp,udp", - "method": "aes-256-gcm", - "password": "114514", - "level": 0, - "email": "love@xray.com", - "users": [ - { - "password": "1919810", - "method": "aes-128-gcm" + "inbounds": [ + { + // ... + "settings": { + // [!code focus:11] + "network": "tcp,udp", + "method": "aes-256-gcm", + "password": "114514", + "level": 0, + "email": "love@xray.com", + "users": [ + { + "password": "1919810", + "method": "aes-128-gcm" + } + ] } - ] - } + } + ] } ``` diff --git a/docs/config/inbounds/socks.md b/docs/config/inbounds/socks.md index 9af1e317..75f7bc42 100644 --- a/docs/config/inbounds/socks.md +++ b/docs/config/inbounds/socks.md @@ -12,16 +12,24 @@ ```json { - "auth": "noauth", - "users": [ + "inbounds": [ { - "user": "my-username", - "pass": "my-password" + // ... + "settings": { + // [!code focus:10] + "auth": "noauth", + "users": [ + { + "user": "my-username", + "pass": "my-password" + } + ], + "udp": false, + "ip": "127.0.0.1", + "userLevel": 0 + } } - ], - "udp": false, - "ip": "127.0.0.1", - "userLevel": 0 + ] } ``` diff --git a/docs/config/inbounds/trojan.md b/docs/config/inbounds/trojan.md index ca5c94c1..d057e09d 100644 --- a/docs/config/inbounds/trojan.md +++ b/docs/config/inbounds/trojan.md @@ -10,16 +10,24 @@ Trojan 被设计工作在正确配置的加密 TLS 隧道 ```json { - "users": [ + "inbounds": [ { - "password": "password", - "email": "love@xray.com", - "level": 0 - } - ], - "fallbacks": [ - { - "dest": 80 + // ... + "settings": { + // [!code focus:12] + "users": [ + { + "password": "password", + "email": "love@xray.com", + "level": 0 + } + ], + "fallbacks": [ + { + "dest": 80 + } + ] + } } ] } diff --git a/docs/config/inbounds/tun.md b/docs/config/inbounds/tun.md index 658c35e9..7f66c48e 100644 --- a/docs/config/inbounds/tun.md +++ b/docs/config/inbounds/tun.md @@ -6,13 +6,21 @@ ```json { - "name": "xray0", - "mtu": 1500, - "gateway": ["10.0.0.1/16", "fc00::1/64"], - "dns": ["1.1.1.1", "8.8.8.8"], - "userLevel": 0, - "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"], - "autoOutboundsInterface": "auto" + "inbounds": [ + { + // ... + "settings": { + // [!code focus:7] + "name": "xray0", + "mtu": 1500, + "gateway": ["10.0.0.1/16", "fc00::1/64"], + "dns": ["1.1.1.1", "8.8.8.8"], + "userLevel": 0, + "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"], + "autoOutboundsInterface": "auto" + } + } + ] } ``` diff --git a/docs/config/inbounds/tunnel.md b/docs/config/inbounds/tunnel.md index 1c54f782..2d488bf6 100644 --- a/docs/config/inbounds/tunnel.md +++ b/docs/config/inbounds/tunnel.md @@ -6,16 +6,24 @@ Tunnel(隧道),旧称 dokodemo-door(任意门),可以监听数个本 ```json { - "allowedNetwork": "tcp", - "rewriteAddress": "8.8.8.8", - "rewritePort": 53, - "portMap": { - "5555": "1.1.1.1:7777", - "5556": ":8888", // overrides port only - "5557": "example.com:" // overrides address only - }, - "followRedirect": false, - "userLevel": 0 + "inbounds": [ + { + // ... + "settings": { + // [!code focus:10] + "allowedNetwork": "tcp", + "rewriteAddress": "8.8.8.8", + "rewritePort": 53, + "portMap": { + "5555": "1.1.1.1:7777", + "5556": ":8888", // overrides port only + "5557": "example.com:" // overrides address only + }, + "followRedirect": false, + "userLevel": 0 + } + } + ] } ``` diff --git a/docs/config/inbounds/vless.md b/docs/config/inbounds/vless.md index cccd4bbd..194104e6 100644 --- a/docs/config/inbounds/vless.md +++ b/docs/config/inbounds/vless.md @@ -8,19 +8,27 @@ VLESS 是一个无状态的轻量传输协议,它分为入站和出站两部 ```json { - "users": [ + "inbounds": [ { - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com", - "flow": "xtls-rprx-vision", - "reverse": {} - } - ], - "decryption": "none", - "fallbacks": [ - { - "dest": 80 + // ... + "settings": { + // [!code focus:15] + "users": [ + { + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com", + "flow": "xtls-rprx-vision", + "reverse": {} + } + ], + "decryption": "none", + "fallbacks": [ + { + "dest": 80 + } + ] + } } ] } diff --git a/docs/config/inbounds/vmess.md b/docs/config/inbounds/vmess.md index a46db97c..1c897289 100644 --- a/docs/config/inbounds/vmess.md +++ b/docs/config/inbounds/vmess.md @@ -10,16 +10,24 @@ VMess 依赖于系统时间,请确保使用 Xray 的系统 UTC 时间误差在 ```json { - "users": [ + "inbounds": [ { - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com" + // ... + "settings": { + // [!code focus:10] + "users": [ + { + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com" + } + ], + "default": { + "level": 0 + } + } } - ], - "default": { - "level": 0 - } + ] } ``` diff --git a/docs/config/inbounds/wireguard.md b/docs/config/inbounds/wireguard.md index e26a5021..15605430 100644 --- a/docs/config/inbounds/wireguard.md +++ b/docs/config/inbounds/wireguard.md @@ -10,14 +10,22 @@ User-space Wireguard 协议实现。 ```json { - "secretKey": "PRIVATE_KEY", - "peers": [ + "inbounds": [ { - "publicKey": "PUBLIC_KEY", - "allowedIPs": [""] + // ... + "settings": { + // [!code focus:8] + "secretKey": "PRIVATE_KEY", + "peers": [ + { + "publicKey": "PUBLIC_KEY", + "allowedIPs": [""] + } + ], + "mtu": 1420 // optional, default 1420 + } } - ], - "mtu": 1420 // optional, default 1420 + ] } ``` diff --git a/docs/config/outbounds/blackhole.md b/docs/config/outbounds/blackhole.md index cd7f9e8c..c9f23152 100644 --- a/docs/config/outbounds/blackhole.md +++ b/docs/config/outbounds/blackhole.md @@ -6,9 +6,17 @@ Blackhole(黑洞)是一个出站数据协议,它会阻碍所有数据的 ```json { - "response": { - "type": "none" - } + "outbounds": [ + { + // ... + "settings": { + // [!code focus:3] + "response": { + "type": "none" + } + } + } + ] } ``` diff --git a/docs/config/outbounds/dns.md b/docs/config/outbounds/dns.md index 365774a5..33f6e407 100644 --- a/docs/config/outbounds/dns.md +++ b/docs/config/outbounds/dns.md @@ -10,19 +10,27 @@ DNS 是一个出站协议,用于接收由 routing 送入的 DNS 查询,并 ```json { - "rewriteNetwork": "udp", - "rewriteAddress": "1.1.1.1", - "rewritePort": 53, - "userLevel": 0, - "rules": [ + "outbounds": [ { - "action": "reject", - "domain": ["domain:example.com"] - }, - { - "action": "direct", - "qtype": 65, - "domain": ["geosite:geolocation-!cn"] + // ... + "settings": { + // [!code focus:15] + "rewriteNetwork": "udp", + "rewriteAddress": "1.1.1.1", + "rewritePort": 53, + "userLevel": 0, + "rules": [ + { + "action": "reject", + "domain": ["domain:example.com"] + }, + { + "action": "direct", + "qtype": 65, + "domain": ["geosite:geolocation-!cn"] + } + ] + } } ] } diff --git a/docs/config/outbounds/freedom.md b/docs/config/outbounds/freedom.md index 6566ab4b..b05da805 100644 --- a/docs/config/outbounds/freedom.md +++ b/docs/config/outbounds/freedom.md @@ -10,31 +10,39 @@ Freedom 是一个出站协议,可以用来向任意网络发送(正常的) ```json { - "domainStrategy": "AsIs", - "redirect": "127.0.0.1:3366", - "userLevel": 0, - "fragment": { - "packets": "tlshello", - "length": "100-200", - "interval": "10-20" // 单位ms - }, - "noises": [ + "outbounds": [ { - "type": "base64", - "packet": "7nQBAAABAAAAAAAABnQtcmluZwZtc2VkZ2UDbmV0AAABAAE=", - "delay": "10-16" - } - ], - "proxyProtocol": 0, - "finalRules": [ - { - "action": "block", - "network": "tcp", - "port": "22,25,465,587" - }, - { - "action": "block", - "ip": ["geoip:cn"] + // ... + "settings": { + // [!code focus:27] + "domainStrategy": "AsIs", + "redirect": "127.0.0.1:3366", + "userLevel": 0, + "fragment": { + "packets": "tlshello", + "length": "100-200", + "interval": "10-20" // 单位ms + }, + "noises": [ + { + "type": "base64", + "packet": "7nQBAAABAAAAAAAABnQtcmluZwZtc2VkZ2UDbmV0AAABAAE=", + "delay": "10-16" + } + ], + "proxyProtocol": 0, + "finalRules": [ + { + "action": "block", + "network": "tcp", + "port": "22,25,465,587" + }, + { + "action": "block", + "ip": ["geoip:cn"] + } + ] + } } ] } diff --git a/docs/config/outbounds/http.md b/docs/config/outbounds/http.md index beaa7b54..7d508d3b 100644 --- a/docs/config/outbounds/http.md +++ b/docs/config/outbounds/http.md @@ -14,16 +14,24 @@ HTTP 协议。 ```json { - "address": "192.168.108.1", - "port": 3128, - "user": "my-username", - "pass": "my-password", - "level": 0, - "email": "love@xray.com", - "headers": { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2" - } + "outbounds": [ + { + // ... + "settings": { + // [!code focus:10] + "address": "192.168.108.1", + "port": 3128, + "user": "my-username", + "pass": "my-password", + "level": 0, + "email": "love@xray.com", + "headers": { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", + "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2" + } + } + } + ] } ``` diff --git a/docs/config/outbounds/hysteria.md b/docs/config/outbounds/hysteria.md index fafcbff8..55cee878 100644 --- a/docs/config/outbounds/hysteria.md +++ b/docs/config/outbounds/hysteria.md @@ -12,9 +12,17 @@ Hysteria 协议的客户端实现。 ```json { - "version": 2, - "address": "192.168.108.1", - "port": 3128 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:3] + "version": 2, + "address": "192.168.108.1", + "port": 3128 + } + } + ] } ``` diff --git a/docs/config/outbounds/loopback.md b/docs/config/outbounds/loopback.md index 143775db..0a291720 100644 --- a/docs/config/outbounds/loopback.md +++ b/docs/config/outbounds/loopback.md @@ -6,7 +6,15 @@ Loopback 是个出站数据协议,其作用为将经该出站传出的数据 ```json { - "inboundTag": "TagUseAsInbound" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:1] + "inboundTag": "TagUseAsInbound" + } + } + ] } ``` diff --git a/docs/config/outbounds/shadowsocks.md b/docs/config/outbounds/shadowsocks.md index b8fc4f80..0cb7fb50 100644 --- a/docs/config/outbounds/shadowsocks.md +++ b/docs/config/outbounds/shadowsocks.md @@ -31,14 +31,22 @@ Shadowsocks 2022 新协议格式提升了性能并带有完整的重放保护, ```json { - "email": "love@xray.com", - "address": "127.0.0.1", - "port": 1234, - "method": "加密方式", - "password": "密码", - "uot": true, - "UoTVersion": 2, - "level": 0 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:8] + "email": "love@xray.com", + "address": "127.0.0.1", + "port": 1234, + "method": "加密方式", + "password": "密码", + "uot": true, + "UoTVersion": 2, + "level": 0 + } + } + ] } ``` diff --git a/docs/config/outbounds/socks.md b/docs/config/outbounds/socks.md index 6c4f8ee5..7cbda833 100644 --- a/docs/config/outbounds/socks.md +++ b/docs/config/outbounds/socks.md @@ -10,12 +10,20 @@ ```json { - "address": "127.0.0.1", - "port": 1234, - "user": "test user", - "pass": "test pass", - "level": 0, - "email": "love@xray.com" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:6] + "address": "127.0.0.1", + "port": 1234, + "user": "test user", + "pass": "test pass", + "level": 0, + "email": "love@xray.com" + } + } + ] } ``` diff --git a/docs/config/outbounds/trojan.md b/docs/config/outbounds/trojan.md index 40f56ec7..dc053ccb 100644 --- a/docs/config/outbounds/trojan.md +++ b/docs/config/outbounds/trojan.md @@ -10,11 +10,19 @@ Trojan 被设计工作在正确配置的加密 TLS 隧道 ```json { - "address": "127.0.0.1", - "port": 1234, - "password": "password", - "email": "love@xray.com", - "level": 0 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:5] + "address": "127.0.0.1", + "port": 1234, + "password": "password", + "email": "love@xray.com", + "level": 0 + } + } + ] } ``` diff --git a/docs/config/outbounds/vless.md b/docs/config/outbounds/vless.md index a2c2419b..c1c2ee14 100644 --- a/docs/config/outbounds/vless.md +++ b/docs/config/outbounds/vless.md @@ -8,13 +8,21 @@ VLESS 是一个无状态的轻量传输协议,它分为入站和出站两部 ```json { - "address": "example.com", - "port": 443, - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "encryption": "none", - "flow": "xtls-rprx-vision", - "level": 0, - "reverse": {} + "outbounds": [ + { + // ... + "settings": { + // [!code focus:7] + "address": "example.com", + "port": 443, + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "encryption": "none", + "flow": "xtls-rprx-vision", + "level": 0, + "reverse": {} + } + } + ] } ``` diff --git a/docs/config/outbounds/vmess.md b/docs/config/outbounds/vmess.md index d5fd4201..5daa701b 100644 --- a/docs/config/outbounds/vmess.md +++ b/docs/config/outbounds/vmess.md @@ -10,12 +10,20 @@ VMess 依赖于系统时间,请确保使用 Xray 的系统 UTC 时间误差在 ```json { - "address": "127.0.0.1", - "port": 37192, - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "security": "auto", - "level": 0, - "experiments": "" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:6] + "address": "127.0.0.1", + "port": 37192, + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "security": "auto", + "level": 0, + "experiments": "" + } + } + ] } ``` diff --git a/docs/config/outbounds/wireguard.md b/docs/config/outbounds/wireguard.md index 757f569d..3b7953f4 100644 --- a/docs/config/outbounds/wireguard.md +++ b/docs/config/outbounds/wireguard.md @@ -10,24 +10,32 @@ ```json { - "secretKey": "PRIVATE_KEY", - "address": [ - // optional, default ["10.0.0.1", "fd59:7153:2388:b5fd:0000:0000:0000:0001"] - "IPv4_CIDR", - "IPv6_CIDR", - "and more..." - ], - "peers": [ + "outbounds": [ { - "endpoint": "ENDPOINT_ADDR", - "publicKey": "PUBLIC_KEY" + // ... + "settings": { + // [!code focus:18] + "secretKey": "PRIVATE_KEY", + "address": [ + // optional, default ["10.0.0.1", "fd59:7153:2388:b5fd:0000:0000:0000:0001"] + "IPv4_CIDR", + "IPv6_CIDR", + "and more..." + ], + "peers": [ + { + "endpoint": "ENDPOINT_ADDR", + "publicKey": "PUBLIC_KEY" + } + ], + "noKernelTun": false, + "mtu": 1420, // optional, default 1420 + "reserved": [1, 2, 3], + "workers": 2, // optional, default runtime.NumCPU() + "domainStrategy": "ForceIP" + } } - ], - "noKernelTun": false, - "mtu": 1420, // optional, default 1420 - "reserved": [1, 2, 3], - "workers": 2, // optional, default runtime.NumCPU() - "domainStrategy": "ForceIP" + ] } ``` diff --git a/docs/config/transport.md b/docs/config/transport.md index dcd00041..092c511d 100644 --- a/docs/config/transport.md +++ b/docs/config/transport.md @@ -10,40 +10,49 @@ ```json { - "network": "raw", - "security": "none", - "tlsSettings": {}, - "realitySettings": {}, - "rawSettings": {}, - "xhttpSettings": {}, - "kcpSettings": {}, - "grpcSettings": {}, - "wsSettings": {}, - "httpupgradeSettings": {}, - "hysteriaSettings": {}, - "finalmask": { - "tcp": [], - "udp": [], - "quicParams": {} - }, - "sockopt": { - "mark": 0, - "tcpMaxSeg": 1440, - "tcpFastOpen": false, - "tproxy": "off", - "domainStrategy": "AsIs", - "happyEyeballs": {}, - "dialerProxy": "", - "acceptProxyProtocol": false, - "tcpKeepAliveInterval": 0, - "tcpKeepAliveIdle": 300, - "tcpUserTimeout": 10000, - "tcpCongestion": "bbr", - "interface": "wg0", - "v6only": false, - "tcpWindowClamp": 600, - "tcpMptcp": false - } + // outbound 示例,同样可用于 inbound + "outbounds": [ + { + // ... + "streamSettings": { + // [!code focus:34] + "network": "raw", + "security": "none", + "tlsSettings": {}, + "realitySettings": {}, + "rawSettings": {}, + "xhttpSettings": {}, + "kcpSettings": {}, + "grpcSettings": {}, + "wsSettings": {}, + "httpupgradeSettings": {}, + "hysteriaSettings": {}, + "finalmask": { + "tcp": [], + "udp": [], + "quicParams": {} + }, + "sockopt": { + "mark": 0, + "tcpMaxSeg": 1440, + "tcpFastOpen": false, + "tproxy": "off", + "domainStrategy": "AsIs", + "happyEyeballs": {}, + "dialerProxy": "", + "acceptProxyProtocol": false, + "tcpKeepAliveInterval": 0, + "tcpKeepAliveIdle": 300, + "tcpUserTimeout": 10000, + "tcpCongestion": "bbr", + "interface": "wg0", + "v6only": false, + "tcpWindowClamp": 600, + "tcpMptcp": false + } + } + } + ] } ``` diff --git a/docs/config/transports/grpc.md b/docs/config/transports/grpc.md index 92c5b34c..cca0c2dd 100644 --- a/docs/config/transports/grpc.md +++ b/docs/config/transports/grpc.md @@ -39,14 +39,26 @@ gRPC(HTTP/2)内置多路复用,不建议使用 gRPC 与 HTTP/2 时启用 m ```json { - "authority": "grpc.example.com", - "serviceName": "name", - "multiMode": false, - "user_agent": "custom user agent", - "idle_timeout": 60, - "health_check_timeout": 20, - "permit_without_stream": false, - "initial_windows_size": 0 + // outbound 示例,同样可用于 inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "grpc", + "grpcSettings": { + // [!code focus:8] + "authority": "grpc.example.com", + "serviceName": "name", + "multiMode": false, + "user_agent": "custom user agent", + "idle_timeout": 60, + "health_check_timeout": 20, + "permit_without_stream": false, + "initial_windows_size": 0 + } + } + } + ] } ``` diff --git a/docs/config/transports/httpupgrade.md b/docs/config/transports/httpupgrade.md index 70dabb89..d176998a 100644 --- a/docs/config/transports/httpupgrade.md +++ b/docs/config/transports/httpupgrade.md @@ -13,12 +13,24 @@ ```json { - "acceptProxyProtocol": false, - "path": "/", - "host": "xray.com", - "headers": { - "key": "value" - } + // outbound 示例,同样可用于 inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "httpupgrade", + "httpupgradeSettings": { + // [!code focus:6] + "acceptProxyProtocol": false, + "path": "/", + "host": "xray.com", + "headers": { + "key": "value" + } + } + } + } + ] } ``` diff --git a/docs/config/transports/hysteria.md b/docs/config/transports/hysteria.md index a28a0c57..56bf0b0c 100644 --- a/docs/config/transports/hysteria.md +++ b/docs/config/transports/hysteria.md @@ -8,24 +8,33 @@ Hysteria2 的底层 QUIC 传输的 Xray 实现,通常搭配 hysteria[出站](. ```json { - "version": 2, - "auth": "password", - "udpIdleTimeout": 60, - "masquerade": { - "type": "", - - "dir": "", - - "url": "", - "rewriteHost": false, - "insecure": false, - - "content": "", - "headers": { - "key": "value" - }, - "statusCode": 0 - } + // outbound 示例,同样可用于 inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "hysteria", + "hysteriaSettings": { + // [!code focus:14] + "version": 2, + "auth": "password", + "udpIdleTimeout": 60, + "masquerade": { + "type": "", + "dir": "", + "url": "", + "rewriteHost": false, + "insecure": false, + "content": "", + "headers": { + "key": "value" + }, + "statusCode": 0 + } + } + } + } + ] } ``` diff --git a/docs/config/transports/mkcp.md b/docs/config/transports/mkcp.md index ddf65e25..3a590c8e 100644 --- a/docs/config/transports/mkcp.md +++ b/docs/config/transports/mkcp.md @@ -14,13 +14,25 @@ mKCP 牺牲带宽来降低延迟。传输同样的内容,mKCP 一般比 TCP ```json { - "mtu": 1350, - "tti": 20, - "uplinkCapacity": 5, - "downlinkCapacity": 20, - "congestion": false, - "readBufferSize": 1, - "writeBufferSize": 1 + // outbound 示例,同样可用于 inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "mkcp", + "kcpSettings": { + // [!code focus:7] + "mtu": 1350, + "tti": 20, + "uplinkCapacity": 5, + "downlinkCapacity": 20, + "congestion": false, + "readBufferSize": 1, + "writeBufferSize": 1 + } + } + } + ] } ``` diff --git a/docs/config/transports/raw.md b/docs/config/transports/raw.md index 0eed9bc6..e33e64a0 100644 --- a/docs/config/transports/raw.md +++ b/docs/config/transports/raw.md @@ -10,10 +10,22 @@ ```json { - "acceptProxyProtocol": false, - "header": { - "type": "none" - } + // outbound 示例,同样可用于 inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "raw", + "rawSettings": { + // [!code focus:4] + "acceptProxyProtocol": false, + "header": { + "type": "none" + } + } + } + } + ] } ``` diff --git a/docs/config/transports/websocket.md b/docs/config/transports/websocket.md index 4665feb2..9040a2e9 100644 --- a/docs/config/transports/websocket.md +++ b/docs/config/transports/websocket.md @@ -18,13 +18,25 @@ Websocket 会识别 HTTP 请求的 X-Forwarded-For 头来覆写流量的源地 ```json { - "acceptProxyProtocol": false, - "path": "/", - "host": "xray.com", - "headers": { - "key": "value" - }, - "heartbeatPeriod": 10 + // outbound 示例,同样可用于 inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "websocket", + "wsSettings": { + // [!code focus:7] + "acceptProxyProtocol": false, + "path": "/", + "host": "xray.com", + "headers": { + "key": "value" + }, + "heartbeatPeriod": 10 + } + } + } + ] } ``` diff --git a/docs/en/config/inbounds/http.md b/docs/en/config/inbounds/http.md index b19a18b4..1851f611 100644 --- a/docs/en/config/inbounds/http.md +++ b/docs/en/config/inbounds/http.md @@ -23,14 +23,22 @@ Use the following environment variables in Linux to enable a global HTTP proxy f ```json { - "users": [ + "inbounds": [ { - "user": "my-username", - "pass": "my-password" + // ... + "settings": { + // [!code focus:8] + "users": [ + { + "user": "my-username", + "pass": "my-password" + } + ], + "allowTransparent": false, + "userLevel": 0 + } } - ], - "allowTransparent": false, - "userLevel": 0 + ] } ``` diff --git a/docs/en/config/inbounds/hysteria.md b/docs/en/config/inbounds/hysteria.md index 886c3c99..6cb83f4b 100644 --- a/docs/en/config/inbounds/hysteria.md +++ b/docs/en/config/inbounds/hysteria.md @@ -8,12 +8,20 @@ The `hysteria protocol` itself has no authentication; `users` only take effect w ```json { - "version": 2, - "users": [ + "inbounds": [ { - "auth": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com" + // ... + "settings": { + // [!code focus:8] + "version": 2, + "users": [ + { + "auth": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com" + } + ] + } } ] } diff --git a/docs/en/config/inbounds/shadowsocks.md b/docs/en/config/inbounds/shadowsocks.md index f2150fb0..a6bf0159 100644 --- a/docs/en/config/inbounds/shadowsocks.md +++ b/docs/en/config/inbounds/shadowsocks.md @@ -31,19 +31,25 @@ Under the "none" encryption method, traffic will be transmitted in plain text. T ```json { - "settings": { - "network": "tcp,udp", - "method": "aes-256-gcm", - "password": "114514", - "level": 0, - "email": "love@xray.com", - "users": [ - { - "password": "1919810", - "method": "aes-128-gcm" + "inbounds": [ + { + // ... + "settings": { + // [!code focus:11] + "network": "tcp,udp", + "method": "aes-256-gcm", + "password": "114514", + "level": 0, + "email": "love@xray.com", + "users": [ + { + "password": "1919810", + "method": "aes-128-gcm" + } + ] } - ] - } + } + ] } ``` diff --git a/docs/en/config/inbounds/socks.md b/docs/en/config/inbounds/socks.md index 77b7e599..c4aecab9 100644 --- a/docs/en/config/inbounds/socks.md +++ b/docs/en/config/inbounds/socks.md @@ -12,16 +12,24 @@ A more meaningful usage of `Socks` inbound is to listen within a LAN or on the l ```json { - "auth": "noauth", - "users": [ + "inbounds": [ { - "user": "my-username", - "pass": "my-password" + // ... + "settings": { + // [!code focus:10] + "auth": "noauth", + "users": [ + { + "user": "my-username", + "pass": "my-password" + } + ], + "udp": false, + "ip": "127.0.0.1", + "userLevel": 0 + } } - ], - "udp": false, - "ip": "127.0.0.1", - "userLevel": 0 + ] } ``` diff --git a/docs/en/config/inbounds/trojan.md b/docs/en/config/inbounds/trojan.md index 76a9238e..ca80a04c 100644 --- a/docs/en/config/inbounds/trojan.md +++ b/docs/en/config/inbounds/trojan.md @@ -10,16 +10,24 @@ Trojan is designed to work over correctly configured encrypted TLS tunnels. ```json { - "users": [ + "inbounds": [ { - "password": "password", - "email": "love@xray.com", - "level": 0 - } - ], - "fallbacks": [ - { - "dest": 80 + // ... + "settings": { + // [!code focus:12] + "users": [ + { + "password": "password", + "email": "love@xray.com", + "level": 0 + } + ], + "fallbacks": [ + { + "dest": 80 + } + ] + } } ] } diff --git a/docs/en/config/inbounds/tun.md b/docs/en/config/inbounds/tun.md index 6f0e89f8..ad91d048 100644 --- a/docs/en/config/inbounds/tun.md +++ b/docs/en/config/inbounds/tun.md @@ -6,13 +6,21 @@ Creates a TUN interface; traffic sent to this interface will be processed by Xra ```json { - "name": "xray0", - "mtu": 1500, - "gateway": ["10.0.0.1/16", "fc00::1/64"], - "dns": ["1.1.1.1", "8.8.8.8"], - "userLevel": 0, - "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"], - "autoOutboundsInterface": "auto" + "inbounds": [ + { + // ... + "settings": { + // [!code focus:7] + "name": "xray0", + "mtu": 1500, + "gateway": ["10.0.0.1/16", "fc00::1/64"], + "dns": ["1.1.1.1", "8.8.8.8"], + "userLevel": 0, + "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"], + "autoOutboundsInterface": "auto" + } + } + ] } ``` diff --git a/docs/en/config/inbounds/tunnel.md b/docs/en/config/inbounds/tunnel.md index 3a674a84..3544de0e 100644 --- a/docs/en/config/inbounds/tunnel.md +++ b/docs/en/config/inbounds/tunnel.md @@ -6,16 +6,24 @@ Tunnel, formerly known as dokodemo-door (Arbitrary Door), can listen on multiple ```json { - "allowedNetwork": "tcp", - "rewriteAddress": "8.8.8.8", - "rewritePort": 53, - "portMap": { - "5555": "1.1.1.1:7777", - "5556": ":8888", // overrides port only - "5557": "example.com:" // overrides address only - }, - "followRedirect": false, - "userLevel": 0 + "inbounds": [ + { + // ... + "settings": { + // [!code focus:10] + "allowedNetwork": "tcp", + "rewriteAddress": "8.8.8.8", + "rewritePort": 53, + "portMap": { + "5555": "1.1.1.1:7777", + "5556": ":8888", // overrides port only + "5557": "example.com:" // overrides address only + }, + "followRedirect": false, + "userLevel": 0 + } + } + ] } ``` diff --git a/docs/en/config/inbounds/vless.md b/docs/en/config/inbounds/vless.md index 1fa53052..549372d6 100644 --- a/docs/en/config/inbounds/vless.md +++ b/docs/en/config/inbounds/vless.md @@ -8,19 +8,27 @@ Unlike [VMess](./vmess.md), VLESS does not depend on system time. The authentica ```json { - "users": [ + "inbounds": [ { - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com", - "flow": "xtls-rprx-vision", - "reverse": {} - } - ], - "decryption": "none", - "fallbacks": [ - { - "dest": 80 + // ... + "settings": { + // [!code focus:15] + "users": [ + { + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com", + "flow": "xtls-rprx-vision", + "reverse": {} + } + ], + "decryption": "none", + "fallbacks": [ + { + "dest": 80 + } + ] + } } ] } diff --git a/docs/en/config/inbounds/vmess.md b/docs/en/config/inbounds/vmess.md index 93153767..133d5d18 100644 --- a/docs/en/config/inbounds/vmess.md +++ b/docs/en/config/inbounds/vmess.md @@ -10,16 +10,24 @@ VMess depends on system time. Please ensure that the system UTC time of the devi ```json { - "users": [ + "inbounds": [ { - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com" + // ... + "settings": { + // [!code focus:10] + "users": [ + { + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com" + } + ], + "default": { + "level": 0 + } + } } - ], - "default": { - "level": 0 - } + ] } ``` diff --git a/docs/en/config/inbounds/wireguard.md b/docs/en/config/inbounds/wireguard.md index 92330eb4..3f72bf86 100644 --- a/docs/en/config/inbounds/wireguard.md +++ b/docs/en/config/inbounds/wireguard.md @@ -10,14 +10,22 @@ User-space WireGuard protocol implementation. ```json { - "secretKey": "PRIVATE_KEY", - "peers": [ + "inbounds": [ { - "publicKey": "PUBLIC_KEY", - "allowedIPs": [""] + // ... + "settings": { + // [!code focus:8] + "secretKey": "PRIVATE_KEY", + "peers": [ + { + "publicKey": "PUBLIC_KEY", + "allowedIPs": [""] + } + ], + "mtu": 1420 // optional, default 1420 + } } - ], - "mtu": 1420 // optional, default 1420 + ] } ``` diff --git a/docs/en/config/outbounds/blackhole.md b/docs/en/config/outbounds/blackhole.md index 15a73ba8..7e2c291e 100644 --- a/docs/en/config/outbounds/blackhole.md +++ b/docs/en/config/outbounds/blackhole.md @@ -6,9 +6,17 @@ Blackhole is an outbound data protocol that blocks all outbound data. When used ```json { - "response": { - "type": "none" - } + "outbounds": [ + { + // ... + "settings": { + // [!code focus:3] + "response": { + "type": "none" + } + } + } + ] } ``` diff --git a/docs/en/config/outbounds/dns.md b/docs/en/config/outbounds/dns.md index 32ecd13d..b4dc65f5 100644 --- a/docs/en/config/outbounds/dns.md +++ b/docs/en/config/outbounds/dns.md @@ -10,19 +10,27 @@ It can allow queries to the target DNS server, `hijack` them to the built-in [DN ```json { - "rewriteNetwork": "udp", - "rewriteAddress": "1.1.1.1", - "rewritePort": 53, - "userLevel": 0, - "rules": [ + "outbounds": [ { - "action": "reject", - "domain": ["domain:example.com"] - }, - { - "action": "direct", - "qtype": 65, - "domain": ["geosite:geolocation-!cn"] + // ... + "settings": { + // [!code focus:15] + "rewriteNetwork": "udp", + "rewriteAddress": "1.1.1.1", + "rewritePort": 53, + "userLevel": 0, + "rules": [ + { + "action": "reject", + "domain": ["domain:example.com"] + }, + { + "action": "direct", + "qtype": 65, + "domain": ["geosite:geolocation-!cn"] + } + ] + } } ] } diff --git a/docs/en/config/outbounds/freedom.md b/docs/en/config/outbounds/freedom.md index d1bf7c48..c05043fc 100644 --- a/docs/en/config/outbounds/freedom.md +++ b/docs/en/config/outbounds/freedom.md @@ -1,4 +1,4 @@ -# Freedom (fragment, noises) +# Freedom (fragment, noises) Freedom is an outbound protocol used to send (normal) TCP or UDP data to any network. @@ -10,31 +10,39 @@ This outbound has a default safety policy in server-side and reverse-proxy scena ```json { - "domainStrategy": "AsIs", - "redirect": "127.0.0.1:3366", - "userLevel": 0, - "fragment": { - "packets": "tlshello", - "length": "100-200", - "interval": "10-20" // Unit: ms - }, - "noises": [ + "outbounds": [ { - "type": "base64", - "packet": "7nQBAAABAAAAAAAABnQtcmluZwZtc2VkZ2UDbmV0AAABAAE=", - "delay": "10-16" - } - ], - "proxyProtocol": 0, - "finalRules": [ - { - "action": "block", - "network": "tcp", - "port": "22,25,465,587" - }, - { - "action": "block", - "ip": ["geoip:cn"] + // ... + "settings": { + // [!code focus:27] + "domainStrategy": "AsIs", + "redirect": "127.0.0.1:3366", + "userLevel": 0, + "fragment": { + "packets": "tlshello", + "length": "100-200", + "interval": "10-20" // Unit: ms + }, + "noises": [ + { + "type": "base64", + "packet": "7nQBAAABAAAAAAAABnQtcmluZwZtc2VkZ2UDbmV0AAABAAE=", + "delay": "10-16" + } + ], + "proxyProtocol": 0, + "finalRules": [ + { + "action": "block", + "network": "tcp", + "port": "22,25,465,587" + }, + { + "action": "block", + "ip": ["geoip:cn"] + } + ] + } } ] } diff --git a/docs/en/config/outbounds/http.md b/docs/en/config/outbounds/http.md index 9c6cb10a..0e7674c2 100644 --- a/docs/en/config/outbounds/http.md +++ b/docs/en/config/outbounds/http.md @@ -14,16 +14,24 @@ HTTP protocol. ```json { - "address": "192.168.108.1", - "port": 3128, - "user": "my-username", - "pass": "my-password", - "level": 0, - "email": "love@xray.com", - "headers": { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2" - } + "outbounds": [ + { + // ... + "settings": { + // [!code focus:10] + "address": "192.168.108.1", + "port": 3128, + "user": "my-username", + "pass": "my-password", + "level": 0, + "email": "love@xray.com", + "headers": { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", + "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2" + } + } + } + ] } ``` diff --git a/docs/en/config/outbounds/hysteria.md b/docs/en/config/outbounds/hysteria.md index bc4685e7..d8b6e323 100644 --- a/docs/en/config/outbounds/hysteria.md +++ b/docs/en/config/outbounds/hysteria.md @@ -12,9 +12,17 @@ The `hysteria protocol` itself has no authentication. When using with a non `hys ```json { - "version": 2, - "address": "192.168.108.1", - "port": 3128 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:3] + "version": 2, + "address": "192.168.108.1", + "port": 3128 + } + } + ] } ``` diff --git a/docs/en/config/outbounds/loopback.md b/docs/en/config/outbounds/loopback.md index 792d2130..8631476e 100644 --- a/docs/en/config/outbounds/loopback.md +++ b/docs/en/config/outbounds/loopback.md @@ -6,7 +6,15 @@ Loopback is an outbound data protocol. Its function is to re-inject data sent th ```json { - "inboundTag": "TagUseAsInbound" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:1] + "inboundTag": "TagUseAsInbound" + } + } + ] } ``` diff --git a/docs/en/config/outbounds/shadowsocks.md b/docs/en/config/outbounds/shadowsocks.md index 8c83e1df..f3bb3e61 100644 --- a/docs/en/config/outbounds/shadowsocks.md +++ b/docs/en/config/outbounds/shadowsocks.md @@ -31,14 +31,22 @@ Under the "none" encryption method, traffic will be transmitted in plain text. T ```json { - "email": "love@xray.com", - "address": "127.0.0.1", - "port": 1234, - "method": "Encryption Method", - "password": "Password", - "uot": true, - "UoTVersion": 2, - "level": 0 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:8] + "email": "love@xray.com", + "address": "127.0.0.1", + "port": 1234, + "method": "Encryption Method", + "password": "Password", + "uot": true, + "UoTVersion": 2, + "level": 0 + } + } + ] } ``` diff --git a/docs/en/config/outbounds/socks.md b/docs/en/config/outbounds/socks.md index 2e502eb4..98a1bb95 100644 --- a/docs/en/config/outbounds/socks.md +++ b/docs/en/config/outbounds/socks.md @@ -10,12 +10,20 @@ Standard Socks protocol implementation, compatible with Socks 5. ```json { - "address": "127.0.0.1", - "port": 1234, - "user": "test user", - "pass": "test pass", - "level": 0, - "email": "love@xray.com" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:6] + "address": "127.0.0.1", + "port": 1234, + "user": "test user", + "pass": "test pass", + "level": 0, + "email": "love@xray.com" + } + } + ] } ``` diff --git a/docs/en/config/outbounds/trojan.md b/docs/en/config/outbounds/trojan.md index 26df4c84..e147691b 100644 --- a/docs/en/config/outbounds/trojan.md +++ b/docs/en/config/outbounds/trojan.md @@ -10,11 +10,19 @@ Trojan is designed to work over a correctly configured encrypted TLS tunnel. ```json { - "address": "127.0.0.1", - "port": 1234, - "password": "password", - "email": "love@xray.com", - "level": 0 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:5] + "address": "127.0.0.1", + "port": 1234, + "password": "password", + "email": "love@xray.com", + "level": 0 + } + } + ] } ``` diff --git a/docs/en/config/outbounds/vless.md b/docs/en/config/outbounds/vless.md index e18a7612..c01175ac 100644 --- a/docs/en/config/outbounds/vless.md +++ b/docs/en/config/outbounds/vless.md @@ -8,13 +8,21 @@ Unlike [VMess](./vmess.md), VLESS does not depend on system time. The authentica ```json { - "address": "example.com", - "port": 443, - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "encryption": "none", - "flow": "xtls-rprx-vision", - "level": 0, - "reverse": {} + "outbounds": [ + { + // ... + "settings": { + // [!code focus:7] + "address": "example.com", + "port": 443, + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "encryption": "none", + "flow": "xtls-rprx-vision", + "level": 0, + "reverse": {} + } + } + ] } ``` diff --git a/docs/en/config/outbounds/vmess.md b/docs/en/config/outbounds/vmess.md index 3eab92b3..e578dceb 100644 --- a/docs/en/config/outbounds/vmess.md +++ b/docs/en/config/outbounds/vmess.md @@ -10,12 +10,20 @@ VMess depends on system time. Please ensure that the UTC time of the system runn ```json { - "address": "127.0.0.1", - "port": 37192, - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "security": "auto", - "level": 0, - "experiments": "" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:6] + "address": "127.0.0.1", + "port": 37192, + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "security": "auto", + "level": 0, + "experiments": "" + } + } + ] } ``` diff --git a/docs/en/config/outbounds/wireguard.md b/docs/en/config/outbounds/wireguard.md index db0416ec..fa403309 100644 --- a/docs/en/config/outbounds/wireguard.md +++ b/docs/en/config/outbounds/wireguard.md @@ -10,24 +10,32 @@ Standard Wireguard protocol implementation. ```json { - "secretKey": "PRIVATE_KEY", - "address": [ - // optional, default ["10.0.0.1", "fd59:7153:2388:b5fd:0000:0000:0000:0001"] - "IPv4_CIDR", - "IPv6_CIDR", - "and more..." - ], - "peers": [ + "outbounds": [ { - "endpoint": "ENDPOINT_ADDR", - "publicKey": "PUBLIC_KEY" + // ... + "settings": { + // [!code focus:18] + "secretKey": "PRIVATE_KEY", + "address": [ + // optional, default ["10.0.0.1", "fd59:7153:2388:b5fd:0000:0000:0000:0001"] + "IPv4_CIDR", + "IPv6_CIDR", + "and more..." + ], + "peers": [ + { + "endpoint": "ENDPOINT_ADDR", + "publicKey": "PUBLIC_KEY" + } + ], + "noKernelTun": false, + "mtu": 1420, // optional, default 1420 + "reserved": [1, 2, 3], + "workers": 2, // optional, default runtime.NumCPU() + "domainStrategy": "ForceIP" + } } - ], - "noKernelTun": false, - "mtu": 1420, // optional, default 1420 - "reserved": [1, 2, 3], - "workers": 2, // optional, default runtime.NumCPU() - "domainStrategy": "ForceIP" + ] } ``` diff --git a/docs/en/config/transport.md b/docs/en/config/transport.md index 89da3fbf..7c295b1c 100644 --- a/docs/en/config/transport.md +++ b/docs/en/config/transport.md @@ -10,40 +10,49 @@ Transport specifies a stable method for data transmission. Generally, both ends ```json { - "network": "raw", - "security": "none", - "tlsSettings": {}, - "realitySettings": {}, - "rawSettings": {}, - "xhttpSettings": {}, - "kcpSettings": {}, - "grpcSettings": {}, - "wsSettings": {}, - "httpupgradeSettings": {}, - "hysteriaSettings": {}, - "finalmask": { - "tcp": [], - "udp": [], - "quicParams": {} - }, - "sockopt": { - "mark": 0, - "tcpMaxSeg": 1440, - "tcpFastOpen": false, - "tproxy": "off", - "domainStrategy": "AsIs", - "happyEyeballs": {}, - "dialerProxy": "", - "acceptProxyProtocol": false, - "tcpKeepAliveInterval": 0, - "tcpKeepAliveIdle": 300, - "tcpUserTimeout": 10000, - "tcpCongestion": "bbr", - "interface": "wg0", - "v6only": false, - "tcpWindowClamp": 600, - "tcpMptcp": false - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + // [!code focus:34] + "network": "raw", + "security": "none", + "tlsSettings": {}, + "realitySettings": {}, + "rawSettings": {}, + "xhttpSettings": {}, + "kcpSettings": {}, + "grpcSettings": {}, + "wsSettings": {}, + "httpupgradeSettings": {}, + "hysteriaSettings": {}, + "finalmask": { + "tcp": [], + "udp": [], + "quicParams": {} + }, + "sockopt": { + "mark": 0, + "tcpMaxSeg": 1440, + "tcpFastOpen": false, + "tproxy": "off", + "domainStrategy": "AsIs", + "happyEyeballs": {}, + "dialerProxy": "", + "acceptProxyProtocol": false, + "tcpKeepAliveInterval": 0, + "tcpKeepAliveIdle": 300, + "tcpUserTimeout": 10000, + "tcpCongestion": "bbr", + "interface": "wg0", + "v6only": false, + "tcpWindowClamp": 600, + "tcpMptcp": false + } + } + } + ] } ``` diff --git a/docs/en/config/transports/grpc.md b/docs/en/config/transports/grpc.md index e982f5e4..25d2a88c 100644 --- a/docs/en/config/transports/grpc.md +++ b/docs/en/config/transports/grpc.md @@ -39,14 +39,26 @@ If you are using fallback, please note the following: ```json { - "authority": "grpc.example.com", - "serviceName": "name", - "multiMode": false, - "user_agent": "custom user agent", - "idle_timeout": 60, - "health_check_timeout": 20, - "permit_without_stream": false, - "initial_windows_size": 0 + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "grpc", + "grpcSettings": { + // [!code focus:8] + "authority": "grpc.example.com", + "serviceName": "name", + "multiMode": false, + "user_agent": "custom user agent", + "idle_timeout": 60, + "health_check_timeout": 20, + "permit_without_stream": false, + "initial_windows_size": 0 + } + } + } + ] } ``` diff --git a/docs/en/config/transports/httpupgrade.md b/docs/en/config/transports/httpupgrade.md index b3dba5e7..a4930365 100644 --- a/docs/en/config/transports/httpupgrade.md +++ b/docs/en/config/transports/httpupgrade.md @@ -13,12 +13,24 @@ Its design is not recommended for standalone use; instead, it is intended to wor ```json { - "acceptProxyProtocol": false, - "path": "/", - "host": "xray.com", - "headers": { - "key": "value" - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "httpupgrade", + "httpupgradeSettings": { + // [!code focus:6] + "acceptProxyProtocol": false, + "path": "/", + "host": "xray.com", + "headers": { + "key": "value" + } + } + } + } + ] } ``` diff --git a/docs/en/config/transports/hysteria.md b/docs/en/config/transports/hysteria.md index 6adf1e46..5b4c10fe 100644 --- a/docs/en/config/transports/hysteria.md +++ b/docs/en/config/transports/hysteria.md @@ -8,24 +8,33 @@ Xray implementation of the underlying QUIC transport for Hysteria2, typically us ```json { - "version": 2, - "auth": "password", - "udpIdleTimeout": 60, - "masquerade": { - "type": "", - - "dir": "", - - "url": "", - "rewriteHost": false, - "insecure": false, - - "content": "", - "headers": { - "key": "value" - }, - "statusCode": 0 - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "hysteria", + "hysteriaSettings": { + // [!code focus:15] + "version": 2, + "auth": "password", + "udpIdleTimeout": 60, + "masquerade": { + "type": "", + "dir": "", + "url": "", + "rewriteHost": false, + "insecure": false, + "content": "", + "headers": { + "key": "value" + }, + "statusCode": 0 + } + } + } + } + ] } ``` diff --git a/docs/en/config/transports/mkcp.md b/docs/en/config/transports/mkcp.md index 51a8b732..4c43e5bc 100644 --- a/docs/en/config/transports/mkcp.md +++ b/docs/en/config/transports/mkcp.md @@ -14,13 +14,25 @@ Please ensure that the firewall configuration on the host is correct. ```json { - "mtu": 1350, - "tti": 20, - "uplinkCapacity": 5, - "downlinkCapacity": 20, - "congestion": false, - "readBufferSize": 1, - "writeBufferSize": 1 + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "mkcp", + "kcpSettings": { + // [!code focus:7] + "mtu": 1350, + "tti": 20, + "uplinkCapacity": 5, + "downlinkCapacity": 20, + "congestion": false, + "readBufferSize": 1, + "writeBufferSize": 1 + } + } + } + ] } ``` diff --git a/docs/en/config/transports/raw.md b/docs/en/config/transports/raw.md index 32cf8590..f1963f96 100644 --- a/docs/en/config/transports/raw.md +++ b/docs/en/config/transports/raw.md @@ -10,10 +10,22 @@ It can be combined with various protocols in multiple modes. ```json { - "acceptProxyProtocol": false, - "header": { - "type": "none" - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "raw", + "rawSettings": { + // [!code focus:4] + "acceptProxyProtocol": false, + "header": { + "type": "none" + } + } + } + } + ] } ``` diff --git a/docs/en/config/transports/websocket.md b/docs/en/config/transports/websocket.md index c9830bfa..25d65b28 100644 --- a/docs/en/config/transports/websocket.md +++ b/docs/en/config/transports/websocket.md @@ -18,13 +18,25 @@ WebSocket will recognize the `X-Forwarded-For` header in HTTP requests to overwr ```json { - "acceptProxyProtocol": false, - "path": "/", - "host": "xray.com", - "headers": { - "key": "value" - }, - "heartbeatPeriod": 10 + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "websocket", + "wsSettings": { + // [!code focus:7] + "acceptProxyProtocol": false, + "path": "/", + "host": "xray.com", + "headers": { + "key": "value" + }, + "heartbeatPeriod": 10 + } + } + } + ] } ``` diff --git a/docs/ru/config/inbounds/http.md b/docs/ru/config/inbounds/http.md index a9ddd2f6..5d336e19 100644 --- a/docs/ru/config/inbounds/http.md +++ b/docs/ru/config/inbounds/http.md @@ -23,14 +23,22 @@ ```json { - "users": [ + "inbounds": [ { - "user": "my-username", - "pass": "my-password" + // ... + "settings": { + // [!code focus:8] + "users": [ + { + "user": "my-username", + "pass": "my-password" + } + ], + "allowTransparent": false, + "userLevel": 0 + } } - ], - "allowTransparent": false, - "userLevel": 0 + ] } ``` diff --git a/docs/ru/config/inbounds/hysteria.md b/docs/ru/config/inbounds/hysteria.md index d73cee95..d3310c45 100644 --- a/docs/ru/config/inbounds/hysteria.md +++ b/docs/ru/config/inbounds/hysteria.md @@ -8,12 +8,20 @@ ```json { - "version": 2, - "users": [ + "inbounds": [ { - "auth": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com" + // ... + "settings": { + // [!code focus:8] + "version": 2, + "users": [ + { + "auth": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com" + } + ] + } } ] } diff --git a/docs/ru/config/inbounds/shadowsocks.md b/docs/ru/config/inbounds/shadowsocks.md index 14998f1b..fad67199 100644 --- a/docs/ru/config/inbounds/shadowsocks.md +++ b/docs/ru/config/inbounds/shadowsocks.md @@ -31,19 +31,25 @@ ```json { - "settings": { - "network": "tcp,udp", - "method": "aes-256-gcm", - "password": "114514", - "level": 0, - "email": "love@xray.com", - "users": [ - { - "password": "1919810", - "method": "aes-128-gcm" + "inbounds": [ + { + // ... + "settings": { + // [!code focus:11] + "network": "tcp,udp", + "method": "aes-256-gcm", + "password": "114514", + "level": 0, + "email": "love@xray.com", + "users": [ + { + "password": "1919810", + "method": "aes-128-gcm" + } + ] } - ] - } + } + ] } ``` diff --git a/docs/ru/config/inbounds/socks.md b/docs/ru/config/inbounds/socks.md index 7a222868..c127e5e9 100644 --- a/docs/ru/config/inbounds/socks.md +++ b/docs/ru/config/inbounds/socks.md @@ -12,16 +12,24 @@ ```json { - "auth": "noauth", - "users": [ + "inbounds": [ { - "user": "my-username", - "pass": "my-password" + // ... + "settings": { + // [!code focus:10] + "auth": "noauth", + "users": [ + { + "user": "my-username", + "pass": "my-password" + } + ], + "udp": false, + "ip": "127.0.0.1", + "userLevel": 0 + } } - ], - "udp": false, - "ip": "127.0.0.1", - "userLevel": 0 + ] } ``` diff --git a/docs/ru/config/inbounds/trojan.md b/docs/ru/config/inbounds/trojan.md index 8084e9c3..74db6eab 100644 --- a/docs/ru/config/inbounds/trojan.md +++ b/docs/ru/config/inbounds/trojan.md @@ -10,16 +10,24 @@ Trojan предназначен для работы в правильно нас ```json { - "users": [ + "inbounds": [ { - "password": "password", - "email": "love@xray.com", - "level": 0 - } - ], - "fallbacks": [ - { - "dest": 80 + // ... + "settings": { + // [!code focus:12] + "users": [ + { + "password": "password", + "email": "love@xray.com", + "level": 0 + } + ], + "fallbacks": [ + { + "dest": 80 + } + ] + } } ] } diff --git a/docs/ru/config/inbounds/tun.md b/docs/ru/config/inbounds/tun.md index e28c214a..04e5d9c8 100644 --- a/docs/ru/config/inbounds/tun.md +++ b/docs/ru/config/inbounds/tun.md @@ -6,13 +6,21 @@ ```json { - "name": "xray0", - "mtu": 1500, - "gateway": ["10.0.0.1/16", "fc00::1/64"], - "dns": ["1.1.1.1", "8.8.8.8"], - "userLevel": 0, - "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"], - "autoOutboundsInterface": "auto" + "inbounds": [ + { + // ... + "settings": { + // [!code focus:7] + "name": "xray0", + "mtu": 1500, + "gateway": ["10.0.0.1/16", "fc00::1/64"], + "dns": ["1.1.1.1", "8.8.8.8"], + "userLevel": 0, + "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"], + "autoOutboundsInterface": "auto" + } + } + ] } ``` diff --git a/docs/ru/config/inbounds/tunnel.md b/docs/ru/config/inbounds/tunnel.md index 61628447..27e5fe07 100644 --- a/docs/ru/config/inbounds/tunnel.md +++ b/docs/ru/config/inbounds/tunnel.md @@ -6,16 +6,24 @@ ```json { - "allowedNetwork": "tcp", - "rewriteAddress": "8.8.8.8", - "rewritePort": 53, - "portMap": { - "5555": "1.1.1.1:7777", - "5556": ":8888", // overrides port only - "5557": "example.com:" // overrides address only - }, - "followRedirect": false, - "userLevel": 0 + "inbounds": [ + { + // ... + "settings": { + // [!code focus:10] + "allowedNetwork": "tcp", + "rewriteAddress": "8.8.8.8", + "rewritePort": 53, + "portMap": { + "5555": "1.1.1.1:7777", + "5556": ":8888", // overrides port only + "5557": "example.com:" // overrides address only + }, + "followRedirect": false, + "userLevel": 0 + } + } + ] } ``` diff --git a/docs/ru/config/inbounds/vless.md b/docs/ru/config/inbounds/vless.md index 93ec4b7e..b6a22d12 100644 --- a/docs/ru/config/inbounds/vless.md +++ b/docs/ru/config/inbounds/vless.md @@ -8,20 +8,28 @@ VLESS - это легкий транспортный протокол без с ```json { - "flow": "xtls-rprx-vision", - "users": [ + "inbounds": [ { - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com", - "flow": "xtls-rprx-vision", - "reverse": {} - } - ], - "decryption": "none", - "fallbacks": [ - { - "dest": 80 + // ... + "settings": { + // [!code focus:15] + "flow": "xtls-rprx-vision", + "users": [ + { + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com", + "flow": "xtls-rprx-vision", + "reverse": {} + } + ], + "decryption": "none", + "fallbacks": [ + { + "dest": 80 + } + ] + } } ] } diff --git a/docs/ru/config/inbounds/vmess.md b/docs/ru/config/inbounds/vmess.md index f007bb78..ceb6302e 100644 --- a/docs/ru/config/inbounds/vmess.md +++ b/docs/ru/config/inbounds/vmess.md @@ -10,16 +10,24 @@ VMess полагается на системное время. Убедитес ```json { - "users": [ + "inbounds": [ { - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "level": 0, - "email": "love@xray.com" + // ... + "settings": { + // [!code focus:10] + "users": [ + { + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "level": 0, + "email": "love@xray.com" + } + ], + "default": { + "level": 0 + } + } } - ], - "default": { - "level": 0 - } + ] } ``` diff --git a/docs/ru/config/inbounds/wireguard.md b/docs/ru/config/inbounds/wireguard.md index eb5de7d8..94b50d35 100644 --- a/docs/ru/config/inbounds/wireguard.md +++ b/docs/ru/config/inbounds/wireguard.md @@ -10,14 +10,22 @@ ```json { - "secretKey": "PRIVATE_KEY", - "peers": [ + "inbounds": [ { - "publicKey": "PUBLIC_KEY", - "allowedIPs": [""] + // ... + "settings": { + // [!code focus:8] + "secretKey": "PRIVATE_KEY", + "peers": [ + { + "publicKey": "PUBLIC_KEY", + "allowedIPs": [""] + } + ], + "mtu": 1420 // необязательно, по умолчанию 1420 + } } - ], - "mtu": 1420 // необязательно, по умолчанию 1420 + ] } ``` diff --git a/docs/ru/config/outbounds/blackhole.md b/docs/ru/config/outbounds/blackhole.md index 3f3c8071..696bb2a9 100644 --- a/docs/ru/config/outbounds/blackhole.md +++ b/docs/ru/config/outbounds/blackhole.md @@ -6,9 +6,17 @@ Blackhole - это протокол исходящих данных, котор ```json { - "response": { - "type": "none" - } + "outbounds": [ + { + // ... + "settings": { + // [!code focus:3] + "response": { + "type": "none" + } + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/dns.md b/docs/ru/config/outbounds/dns.md index 94618942..c44b84aa 100644 --- a/docs/ru/config/outbounds/dns.md +++ b/docs/ru/config/outbounds/dns.md @@ -10,19 +10,27 @@ DNS — это исходящий протокол, который приним ```json { - "rewriteNetwork": "udp", - "rewriteAddress": "1.1.1.1", - "rewritePort": 53, - "userLevel": 0, - "rules": [ + "outbounds": [ { - "action": "reject", - "domain": ["domain:example.com"] - }, - { - "action": "direct", - "qtype": 65, - "domain": ["geosite:geolocation-!cn"] + // ... + "settings": { + // [!code focus:15] + "rewriteNetwork": "udp", + "rewriteAddress": "1.1.1.1", + "rewritePort": 53, + "userLevel": 0, + "rules": [ + { + "action": "reject", + "domain": ["domain:example.com"] + }, + { + "action": "direct", + "qtype": 65, + "domain": ["geosite:geolocation-!cn"] + } + ] + } } ] } diff --git a/docs/ru/config/outbounds/freedom.md b/docs/ru/config/outbounds/freedom.md index 2afc99af..a10d89bc 100644 --- a/docs/ru/config/outbounds/freedom.md +++ b/docs/ru/config/outbounds/freedom.md @@ -1,4 +1,4 @@ -# Freedom (fragment, noises) +# Freedom (fragment, noises) Freedom — это исходящий протокол, который можно использовать для отправки (обычных) данных TCP или UDP в любую сеть. @@ -10,31 +10,39 @@ Freedom — это исходящий протокол, который можн ```json { - "domainStrategy": "AsIs", - "redirect": "127.0.0.1:3366", - "userLevel": 0, - "fragment": { - "packets": "tlshello", - "length": "100-200", - "interval": "10-20" // единица измерения: мс - }, - "noises": [ + "outbounds": [ { - "type": "base64", - "packet": "7nQBAAABAAAAAAAABnQtcmluZwZtc2VkZ2UDbmV0AAABAAE=", - "delay": "10-16" - } - ], - "proxyProtocol": 0, - "finalRules": [ - { - "action": "block", - "network": "tcp", - "port": "22,25,465,587" - }, - { - "action": "block", - "ip": ["geoip:cn"] + // ... + "settings": { + // [!code focus:27] + "domainStrategy": "AsIs", + "redirect": "127.0.0.1:3366", + "userLevel": 0, + "fragment": { + "packets": "tlshello", + "length": "100-200", + "interval": "10-20" // единица измерения: мс + }, + "noises": [ + { + "type": "base64", + "packet": "7nQBAAABAAAAAAAABnQtcmluZwZtc2VkZ2UDbmV0AAABAAE=", + "delay": "10-16" + } + ], + "proxyProtocol": 0, + "finalRules": [ + { + "action": "block", + "network": "tcp", + "port": "22,25,465,587" + }, + { + "action": "block", + "ip": ["geoip:cn"] + } + ] + } } ] } diff --git a/docs/ru/config/outbounds/http.md b/docs/ru/config/outbounds/http.md index eebe54c1..51b1877a 100644 --- a/docs/ru/config/outbounds/http.md +++ b/docs/ru/config/outbounds/http.md @@ -14,16 +14,24 @@ ```json { - "address": "192.168.108.1", - "port": 3128, - "user": "my-username", - "pass": "my-password", - "level": 0, - "email": "love@xray.com", - "headers": { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2" - } + "outbounds": [ + { + // ... + "settings": { + // [!code focus:10] + "address": "192.168.108.1", + "port": 3128, + "user": "my-username", + "pass": "my-password", + "level": 0, + "email": "love@xray.com", + "headers": { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", + "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2" + } + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/hysteria.md b/docs/ru/config/outbounds/hysteria.md index 92883107..c910e40d 100644 --- a/docs/ru/config/outbounds/hysteria.md +++ b/docs/ru/config/outbounds/hysteria.md @@ -12,9 +12,17 @@ ```json { - "version": 2, - "address": "192.168.108.1", - "port": 3128 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:3] + "version": 2, + "address": "192.168.108.1", + "port": 3128 + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/loopback.md b/docs/ru/config/outbounds/loopback.md index 3c0d29ec..fa09d7af 100644 --- a/docs/ru/config/outbounds/loopback.md +++ b/docs/ru/config/outbounds/loopback.md @@ -6,7 +6,15 @@ Loopback - это исходящий протокол данных, которы ```json { - "inboundTag": "TagUseAsInbound" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:1] + "inboundTag": "TagUseAsInbound" + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/shadowsocks.md b/docs/ru/config/outbounds/shadowsocks.md index 6edfaf9f..6b7bb5d0 100644 --- a/docs/ru/config/outbounds/shadowsocks.md +++ b/docs/ru/config/outbounds/shadowsocks.md @@ -31,14 +31,22 @@ ```json { - "email": "love@xray.com", - "address": "127.0.0.1", - "port": 1234, - "method": "метод_шифрования", - "password": "пароль", - "uot": true, - "UoTVersion": 2, - "level": 0 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:8] + "email": "love@xray.com", + "address": "127.0.0.1", + "port": 1234, + "method": "метод_шифрования", + "password": "пароль", + "uot": true, + "UoTVersion": 2, + "level": 0 + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/socks.md b/docs/ru/config/outbounds/socks.md index 7fcbd7d8..25dab2e0 100644 --- a/docs/ru/config/outbounds/socks.md +++ b/docs/ru/config/outbounds/socks.md @@ -10,12 +10,20 @@ ```json { - "address": "127.0.0.1", - "port": 1234, - "user": "test user", - "pass": "test pass", - "level": 0, - "email": "love@xray.com" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:6] + "address": "127.0.0.1", + "port": 1234, + "user": "test user", + "pass": "test pass", + "level": 0, + "email": "love@xray.com" + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/trojan.md b/docs/ru/config/outbounds/trojan.md index bb291a4f..eae34d11 100644 --- a/docs/ru/config/outbounds/trojan.md +++ b/docs/ru/config/outbounds/trojan.md @@ -10,11 +10,19 @@ Trojan предназначен для работы в правильно нас ```json { - "address": "127.0.0.1", - "port": 1234, - "password": "password", - "email": "love@xray.com", - "level": 0 + "outbounds": [ + { + // ... + "settings": { + // [!code focus:5] + "address": "127.0.0.1", + "port": 1234, + "password": "password", + "email": "love@xray.com", + "level": 0 + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/vless.md b/docs/ru/config/outbounds/vless.md index 35248fa9..f0b3e0a0 100644 --- a/docs/ru/config/outbounds/vless.md +++ b/docs/ru/config/outbounds/vless.md @@ -8,13 +8,21 @@ VLESS - это легкий транспортный протокол без с ```json { - "address": "example.com", - "port": 443, - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "encryption": "none", - "flow": "xtls-rprx-vision", - "level": 0, - "reverse": {} + "outbounds": [ + { + // ... + "settings": { + // [!code focus:7] + "address": "example.com", + "port": 443, + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "encryption": "none", + "flow": "xtls-rprx-vision", + "level": 0, + "reverse": {} + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/vmess.md b/docs/ru/config/outbounds/vmess.md index 6de0dc4a..439e4def 100644 --- a/docs/ru/config/outbounds/vmess.md +++ b/docs/ru/config/outbounds/vmess.md @@ -10,10 +10,18 @@ VMess полагается на системное время. Убедитес ```json { - "id": "5783a3e7-e373-51cd-8642-c83782b807c5", - "security": "auto", - "level": 0, - "experiments": "" + "outbounds": [ + { + // ... + "settings": { + // [!code focus:6] + "id": "5783a3e7-e373-51cd-8642-c83782b807c5", + "security": "auto", + "level": 0, + "experiments": "" + } + } + ] } ``` diff --git a/docs/ru/config/outbounds/wireguard.md b/docs/ru/config/outbounds/wireguard.md index 5a69eaae..0e0d2d9d 100644 --- a/docs/ru/config/outbounds/wireguard.md +++ b/docs/ru/config/outbounds/wireguard.md @@ -10,24 +10,32 @@ ```json { - "secretKey": "PRIVATE_KEY", - "address": [ - // необязательно, по умолчанию ["10.0.0.1", "fd59:7153:2388:b5fd:0000:0000:0000:0001"] - "IPv4_CIDR", - "IPv6_CIDR", - "and more..." - ], - "peers": [ + "outbounds": [ { - "endpoint": "ENDPOINT_ADDR", - "publicKey": "PUBLIC_KEY" + // ... + "settings": { + // [!code focus:18] + "secretKey": "PRIVATE_KEY", + "address": [ + // необязательно, по умолчанию ["10.0.0.1", "fd59:7153:2388:b5fd:0000:0000:0000:0001"] + "IPv4_CIDR", + "IPv6_CIDR", + "and more..." + ], + "peers": [ + { + "endpoint": "ENDPOINT_ADDR", + "publicKey": "PUBLIC_KEY" + } + ], + "noKernelTun": false, + "mtu": 1420, // необязательно, по умолчанию 1420 + "reserved": [1, 2, 3], + "workers": 2, // необязательно, по умолчанию runtime.NumCPU() + "domainStrategy": "ForceIP" + } } - ], - "noKernelTun": false, - "mtu": 1420, // необязательно, по умолчанию 1420 - "reserved": [1, 2, 3], - "workers": 2, // необязательно, по умолчанию runtime.NumCPU() - "domainStrategy": "ForceIP" + ] } ``` diff --git a/docs/ru/config/transport.md b/docs/ru/config/transport.md index 5701e811..6452c216 100644 --- a/docs/ru/config/transport.md +++ b/docs/ru/config/transport.md @@ -11,40 +11,49 @@ ```json { - "network": "raw", - "security": "none", - "tlsSettings": {}, - "realitySettings": {}, - "rawSettings": {}, - "xhttpSettings": {}, - "kcpSettings": {}, - "grpcSettings": {}, - "wsSettings": {}, - "httpupgradeSettings": {}, - "hysteriaSettings": {}, - "finalmask": { - "tcp": [], - "udp": [], - "quicParams": {} - }, - "sockopt": { - "mark": 0, - "tcpMaxSeg": 1440, - "tcpFastOpen": false, - "tproxy": "off", - "domainStrategy": "AsIs", - "happyEyeballs": {}, - "dialerProxy": "", - "acceptProxyProtocol": false, - "tcpKeepAliveInterval": 0, - "tcpKeepAliveIdle": 300, - "tcpUserTimeout": 10000, - "tcpCongestion": "bbr", - "interface": "wg0", - "v6only": false, - "tcpWindowClamp": 600, - "tcpMptcp": false - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + // [!code focus:34] + "network": "raw", + "security": "none", + "tlsSettings": {}, + "realitySettings": {}, + "rawSettings": {}, + "xhttpSettings": {}, + "kcpSettings": {}, + "grpcSettings": {}, + "wsSettings": {}, + "httpupgradeSettings": {}, + "hysteriaSettings": {}, + "finalmask": { + "tcp": [], + "udp": [], + "quicParams": {} + }, + "sockopt": { + "mark": 0, + "tcpMaxSeg": 1440, + "tcpFastOpen": false, + "tproxy": "off", + "domainStrategy": "AsIs", + "happyEyeballs": {}, + "dialerProxy": "", + "acceptProxyProtocol": false, + "tcpKeepAliveInterval": 0, + "tcpKeepAliveIdle": 300, + "tcpUserTimeout": 10000, + "tcpCongestion": "bbr", + "interface": "wg0", + "v6only": false, + "tcpWindowClamp": 600, + "tcpMptcp": false + } + } + } + ] } ``` diff --git a/docs/ru/config/transports/grpc.md b/docs/ru/config/transports/grpc.md index 7c458987..184d2db3 100644 --- a/docs/ru/config/transports/grpc.md +++ b/docs/ru/config/transports/grpc.md @@ -38,14 +38,26 @@ gRPC (HTTP/2) имеет встроенное мультиплексирован ```json { - "authority": "grpc.example.com", - "serviceName": "name", - "multiMode": false, - "user_agent": "custom user agent", - "idle_timeout": 60, - "health_check_timeout": 20, - "permit_without_stream": false, - "initial_windows_size": 0 + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "grpc", + "grpcSettings": { + // [!code focus:8] + "authority": "grpc.example.com", + "serviceName": "name", + "multiMode": false, + "user_agent": "custom user agent", + "idle_timeout": 60, + "health_check_timeout": 20, + "permit_without_stream": false, + "initial_windows_size": 0 + } + } + } + ] } ``` diff --git a/docs/ru/config/transports/httpupgrade.md b/docs/ru/config/transports/httpupgrade.md index 5b1ddca8..27839bea 100644 --- a/docs/ru/config/transports/httpupgrade.md +++ b/docs/ru/config/transports/httpupgrade.md @@ -14,12 +14,24 @@ ```json { - "acceptProxyProtocol": false, - "path": "/", - "host": "xray.com", - "headers": { - "key": "value" - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "httpupgrade", + "httpupgradeSettings": { + // [!code focus:6] + "acceptProxyProtocol": false, + "path": "/", + "host": "xray.com", + "headers": { + "key": "value" + } + } + } + } + ] } ``` diff --git a/docs/ru/config/transports/hysteria.md b/docs/ru/config/transports/hysteria.md index 8375c9e9..0e34d667 100644 --- a/docs/ru/config/transports/hysteria.md +++ b/docs/ru/config/transports/hysteria.md @@ -8,24 +8,33 @@ ```json { - "version": 2, - "auth": "password", - "udpIdleTimeout": 60, - "masquerade": { - "type": "", - - "dir": "", - - "url": "", - "rewriteHost": false, - "insecure": false, - - "content": "", - "headers": { - "key": "value" - }, - "statusCode": 0 - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "hysteria", + "hysteriaSettings": { + // [!code focus:15] + "version": 2, + "auth": "password", + "udpIdleTimeout": 60, + "masquerade": { + "type": "", + "dir": "", + "url": "", + "rewriteHost": false, + "insecure": false, + "content": "", + "headers": { + "key": "value" + }, + "statusCode": 0 + } + } + } + } + ] } ``` diff --git a/docs/ru/config/transports/mkcp.md b/docs/ru/config/transports/mkcp.md index ab4aa9fa..58f9a699 100644 --- a/docs/ru/config/transports/mkcp.md +++ b/docs/ru/config/transports/mkcp.md @@ -14,13 +14,25 @@ mKCP жертвует пропускной способностью ради у ```json { - "mtu": 1350, - "tti": 20, - "uplinkCapacity": 5, - "downlinkCapacity": 20, - "congestion": false, - "readBufferSize": 1, - "writeBufferSize": 1 + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "mkcp", + "kcpSettings": { + // [!code focus:7] + "mtu": 1350, + "tti": 20, + "uplinkCapacity": 5, + "downlinkCapacity": 20, + "congestion": false, + "readBufferSize": 1, + "writeBufferSize": 1 + } + } + } + ] } ``` diff --git a/docs/ru/config/transports/raw.md b/docs/ru/config/transports/raw.md index 36b45177..20da1fd2 100644 --- a/docs/ru/config/transports/raw.md +++ b/docs/ru/config/transports/raw.md @@ -10,10 +10,22 @@ ```json { - "acceptProxyProtocol": false, - "header": { - "type": "none" - } + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "raw", + "rawSettings": { + // [!code focus:4] + "acceptProxyProtocol": false, + "header": { + "type": "none" + } + } + } + } + ] } ``` diff --git a/docs/ru/config/transports/websocket.md b/docs/ru/config/transports/websocket.md index 80e1bc3c..24bbbac1 100644 --- a/docs/ru/config/transports/websocket.md +++ b/docs/ru/config/transports/websocket.md @@ -18,13 +18,25 @@ WebSocket распознает заголовок X-Forwarded-For в HTTP-зап ```json { - "acceptProxyProtocol": false, - "path": "/", - "host": "xray.com", - "headers": { - "key": "value" - }, - "heartbeatPeriod": 10 + // outbound example; also applies to inbound + "outbounds": [ + { + // ... + "streamSettings": { + "network": "websocket", + "wsSettings": { + // [!code focus:7] + "acceptProxyProtocol": false, + "path": "/", + "host": "xray.com", + "headers": { + "key": "value" + }, + "heartbeatPeriod": 10 + } + } + } + ] } ```