in remoteip/parser.go [105:124]
func (p *RemoteIPParser) parseIPsFromHeader(header string) []string {
if header == "" {
return []string{}
}
// Trim the header and split by commas or whitespace
parts := strings.FieldsFunc(strings.TrimSpace(header), func(r rune) bool {
return r == ',' || unicode.IsSpace(r)
})
ips := make([]string, 0, len(parts))
for _, part := range parts {
// Try to parse the IP (this also handles cleaning)
if ip := p.parseIP(part); ip != "" {
ips = append(ips, ip)
}
}
return ips
}