From 40584f91539d65e698b7838b172fcb053ae2d385 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Fri, 29 May 2026 14:15:25 +0200 Subject: [PATCH] chore: simplify + modernize (Go 1.26) Review findings: - resolveIP XFF: replace strings.Index + dead `len(fwd) X-Real-Ip } else if fwd := headers.Get(xrip); fwd != "" { return fwd @@ -174,12 +165,3 @@ func (p *Plugin) resolveIP(headers http.Header) string { return "" } - -func inc(ip net.IP) { - for j := len(ip) - 1; j >= 0; j-- { - ip[j]++ - if ip[j] > 0 { - break - } - } -} diff --git a/trusted_test.go b/trusted_test.go index fc1bdde..6ee735e 100644 --- a/trusted_test.go +++ b/trusted_test.go @@ -62,3 +62,12 @@ func TestCidrsInRange(t *testing.T) { require.Len(t, addrs, 1024) } + +func inc(ip net.IP) { + for j := len(ip) - 1; j >= 0; j-- { + ip[j]++ + if ip[j] > 0 { + break + } + } +}