mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
p2p: handle ip4/6 quic addresses
This commit is contained in:
parent
f3ab1b3df1
commit
299eff3eb9
1 changed files with 7 additions and 3 deletions
|
|
@ -202,12 +202,16 @@ func (n *Node) TCPEndpoint() (netip.AddrPort, bool) {
|
|||
|
||||
// QUICEndpoint returns the announced QUIC endpoint.
|
||||
func (n *Node) QUICEndpoint() (netip.AddrPort, bool) {
|
||||
var quic enr.QUIC
|
||||
n.Load(&quic)
|
||||
var quic uint16
|
||||
if n.ip.Is4() || n.ip.Is4In6() {
|
||||
n.Load((*enr.QUIC)(&quic))
|
||||
} else if n.ip.Is6() {
|
||||
n.Load((*enr.QUIC6)(&quic))
|
||||
}
|
||||
if !n.ip.IsValid() || n.ip.IsUnspecified() || quic == 0 {
|
||||
return netip.AddrPort{}, false
|
||||
}
|
||||
return netip.AddrPortFrom(n.ip, uint16(quic)), true
|
||||
return netip.AddrPortFrom(n.ip, quic), true
|
||||
}
|
||||
|
||||
// Pubkey returns the secp256k1 public key of the node, if present.
|
||||
|
|
|
|||
Loading…
Reference in a new issue