use a more modern writing style to simplify code (#7182)

Signed-off-by: joemicky <joemickychang@outlook.com>
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
joemicky
2025-08-21 02:41:21 +09:00
committed by GitHub
parent b15ed9b084
commit 5125fbed41
11 changed files with 19 additions and 30 deletions

View File

@@ -985,10 +985,10 @@ func trustedRealClientIP(r *http.Request, headers []string, clientIP string) str
// Since there can be many header values, we need to
// join them together before splitting to get the full list
allValues := strings.Split(strings.Join(values, ","), ",")
allValues := strings.SplitSeq(strings.Join(values, ","), ",")
// Get first valid left-most IP address
for _, part := range allValues {
for part := range allValues {
// Some proxies may retain the port number, so split if possible
host, _, err := net.SplitHostPort(part)
if err != nil {