1
0
Fork 0
mirror of https://gitlab.com/pnx-tools/dns-updater.git synced 2026-06-16 05:54:56 +02:00

ip/resolver/basic_http/service.go: return error if net.ParseIP() fails.

This commit is contained in:
Henrik Hautakoski 2023-12-01 21:51:58 +01:00
parent 6df2eb3971
commit 769962f135

View file

@ -43,5 +43,9 @@ func (s Service) Lookup() (net.IP, error) {
// Trim spaces and stuff.
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
}