geoblock
geoblock copied to clipboard
Trim ip address before feeding this to the net lib
I noticed the following:
The ip address that traefik passed through to the middleware contained a whitespace.
In geoblock.go at line 459 the addr string is passed untrimmed to the net library.
func parseIP(addr string) (net.IP, error) {
ipAddress := net.ParseIP(addr)
if ipAddress == nil {
return nil, fmt.Errorf("unable parse IP address from address [%s]", addr)
}
return ipAddress, nil
}
This results in the error "unable parse IP address from address..." It wil help us if at this point addr is trimmed off whitespaces.