mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
ipv6 address used as extip results in 127.0.0.1
This commit is contained in:
parent
d35a62e05a
commit
7b5fceb603
1 changed files with 6 additions and 3 deletions
|
|
@ -99,6 +99,7 @@ func (n *Node) Load(k enr.Entry) error {
|
|||
return n.r.Load(k)
|
||||
}
|
||||
|
||||
// IP returns the IP address of the node. This prefers IPv4 addresses.
|
||||
// IP returns the IP address of the node. This prefers IPv4 addresses.
|
||||
func (n *Node) IP() net.IP {
|
||||
var (
|
||||
|
|
@ -114,13 +115,15 @@ func (n *Node) IP() net.IP {
|
|||
if n.Load(&ip6) == nil {
|
||||
return net.IP(ip6)
|
||||
}
|
||||
if ipv4Addr := net.IP(ip4); ipv4Addr.IsLoopback() {
|
||||
return ipv4Addr
|
||||
if n.Load(&ip4) == nil {
|
||||
ipv4Addr := net.IP(ip4)
|
||||
if ipv4Addr.IsLoopback() {
|
||||
return ipv4Addr
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// UDP returns the UDP port of the node.
|
||||
func (n *Node) UDP() int {
|
||||
var port enr.UDP
|
||||
|
|
|
|||
Loading…
Reference in a new issue