From 9d4b3e608af2a3e539a018b222986c22a7fa3c83 Mon Sep 17 00:00:00 2001 From: Toby Date: Sat, 11 May 2024 13:55:55 -0700 Subject: [PATCH] chore: small changes to TrafficLogger function names & update all mocks to mockery v2.43.0 --- .../proxymux/internal/mocks/mock_Conn.go | 2 +- .../proxymux/internal/mocks/mock_Listener.go | 2 +- core/client/mock_udpIO.go | 10 ++- .../mocks/mock_TrafficLogger.go | 90 +++++++++---------- .../integration_tests/trafficlogger_test.go | 16 ++-- core/server/config.go | 4 +- core/server/copy.go | 4 +- core/server/mock_UDPConn.go | 14 ++- core/server/mock_udpEventLogger.go | 2 +- core/server/mock_udpIO.go | 14 ++- core/server/server.go | 8 +- extras/outbounds/mock_PluggableOutbound.go | 10 ++- extras/outbounds/mock_UDPConn.go | 14 ++- extras/trafficlogger/http.go | 4 +- 14 files changed, 125 insertions(+), 69 deletions(-) diff --git a/app/internal/proxymux/internal/mocks/mock_Conn.go b/app/internal/proxymux/internal/mocks/mock_Conn.go index 0bcbe65..13e363e 100644 --- a/app/internal/proxymux/internal/mocks/mock_Conn.go +++ b/app/internal/proxymux/internal/mocks/mock_Conn.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.2. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package mocks diff --git a/app/internal/proxymux/internal/mocks/mock_Listener.go b/app/internal/proxymux/internal/mocks/mock_Listener.go index e4ca2f4..842b88f 100644 --- a/app/internal/proxymux/internal/mocks/mock_Listener.go +++ b/app/internal/proxymux/internal/mocks/mock_Listener.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.2. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package mocks diff --git a/core/client/mock_udpIO.go b/core/client/mock_udpIO.go index 6e0b1ba..a85e006 100644 --- a/core/client/mock_udpIO.go +++ b/core/client/mock_udpIO.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.0. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package client @@ -24,6 +24,10 @@ func (_m *mockUDPIO) EXPECT() *mockUDPIO_Expecter { func (_m *mockUDPIO) ReceiveMessage() (*protocol.UDPMessage, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ReceiveMessage") + } + var r0 *protocol.UDPMessage var r1 error if rf, ok := ret.Get(0).(func() (*protocol.UDPMessage, error)); ok { @@ -77,6 +81,10 @@ func (_c *mockUDPIO_ReceiveMessage_Call) RunAndReturn(run func() (*protocol.UDPM func (_m *mockUDPIO) SendMessage(_a0 []byte, _a1 *protocol.UDPMessage) error { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for SendMessage") + } + var r0 error if rf, ok := ret.Get(0).(func([]byte, *protocol.UDPMessage) error); ok { r0 = rf(_a0, _a1) diff --git a/core/internal/integration_tests/mocks/mock_TrafficLogger.go b/core/internal/integration_tests/mocks/mock_TrafficLogger.go index 5da6aaf..9de44b9 100644 --- a/core/internal/integration_tests/mocks/mock_TrafficLogger.go +++ b/core/internal/integration_tests/mocks/mock_TrafficLogger.go @@ -17,12 +17,46 @@ func (_m *MockTrafficLogger) EXPECT() *MockTrafficLogger_Expecter { return &MockTrafficLogger_Expecter{mock: &_m.Mock} } -// Log provides a mock function with given fields: id, tx, rx -func (_m *MockTrafficLogger) Log(id string, tx uint64, rx uint64) bool { +// LogOnlineState provides a mock function with given fields: id, online +func (_m *MockTrafficLogger) LogOnlineState(id string, online bool) { + _m.Called(id, online) +} + +// MockTrafficLogger_LogOnlineState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogOnlineState' +type MockTrafficLogger_LogOnlineState_Call struct { + *mock.Call +} + +// LogOnlineState is a helper method to define mock.On call +// - id string +// - online bool +func (_e *MockTrafficLogger_Expecter) LogOnlineState(id interface{}, online interface{}) *MockTrafficLogger_LogOnlineState_Call { + return &MockTrafficLogger_LogOnlineState_Call{Call: _e.mock.On("LogOnlineState", id, online)} +} + +func (_c *MockTrafficLogger_LogOnlineState_Call) Run(run func(id string, online bool)) *MockTrafficLogger_LogOnlineState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(bool)) + }) + return _c +} + +func (_c *MockTrafficLogger_LogOnlineState_Call) Return() *MockTrafficLogger_LogOnlineState_Call { + _c.Call.Return() + return _c +} + +func (_c *MockTrafficLogger_LogOnlineState_Call) RunAndReturn(run func(string, bool)) *MockTrafficLogger_LogOnlineState_Call { + _c.Call.Return(run) + return _c +} + +// LogTraffic provides a mock function with given fields: id, tx, rx +func (_m *MockTrafficLogger) LogTraffic(id string, tx uint64, rx uint64) bool { ret := _m.Called(id, tx, rx) if len(ret) == 0 { - panic("no return value specified for Log") + panic("no return value specified for LogTraffic") } var r0 bool @@ -35,66 +69,32 @@ func (_m *MockTrafficLogger) Log(id string, tx uint64, rx uint64) bool { return r0 } -// MockTrafficLogger_Log_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Log' -type MockTrafficLogger_Log_Call struct { +// MockTrafficLogger_LogTraffic_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogTraffic' +type MockTrafficLogger_LogTraffic_Call struct { *mock.Call } -// Log is a helper method to define mock.On call +// LogTraffic is a helper method to define mock.On call // - id string // - tx uint64 // - rx uint64 -func (_e *MockTrafficLogger_Expecter) Log(id interface{}, tx interface{}, rx interface{}) *MockTrafficLogger_Log_Call { - return &MockTrafficLogger_Log_Call{Call: _e.mock.On("Log", id, tx, rx)} +func (_e *MockTrafficLogger_Expecter) LogTraffic(id interface{}, tx interface{}, rx interface{}) *MockTrafficLogger_LogTraffic_Call { + return &MockTrafficLogger_LogTraffic_Call{Call: _e.mock.On("LogTraffic", id, tx, rx)} } -func (_c *MockTrafficLogger_Log_Call) Run(run func(id string, tx uint64, rx uint64)) *MockTrafficLogger_Log_Call { +func (_c *MockTrafficLogger_LogTraffic_Call) Run(run func(id string, tx uint64, rx uint64)) *MockTrafficLogger_LogTraffic_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string), args[1].(uint64), args[2].(uint64)) }) return _c } -func (_c *MockTrafficLogger_Log_Call) Return(ok bool) *MockTrafficLogger_Log_Call { +func (_c *MockTrafficLogger_LogTraffic_Call) Return(ok bool) *MockTrafficLogger_LogTraffic_Call { _c.Call.Return(ok) return _c } -func (_c *MockTrafficLogger_Log_Call) RunAndReturn(run func(string, uint64, uint64) bool) *MockTrafficLogger_Log_Call { - _c.Call.Return(run) - return _c -} - -// LogOnlineStateChanged provides a mock function with given fields: id, online -func (_m *MockTrafficLogger) LogOnlineStateChanged(id string, online bool) { - _m.Called(id, online) -} - -// MockTrafficLogger_LogOnlineStateChanged_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogOnlineStateChanged' -type MockTrafficLogger_LogOnlineStateChanged_Call struct { - *mock.Call -} - -// LogOnlineStateChanged is a helper method to define mock.On call -// - id string -// - online bool -func (_e *MockTrafficLogger_Expecter) LogOnlineStateChanged(id interface{}, online interface{}) *MockTrafficLogger_LogOnlineStateChanged_Call { - return &MockTrafficLogger_LogOnlineStateChanged_Call{Call: _e.mock.On("LogOnlineStateChanged", id, online)} -} - -func (_c *MockTrafficLogger_LogOnlineStateChanged_Call) Run(run func(id string, online bool)) *MockTrafficLogger_LogOnlineStateChanged_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(bool)) - }) - return _c -} - -func (_c *MockTrafficLogger_LogOnlineStateChanged_Call) Return() *MockTrafficLogger_LogOnlineStateChanged_Call { - _c.Call.Return() - return _c -} - -func (_c *MockTrafficLogger_LogOnlineStateChanged_Call) RunAndReturn(run func(string, bool)) *MockTrafficLogger_LogOnlineStateChanged_Call { +func (_c *MockTrafficLogger_LogTraffic_Call) RunAndReturn(run func(string, uint64, uint64) bool) *MockTrafficLogger_LogTraffic_Call { _c.Call.Return(run) return _c } diff --git a/core/internal/integration_tests/trafficlogger_test.go b/core/internal/integration_tests/trafficlogger_test.go index abbea8c..690a348 100644 --- a/core/internal/integration_tests/trafficlogger_test.go +++ b/core/internal/integration_tests/trafficlogger_test.go @@ -36,6 +36,7 @@ func TestClientServerTrafficLoggerTCP(t *testing.T) { go s.Serve() // Create client + trafficLogger.EXPECT().LogOnlineState("nobody", true).Return().Once() c, _, err := client.NewClient(&client.Config{ ServerAddr: udpAddr, TLSConfig: client.TLSConfig{InsecureSkipVerify: true}, @@ -66,7 +67,7 @@ func TestClientServerTrafficLoggerTCP(t *testing.T) { assert.NoError(t, err) // Client reads from server - trafficLogger.EXPECT().Log("nobody", uint64(0), uint64(11)).Return(true).Once() + trafficLogger.EXPECT().LogTraffic("nobody", uint64(0), uint64(11)).Return(true).Once() sobConnCh <- []byte("knock knock") buf := make([]byte, 100) n, err := conn.Read(buf) @@ -75,7 +76,7 @@ func TestClientServerTrafficLoggerTCP(t *testing.T) { assert.Equal(t, "knock knock", string(buf[:n])) // Client writes to server - trafficLogger.EXPECT().Log("nobody", uint64(12), uint64(0)).Return(true).Once() + trafficLogger.EXPECT().LogTraffic("nobody", uint64(12), uint64(0)).Return(true).Once() sobConn.EXPECT().Write([]byte("who is there")).Return(12, nil).Once() n, err = conn.Write([]byte("who is there")) assert.NoError(t, err) @@ -83,7 +84,8 @@ func TestClientServerTrafficLoggerTCP(t *testing.T) { time.Sleep(1 * time.Second) // Need some time for the server to receive the data // Client reads from server again but blocked - trafficLogger.EXPECT().Log("nobody", uint64(0), uint64(4)).Return(false).Once() + trafficLogger.EXPECT().LogTraffic("nobody", uint64(0), uint64(4)).Return(false).Once() + trafficLogger.EXPECT().LogOnlineState("nobody", false).Return().Once() sobConnCh <- []byte("nope") n, err = conn.Read(buf) assert.Zero(t, n) @@ -116,6 +118,7 @@ func TestClientServerTrafficLoggerUDP(t *testing.T) { go s.Serve() // Create client + trafficLogger.EXPECT().LogOnlineState("nobody", true).Return().Once() c, _, err := client.NewClient(&client.Config{ ServerAddr: udpAddr, TLSConfig: client.TLSConfig{InsecureSkipVerify: true}, @@ -146,14 +149,14 @@ func TestClientServerTrafficLoggerUDP(t *testing.T) { assert.NoError(t, err) // Client writes to server - trafficLogger.EXPECT().Log("nobody", uint64(9), uint64(0)).Return(true).Once() + trafficLogger.EXPECT().LogTraffic("nobody", uint64(9), uint64(0)).Return(true).Once() sobConn.EXPECT().WriteTo([]byte("small sad"), addr).Return(9, nil).Once() err = conn.Send([]byte("small sad"), addr) assert.NoError(t, err) time.Sleep(1 * time.Second) // Need some time for the server to receive the data // Client reads from server - trafficLogger.EXPECT().Log("nobody", uint64(0), uint64(7)).Return(true).Once() + trafficLogger.EXPECT().LogTraffic("nobody", uint64(0), uint64(7)).Return(true).Once() sobConnCh <- []byte("big mad") bs, rAddr, err := conn.Receive() assert.NoError(t, err) @@ -161,7 +164,8 @@ func TestClientServerTrafficLoggerUDP(t *testing.T) { assert.Equal(t, "big mad", string(bs)) // Client reads from server again but blocked - trafficLogger.EXPECT().Log("nobody", uint64(0), uint64(4)).Return(false).Once() + trafficLogger.EXPECT().LogTraffic("nobody", uint64(0), uint64(4)).Return(false).Once() + trafficLogger.EXPECT().LogOnlineState("nobody", false).Return().Once() sobConnCh <- []byte("nope") bs, rAddr, err = conn.Receive() assert.Equal(t, err, io.EOF) diff --git a/core/server/config.go b/core/server/config.go index c630abc..8d5f5db 100644 --- a/core/server/config.go +++ b/core/server/config.go @@ -195,6 +195,6 @@ type EventLogger interface { // bandwidth limits or post-connection authentication, for example. // The implementation of this interface must be thread-safe. type TrafficLogger interface { - Log(id string, tx, rx uint64) (ok bool) - LogOnlineStateChanged(id string, online bool) + LogTraffic(id string, tx, rx uint64) (ok bool) + LogOnlineState(id string, online bool) } diff --git a/core/server/copy.go b/core/server/copy.go index 25831e5..d55dcef 100644 --- a/core/server/copy.go +++ b/core/server/copy.go @@ -35,12 +35,12 @@ func copyTwoWayWithLogger(id string, serverRw, remoteRw io.ReadWriter, l Traffic errChan := make(chan error, 2) go func() { errChan <- copyBufferLog(serverRw, remoteRw, func(n uint64) bool { - return l.Log(id, 0, n) + return l.LogTraffic(id, 0, n) }) }() go func() { errChan <- copyBufferLog(remoteRw, serverRw, func(n uint64) bool { - return l.Log(id, n, 0) + return l.LogTraffic(id, n, 0) }) }() // Block until one of the two goroutines returns diff --git a/core/server/mock_UDPConn.go b/core/server/mock_UDPConn.go index 34a34ee..7299975 100644 --- a/core/server/mock_UDPConn.go +++ b/core/server/mock_UDPConn.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.0. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package server @@ -21,6 +21,10 @@ func (_m *mockUDPConn) EXPECT() *mockUDPConn_Expecter { func (_m *mockUDPConn) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -62,6 +66,10 @@ func (_c *mockUDPConn_Close_Call) RunAndReturn(run func() error) *mockUDPConn_Cl func (_m *mockUDPConn) ReadFrom(b []byte) (int, string, error) { ret := _m.Called(b) + if len(ret) == 0 { + panic("no return value specified for ReadFrom") + } + var r0 int var r1 string var r2 error @@ -121,6 +129,10 @@ func (_c *mockUDPConn_ReadFrom_Call) RunAndReturn(run func([]byte) (int, string, func (_m *mockUDPConn) WriteTo(b []byte, addr string) (int, error) { ret := _m.Called(b, addr) + if len(ret) == 0 { + panic("no return value specified for WriteTo") + } + var r0 int var r1 error if rf, ok := ret.Get(0).(func([]byte, string) (int, error)); ok { diff --git a/core/server/mock_udpEventLogger.go b/core/server/mock_udpEventLogger.go index 08f3ff8..5a54b0b 100644 --- a/core/server/mock_udpEventLogger.go +++ b/core/server/mock_udpEventLogger.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.0. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package server diff --git a/core/server/mock_udpIO.go b/core/server/mock_udpIO.go index ddd44b3..6df862b 100644 --- a/core/server/mock_udpIO.go +++ b/core/server/mock_udpIO.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.0. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package server @@ -24,6 +24,10 @@ func (_m *mockUDPIO) EXPECT() *mockUDPIO_Expecter { func (_m *mockUDPIO) ReceiveMessage() (*protocol.UDPMessage, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ReceiveMessage") + } + var r0 *protocol.UDPMessage var r1 error if rf, ok := ret.Get(0).(func() (*protocol.UDPMessage, error)); ok { @@ -77,6 +81,10 @@ func (_c *mockUDPIO_ReceiveMessage_Call) RunAndReturn(run func() (*protocol.UDPM func (_m *mockUDPIO) SendMessage(_a0 []byte, _a1 *protocol.UDPMessage) error { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for SendMessage") + } + var r0 error if rf, ok := ret.Get(0).(func([]byte, *protocol.UDPMessage) error); ok { r0 = rf(_a0, _a1) @@ -120,6 +128,10 @@ func (_c *mockUDPIO_SendMessage_Call) RunAndReturn(run func([]byte, *protocol.UD func (_m *mockUDPIO) UDP(reqAddr string) (UDPConn, error) { ret := _m.Called(reqAddr) + if len(ret) == 0 { + panic("no return value specified for UDP") + } + var r0 UDPConn var r1 error if rf, ok := ret.Get(0).(func(string) (UDPConn, error)); ok { diff --git a/core/server/server.go b/core/server/server.go index 74640d4..d38097d 100644 --- a/core/server/server.go +++ b/core/server/server.go @@ -84,7 +84,7 @@ func (s *serverImpl) handleClient(conn quic.Connection) { // If the client is authenticated, we need to log the disconnect event if handler.authenticated { if tl := s.config.TrafficLogger; tl != nil { - tl.LogOnlineStateChanged(handler.authID, false) + tl.LogOnlineState(handler.authID, false) } if el := s.config.EventLogger; el != nil { el.Disconnect(conn.RemoteAddr(), handler.authID, err) @@ -159,7 +159,7 @@ func (h *h3sHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.WriteHeader(protocol.StatusAuthOK) // Call event logger if tl := h.config.TrafficLogger; tl != nil { - tl.LogOnlineStateChanged(id, true) + tl.LogOnlineState(id, true) } if el := h.config.EventLogger; el != nil { el.Connect(h.conn.RemoteAddr(), id, actualTx) @@ -276,7 +276,7 @@ func (io *udpIOImpl) ReceiveMessage() (*protocol.UDPMessage, error) { continue } if io.TrafficLogger != nil { - ok := io.TrafficLogger.Log(io.AuthID, uint64(len(udpMsg.Data)), 0) + ok := io.TrafficLogger.LogTraffic(io.AuthID, uint64(len(udpMsg.Data)), 0) if !ok { // TrafficLogger requested to disconnect the client _ = io.Conn.CloseWithError(closeErrCodeTrafficLimitReached, "") @@ -289,7 +289,7 @@ func (io *udpIOImpl) ReceiveMessage() (*protocol.UDPMessage, error) { func (io *udpIOImpl) SendMessage(buf []byte, msg *protocol.UDPMessage) error { if io.TrafficLogger != nil { - ok := io.TrafficLogger.Log(io.AuthID, 0, uint64(len(msg.Data))) + ok := io.TrafficLogger.LogTraffic(io.AuthID, 0, uint64(len(msg.Data))) if !ok { // TrafficLogger requested to disconnect the client _ = io.Conn.CloseWithError(closeErrCodeTrafficLimitReached, "") diff --git a/extras/outbounds/mock_PluggableOutbound.go b/extras/outbounds/mock_PluggableOutbound.go index c8620f2..79b38e4 100644 --- a/extras/outbounds/mock_PluggableOutbound.go +++ b/extras/outbounds/mock_PluggableOutbound.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.0. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package outbounds @@ -25,6 +25,10 @@ func (_m *mockPluggableOutbound) EXPECT() *mockPluggableOutbound_Expecter { func (_m *mockPluggableOutbound) TCP(reqAddr *AddrEx) (net.Conn, error) { ret := _m.Called(reqAddr) + if len(ret) == 0 { + panic("no return value specified for TCP") + } + var r0 net.Conn var r1 error if rf, ok := ret.Get(0).(func(*AddrEx) (net.Conn, error)); ok { @@ -79,6 +83,10 @@ func (_c *mockPluggableOutbound_TCP_Call) RunAndReturn(run func(*AddrEx) (net.Co func (_m *mockPluggableOutbound) UDP(reqAddr *AddrEx) (UDPConn, error) { ret := _m.Called(reqAddr) + if len(ret) == 0 { + panic("no return value specified for UDP") + } + var r0 UDPConn var r1 error if rf, ok := ret.Get(0).(func(*AddrEx) (UDPConn, error)); ok { diff --git a/extras/outbounds/mock_UDPConn.go b/extras/outbounds/mock_UDPConn.go index e71e1da..d450322 100644 --- a/extras/outbounds/mock_UDPConn.go +++ b/extras/outbounds/mock_UDPConn.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.0. DO NOT EDIT. +// Code generated by mockery v2.43.0. DO NOT EDIT. package outbounds @@ -21,6 +21,10 @@ func (_m *mockUDPConn) EXPECT() *mockUDPConn_Expecter { func (_m *mockUDPConn) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -62,6 +66,10 @@ func (_c *mockUDPConn_Close_Call) RunAndReturn(run func() error) *mockUDPConn_Cl func (_m *mockUDPConn) ReadFrom(b []byte) (int, *AddrEx, error) { ret := _m.Called(b) + if len(ret) == 0 { + panic("no return value specified for ReadFrom") + } + var r0 int var r1 *AddrEx var r2 error @@ -123,6 +131,10 @@ func (_c *mockUDPConn_ReadFrom_Call) RunAndReturn(run func([]byte) (int, *AddrEx func (_m *mockUDPConn) WriteTo(b []byte, addr *AddrEx) (int, error) { ret := _m.Called(b, addr) + if len(ret) == 0 { + panic("no return value specified for WriteTo") + } + var r0 int var r1 error if rf, ok := ret.Get(0).(func([]byte, *AddrEx) (int, error)); ok { diff --git a/extras/trafficlogger/http.go b/extras/trafficlogger/http.go index 827d64d..d0ec0a4 100644 --- a/extras/trafficlogger/http.go +++ b/extras/trafficlogger/http.go @@ -42,7 +42,7 @@ type trafficStatsEntry struct { Rx uint64 `json:"rx"` } -func (s *trafficStatsServerImpl) Log(id string, tx, rx uint64) (ok bool) { +func (s *trafficStatsServerImpl) LogTraffic(id string, tx, rx uint64) (ok bool) { s.Mutex.Lock() defer s.Mutex.Unlock() @@ -64,7 +64,7 @@ func (s *trafficStatsServerImpl) Log(id string, tx, rx uint64) (ok bool) { } // LogOnlineStateChanged updates the online state to the online map. -func (s *trafficStatsServerImpl) LogOnlineStateChanged(id string, online bool) { +func (s *trafficStatsServerImpl) LogOnlineState(id string, online bool) { s.Mutex.Lock() defer s.Mutex.Unlock()