refactor(config): убрать флаги -no-dtls и серверный -vless-bond
Чистка CLI (breaking): - Клиент: убран -no-dtls (был помечен DO NOT USE; VK content-filter дропает payload без DTLS-handshake, так что прямой путь в проде не работал). Поле config.Client.Direct, guard диспатчера в main и TestParseClient_WrapDirectConflict удалены. - Сервер: убран -vless-bond. Сервер уже автоопределяет bond по magic-префиксу на первом smux-стриме (bond-autodetect=true), флаг был избыточен. Поле config.Server.VLESSBond, параметр useBond у handleVLESSConnection и ветка-предупреждение "non-bond stream while bond enabled" удалены. - Клиентский -vless-bond остаётся — он по-прежнему управляет страйпингом на стороне клиента. Wire-форматы не тронуты. Оба удаления флагов — breaking CLI-изменения.
This commit is contained in:
1 parent
817def3e01
commit
5b68683d41
2 files changed
+3
-19
No files matched your search
@@ -15,8 +15,9 @@ import (
|
|||||||
"github.com/cacggghp/vk-turn-proxy/internal/wrap"
|
"github.com/cacggghp/vk-turn-proxy/internal/wrap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mirrors of constants defined in client/internal packages, duplicated here
|
// Mirrors of constants defined in internal/client/* packages, duplicated here
|
||||||
// because internal/config cannot import client/internal/*.
|
// because internal/config cannot import internal/client/* (those packages
|
||||||
|
// import internal/config indirectly through dependents — avoid the cycle).
|
||||||
const (
|
const (
|
||||||
dnsModeUDP = "udp"
|
dnsModeUDP = "udp"
|
||||||
dnsModeDoH = "doh"
|
dnsModeDoH = "doh"
|
||||||
@@ -33,7 +34,6 @@ type Client struct {
|
|||||||
Peer string
|
Peer string
|
||||||
N int
|
N int
|
||||||
UDP bool
|
UDP bool
|
||||||
Direct bool
|
|
||||||
VLESSMode bool
|
VLESSMode bool
|
||||||
VLESSBond bool
|
VLESSBond bool
|
||||||
WrapMode bool
|
WrapMode bool
|
||||||
@@ -51,7 +51,6 @@ type Server struct {
|
|||||||
Listen string
|
Listen string
|
||||||
Connect string
|
Connect string
|
||||||
VLESSMode bool
|
VLESSMode bool
|
||||||
VLESSBond bool
|
|
||||||
WrapMode bool
|
WrapMode bool
|
||||||
WrapKey []byte
|
WrapKey []byte
|
||||||
GenWrapKey bool
|
GenWrapKey bool
|
||||||
@@ -73,7 +72,6 @@ func ParseClient(args []string, errOut io.Writer) (*Client, error) {
|
|||||||
peerAddr := fs.String("peer", "", "peer server address (host:port)")
|
peerAddr := fs.String("peer", "", "peer server address (host:port)")
|
||||||
n := fs.Int("n", 10, "connections to TURN")
|
n := fs.Int("n", 10, "connections to TURN")
|
||||||
udp := fs.Bool("udp", false, "connect to TURN with UDP")
|
udp := fs.Bool("udp", false, "connect to TURN with UDP")
|
||||||
direct := fs.Bool("no-dtls", false, "connect without obfuscation. DO NOT USE")
|
|
||||||
vlessMode := fs.Bool("vless", false, "VLESS mode: forward TCP connections (for VLESS) instead of UDP packets")
|
vlessMode := fs.Bool("vless", false, "VLESS mode: forward TCP connections (for VLESS) instead of UDP packets")
|
||||||
vlessBond := fs.Bool("vless-bond", false, "bond one VLESS TCP connection across all active smux sessions")
|
vlessBond := fs.Bool("vless-bond", false, "bond one VLESS TCP connection across all active smux sessions")
|
||||||
wrapMode := fs.Bool("wrap", false, "WRAP mode: ChaCha20-XOR obfuscate DTLS packets before they reach TURN ChannelData")
|
wrapMode := fs.Bool("wrap", false, "WRAP mode: ChaCha20-XOR obfuscate DTLS packets before they reach TURN ChannelData")
|
||||||
@@ -96,7 +94,6 @@ func ParseClient(args []string, errOut io.Writer) (*Client, error) {
|
|||||||
Peer: *peerAddr,
|
Peer: *peerAddr,
|
||||||
N: *n,
|
N: *n,
|
||||||
UDP: *udp,
|
UDP: *udp,
|
||||||
Direct: *direct,
|
|
||||||
VLESSMode: *vlessMode,
|
VLESSMode: *vlessMode,
|
||||||
VLESSBond: *vlessBond,
|
VLESSBond: *vlessBond,
|
||||||
WrapMode: *wrapMode,
|
WrapMode: *wrapMode,
|
||||||
@@ -128,9 +125,6 @@ func ParseClient(args []string, errOut io.Writer) (*Client, error) {
|
|||||||
if *vklink == "" {
|
if *vklink == "" {
|
||||||
return nil, errors.New("need vk-link")
|
return nil, errors.New("need vk-link")
|
||||||
}
|
}
|
||||||
if c.WrapMode && c.Direct {
|
|
||||||
return nil, fmt.Errorf("-wrap requires DTLS; remove -no-dtls")
|
|
||||||
}
|
|
||||||
key, err := wrap.DecodeKey(c.WrapMode, *wrapKeyHex)
|
key, err := wrap.DecodeKey(c.WrapMode, *wrapKeyHex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -163,7 +157,6 @@ func ParseServer(args []string, errOut io.Writer) (*Server, error) {
|
|||||||
listen := fs.String("listen", "0.0.0.0:56000", "listen on ip:port")
|
listen := fs.String("listen", "0.0.0.0:56000", "listen on ip:port")
|
||||||
connect := fs.String("connect", "", "connect to ip:port")
|
connect := fs.String("connect", "", "connect to ip:port")
|
||||||
vlessMode := fs.Bool("vless", false, "VLESS mode: forward TCP connections (for VLESS) instead of UDP packets")
|
vlessMode := fs.Bool("vless", false, "VLESS mode: forward TCP connections (for VLESS) instead of UDP packets")
|
||||||
vlessBond := fs.Bool("vless-bond", false, "bond one VLESS TCP connection across all active smux sessions")
|
|
||||||
wrapMode := fs.Bool("wrap", false, "WRAP mode: ChaCha20-XOR obfuscate DTLS packets before they reach TURN ChannelData")
|
wrapMode := fs.Bool("wrap", false, "WRAP mode: ChaCha20-XOR obfuscate DTLS packets before they reach TURN ChannelData")
|
||||||
wrapKeyHex := fs.String("wrap-key", "", "32-byte hex-encoded shared key for -wrap (64 hex chars)")
|
wrapKeyHex := fs.String("wrap-key", "", "32-byte hex-encoded shared key for -wrap (64 hex chars)")
|
||||||
genWrapKey := fs.Bool("gen-wrap-key", false, "print a fresh 64-character hex key for -wrap-key and exit")
|
genWrapKey := fs.Bool("gen-wrap-key", false, "print a fresh 64-character hex key for -wrap-key and exit")
|
||||||
@@ -177,7 +170,6 @@ func ParseServer(args []string, errOut io.Writer) (*Server, error) {
|
|||||||
Listen: *listen,
|
Listen: *listen,
|
||||||
Connect: *connect,
|
Connect: *connect,
|
||||||
VLESSMode: *vlessMode,
|
VLESSMode: *vlessMode,
|
||||||
VLESSBond: *vlessBond,
|
|
||||||
WrapMode: *wrapMode,
|
WrapMode: *wrapMode,
|
||||||
GenWrapKey: *genWrapKey,
|
GenWrapKey: *genWrapKey,
|
||||||
Debug: *debugFlag,
|
Debug: *debugFlag,
|
||||||
|
|||||||
@@ -77,14 +77,6 @@ func TestParseClient_InvalidDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParseClient_WrapDirectConflict(t *testing.T) {
|
|
||||||
args := append(validClientArgs(), "-wrap", "-no-dtls", "-wrap-key", strings.Repeat("aa", 32))
|
|
||||||
_, err := ParseClient(args, io.Discard)
|
|
||||||
if err == nil || !strings.Contains(err.Error(), "-wrap requires DTLS") {
|
|
||||||
t.Errorf("expected wrap/direct conflict, got %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestParseClient_WrapMissingKey(t *testing.T) {
|
func TestParseClient_WrapMissingKey(t *testing.T) {
|
||||||
args := append(validClientArgs(), "-wrap")
|
args := append(validClientArgs(), "-wrap")
|
||||||
_, err := ParseClient(args, io.Discard)
|
_, err := ParseClient(args, io.Discard)
|
||||||
|
|||||||
Reference in new issue
Block a user