all: use bart.Lite instead of bart.Table where appropriate

When we don't care about the payload value and are just checking whether
a set contains an IP/prefix, we can use `bart.Lite` for the same lookup
times but a lower memory footprint.

Fixes #19075

Change-Id: Ia709e8b718666cc61ea56eac1066467ae0b6e86c
Signed-off-by: Alex Chan <alexc@tailscale.com>
This commit is contained in:
Alex Chan
2026-03-23 15:22:17 +00:00
committed by Alex Chan
parent 44ec71cf94
commit 1d0fde6fc2
4 changed files with 16 additions and 26 deletions
+5 -5
View File
@@ -268,13 +268,13 @@ func TestDNSResponse(t *testing.T) {
},
},
},
ignoreDsts: &bart.Table[bool]{},
ignoreDsts: &bart.Lite{},
routes: routes,
v6ULA: v6ULA,
ipPool: &ippool.SingleMachineIPPool{IPSet: addrPool},
dnsAddr: dnsAddr,
}
c.ignoreDsts.Insert(netip.MustParsePrefix("8.8.4.4/32"), true)
c.ignoreDsts.Insert(netip.MustParsePrefix("8.8.4.4/32"))
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
@@ -411,9 +411,9 @@ func TestDNSResponse(t *testing.T) {
}
func TestIgnoreDestination(t *testing.T) {
ignoreDstTable := &bart.Table[bool]{}
ignoreDstTable.Insert(netip.MustParsePrefix("192.168.1.0/24"), true)
ignoreDstTable.Insert(netip.MustParsePrefix("10.0.0.0/8"), true)
ignoreDstTable := &bart.Lite{}
ignoreDstTable.Insert(netip.MustParsePrefix("192.168.1.0/24"))
ignoreDstTable.Insert(netip.MustParsePrefix("10.0.0.0/8"))
c := &connector{
ignoreDsts: ignoreDstTable,