sing-box/docs/configuration/shared/v2ray-transport.md
2022-08-26 11:10:02 +08:00

135 lines
2.1 KiB
Markdown

V2Ray Transport is a set of private protocols invented by v2ray, and has contaminated the names of other protocols, such
as `trojan-grpc` in clash.
### Structure
```json
{
"type": ""
}
```
Available transports:
* HTTP
* WebSocket
* QUIC
* gRPC
!!! warning "Difference from v2ray-core"
* No TCP transport, plain HTTP is merged into the HTTP transport.
* No mKCP transport.
* No DomainSocket transport.
!!! note ""
You can ignore the JSON Array [] tag when the content is only one item
### HTTP
```json
{
"type": "http",
"host": [],
"path": "",
"method": "",
"headers": {}
}
```
!!! warning "Difference from v2ray-core"
TLS is not enforced. If TLS is not configured, plain HTTP 1.1 is used.
#### host
List of host domain.
The client will choose randomly and the server will verify if not empty.
#### path
Path of HTTP request.
The server will verify if not empty.
#### method
Method of HTTP request.
The server will verify if not empty.
#### headers
Extra headers of HTTP request.
The server will write in response if not empty.
### WebSocket
```json
{
"type": "ws",
"path": "",
"headers": {},
"max_early_data": 0,
"early_data_header_name": ""
}
```
#### path
Path of HTTP request.
The server will verify if not empty.
#### headers
Extra headers of HTTP request.
#### max_early_data
Allowed payload size is in the request. Enabled if not zero.
#### early_data_header_name
Early data is sent in path instead of header by default.
To be compatible with Xray-core, set this to `Sec-WebSocket-Protocol`.
It needs to be consistent with the server.
### QUIC
```json
{
"type": "quic"
}
```
!!! warning ""
QUIC is not included by default, see [Installation](/#installation).
!!! warning "Difference from v2ray-core"
No additional encryption support:
It's basically duplicate encryption. And Xray-core is not compatible with v2ray-core in here.
### gRPC
!!! warning ""
gRPC is not included by default, see [Installation](/#installation).
```json
{
"type": "grpc",
"service_name": "TunService"
}
```
#### service_name
Service name of gRPC.