From ac9b12131414e573f12664edfe8f3668cc9bf142 Mon Sep 17 00:00:00 2001 From: berlin2123 <68841407+berlin2123@users.noreply.github.com> Date: Wed, 5 Mar 2025 10:28:57 +0800 Subject: [PATCH] comments --- server/proxy/proxy.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/proxy/proxy.go b/server/proxy/proxy.go index 666b8bd6..68baa274 100644 --- a/server/proxy/proxy.go +++ b/server/proxy/proxy.go @@ -271,6 +271,7 @@ func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) { metrics.Server.AddTrafficIn(name, proxyType, inCount) metrics.Server.AddTrafficOut(name, proxyType, outCount) + // Log the duration of connection. if IsTheTypeToLog(serverCfg.Log.DurationTypes, name) { endtime := time.Now().UnixNano() / 1000000 // time in microseconds connectionDuration := endtime - startime @@ -283,6 +284,7 @@ func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) { } } +// Check Duration should be loged or not. True: while connection name contain a string in logDurationTypes. func IsTheTypeToLog(logDurationTypes string, name string) bool { if strings.Contains(logDurationTypes, "all") { return true