mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 11:38:59 +02:00
🐛Remove trailing and leading spaces between each IP or range (#68)
This commit is contained in:
@@ -24,6 +24,8 @@ func NewChecker(trustedIPs []string) (*Checker, error) {
|
|||||||
checker := &Checker{}
|
checker := &Checker{}
|
||||||
|
|
||||||
for _, ipMask := range trustedIPs {
|
for _, ipMask := range trustedIPs {
|
||||||
|
// remove leading and trailing spaces
|
||||||
|
ipMask = strings.TrimSpace(ipMask)
|
||||||
if ipAddr := net.ParseIP(ipMask); ipAddr != nil {
|
if ipAddr := net.ParseIP(ipMask); ipAddr != nil {
|
||||||
checker.authorizedIPs = append(checker.authorizedIPs, &ipAddr)
|
checker.authorizedIPs = append(checker.authorizedIPs, &ipAddr)
|
||||||
logger.Debug(fmt.Sprintf("IP %v is trusted", ipAddr))
|
logger.Debug(fmt.Sprintf("IP %v is trusted", ipAddr))
|
||||||
|
|||||||
Reference in New Issue
Block a user