feat(worker): net.Conn implementation to count Bytes Read and Written
This commit introduces a new net.Conn implementation (countingConn) that will keep track of bytes read and written for a particular client connection. This is then implemented into the worker code using interface composition. Refs: #2501
This commit is contained in:
1 parent
f114e20c6d
commit
1bb80624b8
7 files changed
+261
-17
No files matched your search
@@ -218,6 +218,8 @@ func (w *Worker) handleProxy(listenerCfg *listenerutil.ListenerConfig, sessionMa
|
||||
return
|
||||
}
|
||||
event.WriteSysEvent(ctx, op, "connection successfully authorized", "session_id", sessionId, "connection_id", ci.Id)
|
||||
|
||||
cc := &countingConn{Conn: websocket.NetConn(connCtx, conn, websocket.MessageBinary)}
|
||||
defer func() {
|
||||
if sessionManager.RequestCloseConnections(ctx, map[string]string{ci.Id: sess.GetId()}) {
|
||||
event.WriteSysEvent(ctx, op, "connection closed", "session_id", sessionId, "connection_id", ci.Id)
|
||||
@@ -240,7 +242,7 @@ func (w *Worker) handleProxy(listenerCfg *listenerutil.ListenerConfig, sessionMa
|
||||
conf := proxyHandlers.Config{
|
||||
UserClientIp: net.ParseIP(userClientIp),
|
||||
ClientAddress: clientAddr,
|
||||
ClientConn: conn,
|
||||
ClientConn: cc,
|
||||
RemoteEndpoint: sess.GetEndpoint(),
|
||||
Session: sess,
|
||||
ConnectionId: ci.Id,
|
||||
|
||||
Reference in new issue
Block a user