mKCP Transport
mKCP is a reliable stream transport. It is an UDP based protocol.
Configuration:
{
"mtu": 1350,
"tti": 20,
"uplinkCapacity": 5,
"downlinkCapacity": 20,
"congestion": false,
"readBufferSize": 1,
"writeBufferSize": 1,
"header": {
"type": "none"
}
}
Where:
mtu: Maximum transmission unit. It indicates the maxium number bytes that an UDP packet can carry. Recommended value is between576and1460. Default value1350.tti: Transmission time interval, in milli-second. mKCP sends data in this interval. Recommended value is between10and100. Default value50.uplinkCapacity: Uplink bandwidth, in MB/s. The maximum bandwidth for the V2Ray instance to upload data to a remote one. Default value is5.- Please note it is byte (in MB/s), not bit.
- One may use value
0for a small bandwidth.
downlinkCapacity: Downlink bandwidth, in MB/s. The maximum bandwidth for the V2Ray instance to download data. Default value is20.- Please note it is byte (in MB/s), not bit.
- One may use value
0for a small bandwidth.
congestion: Whether or not to enable congestion control. Default value isfalse.- When congestion control is enabled, V2Ray will detect network quality. It will send less packets when packet loss is severe, or more data when network is not fully filled.
readBufferSize: Read buffer size for a single connection, in MB. Default value is2.writeBufferSize: Write buffer size for a single connection, in MB. Default value is2.header: Packet header for obfuscation.type: Type of obfuscation. Choices are:"none": Default value. No obfuscation is added."srtp": Obfuscated as SRTP traffic. It may be recognized as video calls such as Facetime."utp": Obfuscated as uTP traffic. It may be recognized as Bittorrent traffic."wechat-video": Obfuscated to WeChat traffic."dtls": Obfuscated as DTLS 1.2 packets."wireguard"(V2Ray 3.38+): Obfuscated as WireGuard packets. (NOT true WireGuard protocol)
Tips
uplinkCapacityanddownlinkCapacitydetermine the speed of mKCP. On client side,uplinkCapacityspecifies the speed for client sending data to server. On sever side,downlinkCapacityspecifies the speed of server receiving data. The minimum of this pair is effective in an actual connection.- mKCP uses UDP protocol. Please make sure your firewall is correctly setup.
- mKCP sends more traffic for lower latency. To transfer the same amount of data, mKCP usually requires more throughput than TCP does.
Credits
- @skywind3000 invented the original KCP protocol and implemented in C.
- @xtaci re-implement KCP protocol in Go.
- @xiaokangwang integrated KCP into V2Ray.