From: paladz <453256728@qq.com> Date: Mon, 14 May 2018 06:05:50 +0000 (+0800) Subject: get public ip ignore the ipv6 X-Git-Tag: v1.0.5-alpha~173^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=16013f0ecb08df9e7b3459495b42047999743478;p=bytom%2Fbytom-spv.git get public ip ignore the ipv6 --- diff --git a/p2p/public_ip.go b/p2p/public_ip.go index b8b96039..466641b0 100644 --- a/p2p/public_ip.go +++ b/p2p/public_ip.go @@ -57,7 +57,7 @@ func ipAddress(service string, done chan<- *IpResult) { } address := strings.TrimSpace(string(data)) - if net.ParseIP(address) != nil { + if ip := net.ParseIP(address); ip != nil && ip.To4() != nil { select { case done <- &IpResult{true, address}: return