Mention run-mtg script

This commit is contained in:
9seconds
2018-06-19 11:25:58 +03:00
parent 9be13fe093
commit a2d0210780
3 changed files with 7 additions and 3 deletions
+4 -3
View File
@@ -24,14 +24,15 @@ func fetchIP(url string) (net.IP, error) {
}
defer resp.Body.Close() // nolint: errcheck
respData, err := ioutil.ReadAll(resp.Body)
respDataBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
respData := strings.TrimSpace(string(respDataBytes))
ip := net.ParseIP(strings.TrimSpace(string(respData)))
ip := net.ParseIP(respData)
if ip == nil {
return nil, errors.Errorf("ifconfig.co returns incorrect IP %s", resp)
return nil, errors.Errorf("ifconfig.co returns incorrect IP %s", respData)
}
return ip, nil