mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 11:38:59 +02:00
Add logic return to bypass when IP is unfiltered, update documentation
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/logger"
|
||||
)
|
||||
|
||||
// CHECKER
|
||||
@@ -27,6 +29,7 @@ func NewChecker(trustedIPs []string) (*Checker, error) {
|
||||
for _, ipMask := range trustedIPs {
|
||||
if ipAddr := net.ParseIP(ipMask); ipAddr != nil {
|
||||
checker.authorizedIPs = append(checker.authorizedIPs, &ipAddr)
|
||||
logger.Debug(fmt.Sprintf("IP %v is trusted", ipAddr))
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -35,6 +38,7 @@ func NewChecker(trustedIPs []string) (*Checker, error) {
|
||||
return nil, fmt.Errorf("parsing CIDR trusted IPs %s: %w", ipAddr, err)
|
||||
}
|
||||
checker.authorizedIPsNet = append(checker.authorizedIPsNet, ipAddr)
|
||||
logger.Debug(fmt.Sprintf("IP network %v is trusted", ipAddr))
|
||||
}
|
||||
|
||||
return checker, nil
|
||||
|
||||
Reference in New Issue
Block a user