fix ipv6 support with port splitting
This commit is contained in:
parent
236c82e272
commit
978d541503
|
@ -138,15 +138,7 @@ func (p *provider) retrieveSubdomainIP(addr string) (string, error) {
|
|||
return "", fmt.Errorf("%v: %v", utils.ErrIpLenght, ips)
|
||||
}
|
||||
|
||||
ip := ips[0].String()
|
||||
if strings.Contains(ip, ":") {
|
||||
ip, _, err = net.SplitHostPort(ip)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("%v: %v", utils.ErrSplitAddr, ip)
|
||||
}
|
||||
}
|
||||
|
||||
return ip, nil
|
||||
return ips[0].String(), nil
|
||||
}
|
||||
|
||||
func (p *provider) checkResponse(body []byte, tokenBased bool, ip string) error {
|
||||
|
|
|
@ -120,7 +120,7 @@ func (w *watcher) retrieveServerIP() (string, error) {
|
|||
}
|
||||
|
||||
var ip string
|
||||
if rsp.Header.Get("content-type") == "application/json" {
|
||||
if strings.Contains(rsp.Header.Get("content-type"), "application/json") {
|
||||
body := make(map[string]interface{})
|
||||
if err := json.Unmarshal(b, &body); err != nil {
|
||||
return "", fmt.Errorf("failed to unmarshal JSON body: %v", err)
|
||||
|
|
Loading…
Reference in New Issue