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:
Hugo authored and Hugo Vieira committed 2022-10-26 17:43:04 +01:00
1 parent f114e20c6d
commit 1bb80624b8
7 files changed
+261 -17

No files matched your search

+5 -5
View File
@@ -35,7 +35,7 @@ func TestConfigValidate(t *testing.T) {
{
name: "missing-client-address",
conf: Config{
ClientConn: conn,
ClientConn: websocket.NetConn(context.Background(), conn, websocket.MessageBinary),
RemoteEndpoint: "tcp://remote",
Session: si,
ConnectionId: "connection-id",
@@ -58,7 +58,7 @@ func TestConfigValidate(t *testing.T) {
name: "missing-remote-endpoint",
conf: Config{
ClientAddress: clientAddr,
ClientConn: conn,
ClientConn: websocket.NetConn(context.Background(), conn, websocket.MessageBinary),
Session: si,
ConnectionId: "connection-id",
},
@@ -69,7 +69,7 @@ func TestConfigValidate(t *testing.T) {
name: "missing-session",
conf: Config{
ClientAddress: clientAddr,
ClientConn: conn,
ClientConn: websocket.NetConn(context.Background(), conn, websocket.MessageBinary),
RemoteEndpoint: "tcp://remote",
ConnectionId: "connection-id",
},
@@ -80,7 +80,7 @@ func TestConfigValidate(t *testing.T) {
name: "missing-connection-id",
conf: Config{
ClientAddress: clientAddr,
ClientConn: conn,
ClientConn: websocket.NetConn(context.Background(), conn, websocket.MessageBinary),
RemoteEndpoint: "tcp://remote",
Session: si,
},
@@ -91,7 +91,7 @@ func TestConfigValidate(t *testing.T) {
name: "valid",
conf: Config{
ClientAddress: clientAddr,
ClientConn: conn,
ClientConn: websocket.NetConn(context.Background(), conn, websocket.MessageBinary),
RemoteEndpoint: "tcp://remote",
Session: si,
ConnectionId: "connection-id",