From ba45d29b7c1eb2840646ac26baaa035a1a2e3664 Mon Sep 17 00:00:00 2001 From: fatedier Date: Sun, 3 Mar 2019 23:44:44 +0800 Subject: [PATCH] fix xtcp cmd --- client/visitor.go | 2 ++ cmd/frpc/sub/xtcp.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/visitor.go b/client/visitor.go index 1e8ffec8..e81f7986 100644 --- a/client/visitor.go +++ b/client/visitor.go @@ -280,6 +280,8 @@ func (sv *XtcpVisitor) handleConn(userConn frpNet.Conn) { sv.Error("listen on visitorConn's local adress error: %v", err) return } + defer lConn.Close() + lConn.SetReadDeadline(time.Now().Add(5 * time.Second)) sidBuf := pool.GetBuf(1024) n, _, err = lConn.ReadFromUDP(sidBuf) diff --git a/cmd/frpc/sub/xtcp.go b/cmd/frpc/sub/xtcp.go index 0a81e18b..c15ac5ad 100644 --- a/cmd/frpc/sub/xtcp.go +++ b/cmd/frpc/sub/xtcp.go @@ -68,7 +68,7 @@ var xtcpCmd = &cobra.Command{ if role == "server" { cfg := &config.XtcpProxyConf{} cfg.ProxyName = prefix + proxyName - cfg.ProxyType = consts.StcpProxy + cfg.ProxyType = consts.XtcpProxy cfg.UseEncryption = useEncryption cfg.UseCompression = useCompression cfg.Role = role @@ -84,7 +84,7 @@ var xtcpCmd = &cobra.Command{ } else if role == "visitor" { cfg := &config.XtcpVisitorConf{} cfg.ProxyName = prefix + proxyName - cfg.ProxyType = consts.StcpProxy + cfg.ProxyType = consts.XtcpProxy cfg.UseEncryption = useEncryption cfg.UseCompression = useCompression cfg.Role = role