From 8f394dba27e492ffb856d5dd4b5cdd07fedaa8b1 Mon Sep 17 00:00:00 2001 From: fatedier Date: Sat, 11 Mar 2023 19:34:06 +0800 Subject: [PATCH] trace log adds join errors (#3352) --- client/proxy/proxy.go | 5 ++++- client/visitor.go | 5 ++++- go.mod | 2 +- go.sum | 4 ++-- server/proxy/proxy.go | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/proxy/proxy.go b/client/proxy/proxy.go index 1cf477d..c8ea4f2 100644 --- a/client/proxy/proxy.go +++ b/client/proxy/proxy.go @@ -819,6 +819,9 @@ func HandleTCPWorkConnection(ctx context.Context, localInfo *config.LocalSvrConf } } - frpIo.Join(localConn, remote) + _, _, errs := frpIo.Join(localConn, remote) xl.Debug("join connections closed") + if len(errs) > 0 { + xl.Trace("join connections errors: %v", errs) + } } diff --git a/client/visitor.go b/client/visitor.go index ee15f28..6f24b84 100644 --- a/client/visitor.go +++ b/client/visitor.go @@ -339,8 +339,11 @@ func (sv *XTCPVisitor) handleConn(userConn net.Conn) { muxConnRWCloser = frpIo.WithCompression(muxConnRWCloser) } - frpIo.Join(userConn, muxConnRWCloser) + _, _, errs := frpIo.Join(userConn, muxConnRWCloser) xl.Debug("join connections closed") + if len(errs) > 0 { + xl.Trace("join connections errors: %v", errs) + } } type SUDPVisitor struct { diff --git a/go.mod b/go.mod index 41773bd..41bc0b3 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 github.com/coreos/go-oidc/v3 v3.4.0 github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb - github.com/fatedier/golib v0.1.1-0.20220321042308-c306138b83ac + github.com/fatedier/golib v0.1.1-0.20230311074156-2623b2569b10 github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible github.com/go-playground/validator/v10 v10.11.0 github.com/google/uuid v1.3.0 diff --git a/go.sum b/go.sum index 9925c93..c8090da 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk= -github.com/fatedier/golib v0.1.1-0.20220321042308-c306138b83ac h1:td1FJwN/oz8+9GldeEm3YdBX0Husc0FSPywLesZxi4w= -github.com/fatedier/golib v0.1.1-0.20220321042308-c306138b83ac/go.mod h1:fLV0TLwHqrnB/L3jbNl67Gn6PCLggDGHniX1wLrA2Qo= +github.com/fatedier/golib v0.1.1-0.20230311074156-2623b2569b10 h1:JjEXgytxMpWC6nK1u+Pskvaf2MPRnv/pxWmTlyVQMUI= +github.com/fatedier/golib v0.1.1-0.20230311074156-2623b2569b10/go.mod h1:Wdn1pJ0dHB1lah6FPYwt4AO9NEmWI0OzW13dpzC9g4E= github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1:ssXat9YXFvigNge/IkkZvFMn8yeYKFX+uI6wn2mLJ74= github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible/go.mod h1:YpCOaxj7vvMThhIQ9AfTOPW2sfztQR5WDfs7AflSy4s= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= diff --git a/server/proxy/proxy.go b/server/proxy/proxy.go index 3c6fb11..088d637 100644 --- a/server/proxy/proxy.go +++ b/server/proxy/proxy.go @@ -319,7 +319,7 @@ func HandleUserTCPConnection(pxy Proxy, userConn net.Conn, serverCfg config.Serv name := pxy.GetName() proxyType := pxy.GetConf().GetBaseInfo().ProxyType metrics.Server.OpenConnection(name, proxyType) - inCount, outCount := frpIo.Join(local, userConn) + inCount, outCount, _ := frpIo.Join(local, userConn) metrics.Server.CloseConnection(name, proxyType) metrics.Server.AddTrafficIn(name, proxyType, inCount) metrics.Server.AddTrafficOut(name, proxyType, outCount)