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)
|
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.
|
// IP returns the IP address of the node. This prefers IPv4 addresses.
|
||||||
func (n *Node) IP() net.IP {
|
func (n *Node) IP() net.IP {
|
||||||
var (
|
var (
|
||||||
|
|
@ -114,13 +115,15 @@ func (n *Node) IP() net.IP {
|
||||||
if n.Load(&ip6) == nil {
|
if n.Load(&ip6) == nil {
|
||||||
return net.IP(ip6)
|
return net.IP(ip6)
|
||||||
}
|
}
|
||||||
if ipv4Addr := net.IP(ip4); ipv4Addr.IsLoopback() {
|
if n.Load(&ip4) == nil {
|
||||||
|
ipv4Addr := net.IP(ip4)
|
||||||
|
if ipv4Addr.IsLoopback() {
|
||||||
return ipv4Addr
|
return ipv4Addr
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// UDP returns the UDP port of the node.
|
// UDP returns the UDP port of the node.
|
||||||
func (n *Node) UDP() int {
|
func (n *Node) UDP() int {
|
||||||
var port enr.UDP
|
var port enr.UDP
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue