From 2952669e97ffa84079c093180dcbe0c9c23520b6 Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Tue, 17 Jun 2025 14:16:59 +0200 Subject: [PATCH] Fix lint --- client/firewall/uspfilter/nat.go | 4 ---- client/firewall/uspfilter/nat_bench_test.go | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/firewall/uspfilter/nat.go b/client/firewall/uspfilter/nat.go index 3d5fd603d..5a077a2c1 100644 --- a/client/firewall/uspfilter/nat.go +++ b/client/firewall/uspfilter/nat.go @@ -120,10 +120,6 @@ func (b *biDNATMap) getOriginal(translated netip.Addr) (netip.Addr, bool) { return original, exists } -func (b *biDNATMap) len() int { - return len(b.forward) -} - func (m *Manager) AddInternalDNATMapping(originalAddr, translatedAddr netip.Addr) error { if !originalAddr.IsValid() || !translatedAddr.IsValid() { return fmt.Errorf("invalid IP addresses") diff --git a/client/firewall/uspfilter/nat_bench_test.go b/client/firewall/uspfilter/nat_bench_test.go index 536fb359a..da322c3ef 100644 --- a/client/firewall/uspfilter/nat_bench_test.go +++ b/client/firewall/uspfilter/nat_bench_test.go @@ -7,6 +7,7 @@ import ( "github.com/google/gopacket" "github.com/google/gopacket/layers" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" log "github.com/sirupsen/logrus" @@ -345,7 +346,8 @@ func BenchmarkDNATMemoryAllocations(b *testing.B) { &d.eth, &d.ip4, &d.ip6, &d.icmp4, &d.icmp6, &d.tcp, &d.udp, ) d.parser.IgnoreUnsupported = true - d.parser.DecodeLayers(testPacket, &d.decoded) + err = d.parser.DecodeLayers(testPacket, &d.decoded) + assert.NoError(b, err) manager.translateOutboundDNAT(testPacket, d) } @@ -373,7 +375,8 @@ func BenchmarkDirectIPExtraction(b *testing.B) { &d.eth, &d.ip4, &d.ip6, &d.icmp4, &d.icmp6, &d.tcp, &d.udp, ) d.parser.IgnoreUnsupported = true - d.parser.DecodeLayers(packet, &d.decoded) + err := d.parser.DecodeLayers(packet, &d.decoded) + assert.NoError(b, err) for i := 0; i < b.N; i++ { // Extract using decoder (traditional method)