diff --git a/cmd/outline-ss-server/metrics.go b/cmd/outline-ss-server/metrics.go index ed737083..e576420e 100644 --- a/cmd/outline-ss-server/metrics.go +++ b/cmd/outline-ss-server/metrics.go @@ -333,7 +333,7 @@ func (m *outlineMetrics) AddUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net m.tunnelTimeTracker.startConnection(clientInfo, clientAddr, accessKey) } -func (m *outlineMetrics) RemoveUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) { +func (m *outlineMetrics) RemoveUDPNatEntry(clientAddr net.Addr, accessKey string) { m.udpRemovedNatEntries.Inc() m.tunnelTimeTracker.stopConnection(clientAddr, accessKey) diff --git a/cmd/outline-ss-server/metrics_test.go b/cmd/outline-ss-server/metrics_test.go index 44c37b5e..065a906c 100644 --- a/cmd/outline-ss-server/metrics_test.go +++ b/cmd/outline-ss-server/metrics_test.go @@ -62,7 +62,7 @@ func TestMethodsDontPanic(t *testing.T) { ssMetrics.AddUDPPacketFromClient(ipInfo, "2", "OK", 10, 20) ssMetrics.AddUDPPacketFromTarget(ipInfo, "3", "OK", 10, 20) ssMetrics.AddUDPNatEntry(ipInfo, fakeAddr("127.0.0.1:9"), "key-1") - ssMetrics.RemoveUDPNatEntry(ipInfo, fakeAddr("127.0.0.1:9"), "key-1") + ssMetrics.RemoveUDPNatEntry(fakeAddr("127.0.0.1:9"), "key-1") ssMetrics.AddTCPProbe("ERR_CIPHER", "eof", 443, proxyMetrics.ClientProxy) ssMetrics.AddTCPCipherSearch(true, 10*time.Millisecond) ssMetrics.AddUDPCipherSearch(true, 10*time.Millisecond) @@ -231,6 +231,6 @@ func BenchmarkNAT(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { ssMetrics.AddUDPNatEntry(ipinfo, fakeAddr("127.0.0.1:9"), "key-0") - ssMetrics.RemoveUDPNatEntry(ipinfo, fakeAddr("127.0.0.1:9"), "key-0") + ssMetrics.RemoveUDPNatEntry(fakeAddr("127.0.0.1:9"), "key-0") } } diff --git a/internal/integration_test/integration_test.go b/internal/integration_test/integration_test.go index cc563e32..40433680 100644 --- a/internal/integration_test/integration_test.go +++ b/internal/integration_test/integration_test.go @@ -270,7 +270,7 @@ func (m *fakeUDPMetrics) AddUDPPacketFromTarget(clientInfo ipinfo.IPInfo, access func (m *fakeUDPMetrics) AddUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) { m.natAdded++ } -func (m *fakeUDPMetrics) RemoveUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) { +func (m *fakeUDPMetrics) RemoveUDPNatEntry(clientAddr net.Addr, accessKey string) { // Not tested because it requires waiting for a long timeout. } func (m *fakeUDPMetrics) AddUDPCipherSearch(accessKeyFound bool, timeToCipher time.Duration) {} diff --git a/service/udp.go b/service/udp.go index 2706d26a..1c3a0221 100644 --- a/service/udp.go +++ b/service/udp.go @@ -37,7 +37,7 @@ type UDPMetrics interface { AddUDPPacketFromClient(clientInfo ipinfo.IPInfo, accessKey, status string, clientProxyBytes, proxyTargetBytes int) AddUDPPacketFromTarget(clientInfo ipinfo.IPInfo, accessKey, status string, targetProxyBytes, proxyClientBytes int) AddUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) - RemoveUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) + RemoveUDPNatEntry(clientAddr net.Addr, accessKey string) // Shadowsocks metrics AddUDPCipherSearch(accessKeyFound bool, timeToCipher time.Duration) @@ -361,7 +361,7 @@ func (m *natmap) Add(clientAddr net.Addr, clientConn net.PacketConn, cryptoKey * m.running.Add(1) go func() { timedCopy(clientAddr, clientConn, entry, keyID, m.metrics) - m.metrics.RemoveUDPNatEntry(clientInfo, clientAddr, keyID) + m.metrics.RemoveUDPNatEntry(clientAddr, keyID) if pc := m.del(clientAddr.String()); pc != nil { pc.Close() } @@ -477,6 +477,6 @@ func (m *NoOpUDPMetrics) AddUDPPacketFromTarget(clientInfo ipinfo.IPInfo, access } func (m *NoOpUDPMetrics) AddUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) { } -func (m *NoOpUDPMetrics) RemoveUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) { +func (m *NoOpUDPMetrics) RemoveUDPNatEntry(clientAddr net.Addr, accessKey string) { } func (m *NoOpUDPMetrics) AddUDPCipherSearch(accessKeyFound bool, timeToCipher time.Duration) {} diff --git a/service/udp_test.go b/service/udp_test.go index 9c5c9130..6066f8f6 100644 --- a/service/udp_test.go +++ b/service/udp_test.go @@ -116,7 +116,7 @@ func (m *natTestMetrics) AddUDPPacketFromTarget(clientInfo ipinfo.IPInfo, access func (m *natTestMetrics) AddUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) { m.natEntriesAdded++ } -func (m *natTestMetrics) RemoveUDPNatEntry(clientInfo ipinfo.IPInfo, clientAddr net.Addr, accessKey string) { +func (m *natTestMetrics) RemoveUDPNatEntry(clientAddr net.Addr, accessKey string) { } func (m *natTestMetrics) AddUDPCipherSearch(accessKeyFound bool, timeToCipher time.Duration) {}