improve mycelium argument

This commit is contained in:
2026-04-14 11:36:11 +02:00
parent 13633f092a
commit bbb5c6e886
13 changed files with 454 additions and 228 deletions
+39
View File
@@ -0,0 +1,39 @@
type FirewallConntrack struct {
sync.Mutex
Conns map[firewall.Packet]*conn
TimerWheel *TimerWheel[firewall.Packet]
}
func (f *Firewall) inConns(
fp firewall.Packet, h *HostInfo,
caPool *cert.CAPool,
localCache firewall.ConntrackCache,
) bool {
if localCache != nil {
if _, ok := localCache[fp]; ok {
return true
}
}
conntrack := f.Conntrack
conntrack.Lock()
// Purge every time we test
ep, has := conntrack.TimerWheel.Purge()
if has {
f.evict(ep)
}
c, ok := conntrack.Conns[fp]
if !ok {
conntrack.Unlock()
return false
}
// ... update expiry ...
conntrack.Unlock()
if localCache != nil {
localCache[fp] = struct{}{}
}
return true
}