🐛 fix all incoherence (#71)

* 🐛 fix all incoherence

* 🐛 fix comment + lint
This commit is contained in:
maxlerebourg
2022-12-31 11:15:36 +01:00
committed by GitHub
parent 041b0f67b7
commit 8f937d22a2
3 changed files with 47 additions and 109 deletions
+2 -3
View File
@@ -23,9 +23,8 @@ type Checker struct {
func NewChecker(trustedIPs []string) (*Checker, error) {
checker := &Checker{}
for _, ipMask := range trustedIPs {
// remove leading and trailing spaces
ipMask = strings.TrimSpace(ipMask)
for _, ipMaskRaw := range trustedIPs {
ipMask := strings.TrimSpace(ipMaskRaw)
if ipAddr := net.ParseIP(ipMask); ipAddr != nil {
checker.authorizedIPs = append(checker.authorizedIPs, &ipAddr)
logger.Debug(fmt.Sprintf("IP %v is trusted", ipAddr))