feat: TCP mode for VLESS support via KCP+smux over TURN tunnel

Add -tcp flag to client and server for forwarding TCP connections
(VLESS, etc.) through the TURN tunnel instead of UDP packets (WireGuard).
Stack: TCP → smux (mux) → KCP (reliability) → DTLS (encryption) → TURN
New dependencies: xtaci/kcp-go/v5, xtaci/smux
This commit is contained in:
Moroka8 committed 2026-03-31 02:29:42 +07:00
1 parent 8911340cdd
commit b798ec5744
7 files changed
+749 -106

No files matched your search

+115
View File
@@ -227,5 +227,120 @@ chmod 777 ./client-android
</details>
## VLESS (TCP-режим)
Если WireGuard блокируется DPI, можно использовать VLESS через флаг `-tcp`. В этом режиме вместо UDP-пакетов пробрасываются TCP-соединения через TURN-туннель с помощью KCP и smux.
### Настройка
1. На VPS установить Xray с VLESS inbound
2. Запустить `server` с флагом `-tcp`
3. На клиенте запустить `client` с флагом `-tcp`
4. Настроить Xray/v2rayN клиент с VLESS outbound на `127.0.0.1:9000`
### Сервер (VPS)
```
./server -listen 0.0.0.0:56000 -connect 127.0.0.1:443 -tcp
```
#### Docker
```
docker run -p 56000:56000/udp -e CONNECT_ADDR=127.0.0.1:443 -e TCP_MODE=true vk-turn-proxy
```
### Клиент
```
./client -peer <ip сервера>:56000 -vk-link <VK ссылка> -listen 127.0.0.1:9000 -tcp
```
<details>
<summary>
Xray клиент (config.json)
</summary>
```json
{
"inbounds": [
{
"protocol": "socks",
"listen": "127.0.0.1",
"port": 1080,
"settings": {
"udp": true
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
}
],
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "127.0.0.1",
"port": 9000,
"users": [
{
"id": "<UUID>",
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "none"
}
}
]
}
```
</details>
<details>
<summary>
Xray сервер (config.json)
</summary>
```json
{
"inbounds": [
{
"protocol": "vless",
"listen": "127.0.0.1",
"port": 443,
"settings": {
"clients": [
{
"id": "<тот же UUID>",
"level": 0
}
],
"decryption": "none"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
}
}
]
}
```
</details>
> **Важно:** В TCP-режиме используется один TURN-поток. Для VK это ограничивает скорость ~5 Мбит/с.
## Direct mode
С флагом `-no-dtls` можно отправлять пакеты без обфускации DTLS и подключаться к обычным серверам Wireguard. Может привести к бану от вк/яндекса.