github.com/sagernet/sing-box@v1.9.0-rc.20/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 * HTTPUpgrade 19 20 !!! warning "Difference from v2ray-core" 21 22 * No TCP transport, plain HTTP is merged into the HTTP transport. 23 * No mKCP transport. 24 * No DomainSocket transport. 25 26 !!! note "" 27 28 You can ignore the JSON Array [] tag when the content is only one item 29 30 ### HTTP 31 32 ```json 33 { 34 "type": "http", 35 "host": [], 36 "path": "", 37 "method": "", 38 "headers": {}, 39 "idle_timeout": "15s", 40 "ping_timeout": "15s" 41 } 42 ``` 43 44 !!! warning "Difference from v2ray-core" 45 46 TLS is not enforced. If TLS is not configured, plain HTTP 1.1 is used. 47 48 #### host 49 50 List of host domain. 51 52 The client will choose randomly and the server will verify if not empty. 53 54 #### path 55 56 !!! warning 57 58 V2Ray's documentation says that the path between the server and the client must be consistent, 59 but the actual code allows the client to add any suffix to the path. 60 sing-box uses the same behavior as V2Ray, but note that the behavior does not exist in `WebSocket` and `HTTPUpgrade` transport. 61 62 Path of HTTP request. 63 64 The server will verify. 65 66 #### method 67 68 Method of HTTP request. 69 70 The server will verify if not empty. 71 72 #### headers 73 74 Extra headers of HTTP request. 75 76 The server will write in response if not empty. 77 78 #### idle_timeout 79 80 In HTTP2 server: 81 82 Specifies the time until idle clients should be closed with a GOAWAY frame. PING frames are not considered as activity. 83 84 In HTTP2 client: 85 86 Specifies the period of time after which a health check will be performed using a ping frame if no frames have been 87 received on the connection.Please note that a ping response is considered a received frame, so if there is no other 88 traffic on the connection, the health check will be executed every interval. If the value is zero, no health check will 89 be performed. 90 91 Zero is used by default. 92 93 #### ping_timeout 94 95 In HTTP2 client: 96 97 Specifies the timeout duration after sending a PING frame, within which a response must be received. 98 If a response to the PING frame is not received within the specified timeout duration, the connection will be closed. 99 The default timeout duration is 15 seconds. 100 101 ### WebSocket 102 103 ```json 104 { 105 "type": "ws", 106 "path": "", 107 "headers": {}, 108 "max_early_data": 0, 109 "early_data_header_name": "" 110 } 111 ``` 112 113 #### path 114 115 Path of HTTP request. 116 117 The server will verify. 118 119 #### headers 120 121 Extra headers of HTTP request. 122 123 The server will write in response if not empty. 124 125 #### max_early_data 126 127 Allowed payload size is in the request. Enabled if not zero. 128 129 #### early_data_header_name 130 131 Early data is sent in path instead of header by default. 132 133 To be compatible with Xray-core, set this to `Sec-WebSocket-Protocol`. 134 135 It needs to be consistent with the server. 136 137 ### QUIC 138 139 ```json 140 { 141 "type": "quic" 142 } 143 ``` 144 145 !!! warning "Difference from v2ray-core" 146 147 No additional encryption support: 148 It's basically duplicate encryption. And Xray-core is not compatible with v2ray-core in here. 149 150 ### gRPC 151 152 !!! note "" 153 154 standard gRPC has good compatibility but poor performance and is not included by default, see [Installation](/installation/build-from-source/#build-tags). 155 156 ```json 157 { 158 "type": "grpc", 159 "service_name": "TunService", 160 "idle_timeout": "15s", 161 "ping_timeout": "15s", 162 "permit_without_stream": false 163 } 164 ``` 165 166 #### service_name 167 168 Service name of gRPC. 169 170 #### idle_timeout 171 172 In standard gRPC server/client: 173 174 If the transport doesn't see any activity after a duration of this time, 175 it pings the client to check if the connection is still active. 176 177 In default gRPC server/client: 178 179 It has the same behavior as the corresponding setting in HTTP transport. 180 181 #### ping_timeout 182 183 In standard gRPC server/client: 184 185 The timeout that after performing a keepalive check, the client will wait for activity. 186 If no activity is detected, the connection will be closed. 187 188 In default gRPC server/client: 189 190 It has the same behavior as the corresponding setting in HTTP transport. 191 192 #### permit_without_stream 193 194 In standard gRPC client: 195 196 If enabled, the client transport sends keepalive pings even with no active connections. 197 If disabled, when there are no active connections, `idle_timeout` and `ping_timeout` will be ignored and no keepalive 198 pings will be sent. 199 200 Disabled by default. 201 202 ### HTTPUpgrade 203 204 ```json 205 { 206 "type": "httpupgrade", 207 "host": "", 208 "path": "", 209 "headers": {} 210 } 211 ``` 212 213 #### host 214 215 Host domain. 216 217 The server will verify if not empty. 218 219 #### path 220 221 Path of HTTP request. 222 223 The server will verify. 224 225 #### headers 226 227 Extra headers of HTTP request. 228 229 The server will write in response if not empty.