From bd345d6cd34e1dbfb44e357e52ff421520ce8bdf Mon Sep 17 00:00:00 2001 From: Vittorio Parrella Date: Fri, 20 Sep 2024 23:05:50 +0200 Subject: [PATCH] fix: fixed server remote address tracking --- workers/server/server_network.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workers/server/server_network.go b/workers/server/server_network.go index 43266f0..27f93f5 100644 --- a/workers/server/server_network.go +++ b/workers/server/server_network.go @@ -193,7 +193,7 @@ func handleQuicStream(quicStream backend.QuicBackendStream) { } logger.Info("[%d] Opened TCP NetConn %s -> %s\n", quicStream.ID(), qpepHeader.SourceAddr, destAddress) - proxyAddress := tcpConn.LocalAddr().String() + proxySrcAddress := qpepHeader.SourceAddr.String() startTime := time.Now() tqActiveFlag := atomic.Bool{} qtActiveFlag := atomic.Bool{} @@ -203,13 +203,13 @@ func handleQuicStream(quicStream backend.QuicBackendStream) { //setLinger(tcpConn) - api.Statistics.SetMappedAddress(proxyAddress, srcAddress) + api.Statistics.SetMappedAddress(proxySrcAddress, srcAddress) api.Statistics.IncrementCounter(1.0, api.TOTAL_CONNECTIONS) api.Statistics.IncrementCounter(1.0, api.PERF_CONN, srcAddress) defer func() { api.Statistics.DecrementCounter(1.0, api.PERF_CONN, srcAddress) api.Statistics.DecrementCounter(1.0, api.TOTAL_CONNECTIONS) - api.Statistics.DeleteMappedAddress(proxyAddress) + api.Statistics.DeleteMappedAddress(proxySrcAddress) }() ctx, _ := context.WithCancel(context.Background())