From aff7c496c2f78cf0a272c45be3bd0183be54df2e Mon Sep 17 00:00:00 2001 From: mathieuHa Date: Thu, 29 Dec 2022 10:30:19 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BRemove=20trailing=20and=20leading?= =?UTF-8?q?=20spaces=20between=20each=20IP=20or=20range=20(#68)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/ip/ip.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/ip/ip.go b/pkg/ip/ip.go index a20f1bd..dccde56 100644 --- a/pkg/ip/ip.go +++ b/pkg/ip/ip.go @@ -24,6 +24,8 @@ func NewChecker(trustedIPs []string) (*Checker, error) { checker := &Checker{} for _, ipMask := range trustedIPs { + // remove leading and trailing spaces + ipMask = strings.TrimSpace(ipMask) if ipAddr := net.ParseIP(ipMask); ipAddr != nil { checker.authorizedIPs = append(checker.authorizedIPs, &ipAddr) logger.Debug(fmt.Sprintf("IP %v is trusted", ipAddr))