sing-box/docs/configuration/shared/v2ray-transport.zh.md

130 lines
2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

V2Ray Transport 是 v2ray 发明的一组私有协议,并污染了其他协议的名称,如 clash 中的 `trojan-grpc`
### 结构
```json
{
"type": ""
}
```
可用的传输协议:
* HTTP
* WebSocket
* QUIC
* gRPC
!!! warning "与 v2ray-core 的区别"
* 没有 TCP 传输层, 纯 HTTP 已合并到 HTTP 传输层。
* 没有 mKCP 传输层。
* 没有 DomainSocket 传输层。
!!! note
当内容只有一项时,可以忽略 JSON 数组 [] 标签
### HTTP
```json
{
"type": "http",
"host": [],
"path": "",
"method": "",
"headers": {}
}
```
!!! warning "与 v2ray-core 的区别"
不强制执行 TLS。 如果未配置 TLS则使用纯 HTTP 1.1。
#### host
主机域名列表。
客户端将随机选择,如果不为空,服务器将验证。
#### path
HTTP 请求路径
如果不为空,服务器将验证。
#### method
HTTP 请求方法
如果不为空,服务器将验证。
#### headers
HTTP 请求的额外标头
如果不为空,服务器将写入响应。
### WebSocket
```json
{
"type": "ws",
"path": "",
"headers": {},
"max_early_data": 0,
"early_data_header_name": ""
}
```
#### path
HTTP 请求路径
如果不为空,服务器将验证。
#### headers
HTTP 请求的额外标头
#### max_early_data
请求中允许的最大有效负载大小。 如果不为零则启用。
#### early_data_header_name
默认情况下,早期数据在路径而不是标头中发送。
要与 Xray-core 兼容,请将其设置为 `Sec-WebSocket-Protocol`
它需要与服务器保持一致。
### QUIC
```json
{
"type": "quic"
}
```
!!! warning "与 v2ray-core 的区别"
没有额外的加密支持:
它基本上是重复加密。 并且 Xray-core 在这里与 v2ray-core 不兼容。
### gRPC
!!! warning ""
默认安装不包括 gRPC, 参阅 [安装](/zh/#installation).
```json
{
"type": "grpc",
"service_name": "TunService"
}
```
#### service_name
gRPC 服务名称