github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/docs/configuration/shared/v2ray-transport.md (about) 1 V2Ray Transport is a set of private protocols invented by v2ray, and has contaminated the names of other protocols, such 2 as `trojan-grpc` in clash. 3 4 ### Structure 5 6 ```json 7 { 8 "type": "" 9 } 10 ``` 11 12 Available transports: 13 14 * HTTP 15 * WebSocket 16 * QUIC 17 * gRPC 18 19 !!! warning "Difference from v2ray-core" 20 21 * No TCP transport, plain HTTP is merged into the HTTP transport. 22 * No mKCP transport. 23 * No DomainSocket transport. 24 25 !!! note "" 26 27 You can ignore the JSON Array [] tag when the content is only one item 28 29 ### HTTP 30 31 ```json 32 { 33 "type": "http", 34 "host": [], 35 "path": "", 36 "method": "", 37 "headers": {}, 38 "idle_timeout": "15s", 39 "ping_timeout": "15s" 40 } 41 ``` 42 43 !!! warning "Difference from v2ray-core" 44 45 TLS is not enforced. If TLS is not configured, plain HTTP 1.1 is used. 46 47 #### host 48 49 List of host domain. 50 51 The client will choose randomly and the server will verify if not empty. 52 53 #### path 54 55 Path of HTTP request. 56 57 The server will verify if not empty. 58 59 #### method 60 61 Method of HTTP request. 62 63 The server will verify if not empty. 64 65 #### headers 66 67 Extra headers of HTTP request. 68 69 The server will write in response if not empty. 70 71 #### idle_timeout 72 73 In HTTP2 server: 74 75 Specifies the time until idle clients should be closed with a GOAWAY frame. PING frames are not considered as activity. 76 77 In HTTP2 client: 78 79 Specifies the period of time after which a health check will be performed using a ping frame if no frames have been received on the connection. Please note that a ping response is considered a received frame, so if there is no other traffic on the connection, the health check will be executed every interval. If the value is zero, no health check will be performed. 80 81 Zero is used by default. 82 83 #### ping_timeout 84 85 In HTTP2 client: 86 87 Specifies the timeout duration after sending a PING frame, within which a response must be received. If a response to the PING frame is not received within the specified timeout duration, the connection will be closed. The default timeout duration is 15 seconds. 88 89 ### WebSocket 90 91 ```json 92 { 93 "type": "ws", 94 "path": "", 95 "headers": {}, 96 "max_early_data": 0, 97 "early_data_header_name": "" 98 } 99 ``` 100 101 #### path 102 103 Path of HTTP request. 104 105 The server will verify if not empty. 106 107 #### headers 108 109 Extra headers of HTTP request. 110 111 #### max_early_data 112 113 Allowed payload size is in the request. Enabled if not zero. 114 115 #### early_data_header_name 116 117 Early data is sent in path instead of header by default. 118 119 To be compatible with Xray-core, set this to `Sec-WebSocket-Protocol`. 120 121 It needs to be consistent with the server. 122 123 ### QUIC 124 125 ```json 126 { 127 "type": "quic" 128 } 129 ``` 130 131 !!! warning "" 132 133 QUIC is not included by default, see [Installation](/#installation). 134 135 !!! warning "Difference from v2ray-core" 136 137 No additional encryption support: 138 It's basically duplicate encryption. And Xray-core is not compatible with v2ray-core in here. 139 140 ### gRPC 141 142 !!! note "" 143 144 standard gRPC has good compatibility but poor performance and is not included by default, see [Installation](/#installation). 145 146 ```json 147 { 148 "type": "grpc", 149 "service_name": "TunService", 150 "idle_timeout": "15s", 151 "ping_timeout": "15s", 152 "permit_without_stream": false 153 } 154 ``` 155 156 #### service_name 157 158 Service name of gRPC. 159 160 #### idle_timeout 161 162 In standard gRPC server/client: 163 164 If the transport doesn't see any activity after a duration of this time, it pings the client to check if the connection is still active. 165 166 In default gRPC server/client: 167 168 It has the same behavior as the corresponding setting in HTTP transport. 169 170 #### ping_timeout 171 172 In standard gRPC server/client: 173 174 The timeout that after performing a keepalive check, the client will wait for activity. If no activity is detected, the connection will be closed. 175 176 In default gRPC server/client: 177 178 It has the same behavior as the corresponding setting in HTTP transport. 179 180 #### permit_without_stream 181 182 In standard gRPC client: 183 184 If enabled, the client transport sends keepalive pings even with no active connections. If disabled, when there are no active connections, `idle_timeout` and `ping_timeout` will be ignored and no keepalive pings will be sent. 185 186 Disabled by default.