Update examples from deprecated flows to Vision

This commit is contained in:
yuhan6665
2022-12-26 12:12:42 -05:00
parent 278eabf51c
commit a12e0378b0
10 changed files with 323 additions and 301 deletions
+37 -37
View File
@@ -133,55 +133,55 @@
### 5.1 首先,我将服务器端配置的 443 监听段摘抄如下:
```json5
```json
{
port: 443,
protocol: "vless",
settings: {
clients: [
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
id: "", // 填写你的 UUID
flow: "xtls-rprx-direct",
level: 0,
email: "love@example.com",
},
"id": "", // 填写你的 UUID
"flow": "xtls-rprx-vision",
"level": 0,
"email": "love@example.com"
}
],
decryption: "none",
fallbacks: [
"decryption": "none",
"fallbacks": [
{
dest: 1310, // 默认回落到 Xray 的 Trojan 协议
xver: 1,
"dest": 1310, // 默认回落到 Xray 的 Trojan 协议
"xver": 1
},
{
path: "/websocket", // 必须换成自定义的 PATH
dest: 1234,
xver: 1,
"path": "/websocket", // 必须换成自定义的 PATH
"dest": 1234,
"xver": 1
},
{
path: "/vmesstcp", // 必须换成自定义的 PATH
dest: 2345,
xver: 1,
"path": "/vmesstcp", // 必须换成自定义的 PATH
"dest": 2345,
"xver": 1
},
{
path: "/vmessws", // 必须换成自定义的 PATH
dest: 3456,
xver: 1,
},
],
"path": "/vmessws", // 必须换成自定义的 PATH
"dest": 3456,
"xver": 1
}
]
},
streamSettings: {
network: "tcp",
security: "xtls",
xtlsSettings: {
alpn: ["http/1.1"],
certificates: [
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": ["http/1.1"],
"certificates": [
{
certificateFile: "/path/to/fullchain.crt", // 换成你的证书,绝对路径
keyFile: "/path/to/private.key", // 换成你的私钥,绝对路径
},
],
},
},
"certificateFile": "/path/to/fullchain.crt", // 换成你的证书,绝对路径
"keyFile": "/path/to/private.key" // 换成你的私钥,绝对路径
}
]
}
}
}
```
+79 -77
View File
@@ -74,91 +74,91 @@ acme.sh --install-cert -d example.com --fullchain-file /etc/ssl/xray/cert.pem --
## Xray 配置
```json5
```json
{
log: {
loglevel: "warning",
"log": {
"loglevel": "warning"
},
inbounds: [
"inbounds": [
{
port: 443,
protocol: "vless",
settings: {
clients: [
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
id: "UUID",
flow: "xtls-rprx-direct",
},
"id": "UUID",
"flow": "xtls-rprx-vision"
}
],
decryption: "none",
fallbacks: [
"decryption": "none",
"fallbacks": [
{
name: "example.com",
path: "/vmessws",
dest: 5000,
xver: 1,
"name": "example.com",
"path": "/vmessws",
"dest": 5000,
"xver": 1
},
{
dest: 5001,
xver: 1,
"dest": 5001,
"xver": 1
},
{
alpn: "h2",
dest: 5002,
xver: 1,
"alpn": "h2",
"dest": 5002,
"xver": 1
},
{
name: "blog.example.com",
dest: 5003,
xver: 1,
"name": "blog.example.com",
"dest": 5003,
"xver": 1
},
{
name: "blog.example.com",
alpn: "h2",
dest: 5004,
xver: 1,
},
],
"name": "blog.example.com",
"alpn": "h2",
"dest": 5004,
"xver": 1
}
]
},
streamSettings: {
network: "tcp",
security: "xtls",
xtlsSettings: {
alpn: ["h2", "http/1.1"],
certificates: [
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": ["h2", "http/1.1"],
"certificates": [
{
certificateFile: "/etc/ssl/xray/cert.pem",
keyFile: "/etc/ssl/xray/privkey.key",
},
],
},
},
"certificateFile": "/etc/ssl/xray/cert.pem",
"keyFile": "/etc/ssl/xray/privkey.key"
}
]
}
}
},
{
listen: "127.0.0.1",
port: 5000,
protocol: "vmess",
settings: {
clients: [
"listen": "127.0.0.1",
"port": 5000,
"protocol": "vmess",
"settings": {
"clients": [
{
id: "UUID",
},
],
"id": "UUID"
}
]
},
streamSettings: {
network: "ws",
wsSettings: {
acceptProxyProtocol: true,
path: "/vmessws",
},
},
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/vmessws"
}
}
}
],
outbounds: [
"outbounds": [
{
protocol: "freedom",
},
],
"protocol": "freedom"
}
]
}
```
@@ -181,9 +181,9 @@ acme.sh --install-cert -d example.com --fullchain-file /etc/ssl/xray/cert.pem --
- 有关 HTTP/2
首先,`inbounds.streamSettings.xtlsSettings.alpn` 有顺序,应将 `h2` 放前,`http/1.1` 放后,在优先使用 HTTP/2 的同时保证兼容性;反过来会导致 HTTP/2 在协商时变为 HTTP/1.1,成为无效配置。
首先,`inbounds.streamSettings.tlsSettings.alpn` 有顺序,应将 `h2` 放前,`http/1.1` 放后,在优先使用 HTTP/2 的同时保证兼容性;反过来会导致 HTTP/2 在协商时变为 HTTP/1.1,成为无效配置。
在上述配置中,每条回落到 Nginx 的配置都要分成两个。这是因为 h2 是强制 TLS 加密的 HTTP/2 连接,这有益于数据在互联网中传输的安全,但在服务器内部没有必要;而 h2c 是非加密的 HTTP/2 连接,适合该环境。然而,Nginx 不能在同一端口上同时监听 HTTP/1.1 和 h2c,为了解决这个问题,需要在回落中指定 `alpn` 项(是 `fallbacks` 而不是 `xtlsSettings` 里面的),以尝试匹配 TLS ALPN 协商结果。
在上述配置中,每条回落到 Nginx 的配置都要分成两个。这是因为 h2 是强制 TLS 加密的 HTTP/2 连接,这有益于数据在互联网中传输的安全,但在服务器内部没有必要;而 h2c 是非加密的 HTTP/2 连接,适合该环境。然而,Nginx 不能在同一端口上同时监听 HTTP/1.1 和 h2c,为了解决这个问题,需要在回落中指定 `alpn` 项(是 `fallbacks` 而不是 `tlsSettings` 里面的),以尝试匹配 TLS ALPN 协商结果。
建议 `alpn` 项只按需用两种填法:[^4]
@@ -192,24 +192,26 @@ acme.sh --install-cert -d example.com --fullchain-file /etc/ssl/xray/cert.pem --
如果使用 Caddy 就大可不必如此繁杂了,因为它**可以**在同一端口上同时监听 HTTP/1.1 和 h2c,配置改动如下:
```json5
"fallbacks": [
```json
{
"fallbacks": [
{
"name": "example.com",
"path": "/vmessws",
"dest": 5000,
"xver": 1
"name": "example.com",
"path": "/vmessws",
"dest": 5000,
"xver": 1
},
{
"dest": 5001,
"xver": 1
"dest": 5001,
"xver": 1
},
{
"name": "blog.example.com",
"dest": 5002,
"xver": 1
"name": "blog.example.com",
"dest": 5002,
"xver": 1
}
]
]
}
```
## Nginx 配置
+31 -27
View File
@@ -71,38 +71,42 @@
**出站:** 就是流量如何流出 `Xray`
:::
下面的出站配置示例,用大白话说就是:数据按照 `VLESS` 协议,以 `tcp + xtls (direct)` 的方式、及其他相关设置,把流量发送给对应的 VPS。同时,`Xray` 将这个出站用 `[tag]` 命名为 `proxy-out-vless`:
下面的出站配置示例,用大白话说就是:数据按照 `VLESS` 协议,以 `tcp + xtls` 的方式、及其他相关设置,把流量发送给对应的 VPS。同时,`Xray` 将这个出站用 `[tag]` 命名为 `proxy-out-vless`:
```json5
"outbounds": [
```json
{
"outbounds": [
{
"tag": "proxy-out-vless",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "a-name.yourdomain.com",
"port": 443,
"users": [
{
"id": "uuiduuid-uuid-uuid-uuid-uuiduuiduuid",
"flow": "xtls-rprx-direct",
"encryption": "none",
"level": 0
}
]
}
"tag": "proxy-out-vless",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "a-name.yourdomain.com",
"port": 443,
"users": [
{
"id": "uuiduuid-uuid-uuid-uuid-uuiduuiduuid",
"flow": "xtls-rprx-vision",
"encryption": "none",
"level": 0
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"serverName": "a-name.yourdomain.com"
}
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "a-name.yourdomain.com",
"allowInsecure": false,
"fingerprint": "chrome"
}
}
}
]
]
}
```
### 2.3 路由