feat(proxy): tcp-режим для xray/sing-box поверх turn

This commit is contained in:
samosvalishe committed 2026-08-25 15:44:16 +03:00
1 parent e63279db18
commit f7129099f7
60 files changed
+2953 -135

No files matched your search

+22
View File
@@ -4,6 +4,8 @@ import (
"strings"
"testing"
"time"
"github.com/samosvalishe/free-turn-proxy/internal/tunnel"
)
func validClient() *Client {
@@ -69,3 +71,23 @@ func TestValidateServer(t *testing.T) {
t.Fatal("ValidateServer() must reject unknown obf profile")
}
}
// Встроенный WG гонит датаграммы - в tcp-режиме такой конфиг молча не работал бы.
func TestValidateTunnelRejectsTCPMode(t *testing.T) {
c := validClient()
c.Proxy.Mode = ProxyModeTCP
c.Tunnel = TunnelOpts{Mode: tunnel.ModeWG, Config: "[Interface]", MTU: 1280}
if err := Validate(c); err == nil || !strings.Contains(err.Error(), "tunnel requires") {
t.Errorf("expected tunnel/mode error, got %v", err)
}
}
// Маршруты к TURN от режима туннеля не зависят.
func TestValidateRoutesAllowedInTCPMode(t *testing.T) {
c := validClient()
c.Proxy.Mode = ProxyModeTCP
c.Routes = true
if err := Validate(c); err != nil {
t.Errorf("routes must be allowed in tcp mode: %v", err)
}
}