ip/resolver/basic_http/service.go: return error if net.ParseIP() fails.
This commit is contained in:
parent
6df2eb3971
commit
769962f135
1 changed files with 5 additions and 1 deletions
|
|
@ -43,5 +43,9 @@ func (s Service) Lookup() (net.IP, error) {
|
||||||
// Trim spaces and stuff.
|
// Trim spaces and stuff.
|
||||||
ip_str := strings.TrimSpace(string(body))
|
ip_str := strings.TrimSpace(string(body))
|
||||||
|
|
||||||
return net.ParseIP(ip_str), err
|
ip := net.ParseIP(ip_str)
|
||||||
|
if ip == nil {
|
||||||
|
err = fmt.Errorf("Failed to parse ip: %s", ip_str)
|
||||||
|
}
|
||||||
|
return ip, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue