mirror of
https://github.com/caddyserver/caddy.git
synced 2026-01-17 01:30:34 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user