Fix CrowdSec review findings: observe metadata, idempotent Start, HasRestrictions, proto map alias

This commit is contained in:
Viktor Liu
2026-03-29 08:50:34 +02:00
parent ae84272a30
commit 6411136fec
6 changed files with 25 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ package crowdsec
import (
"context"
"errors"
"net/netip"
"strings"
"sync"
@@ -83,6 +84,11 @@ func (b *Bouncer) Start(ctx context.Context) error {
done := make(chan struct{})
b.lifeMu.Lock()
if b.cancel != nil {
b.lifeMu.Unlock()
cancel()
return errors.New("bouncer already started")
}
b.cancel = cancel
b.done = done
b.lifeMu.Unlock()