Skip to content

Commit

Permalink
p2p: handle ip4/6 quic addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumemichel committed Aug 13, 2024
1 parent f3ab1b3 commit 2db0c5c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions p2p/enode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,12 @@ 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 {
n.Load((*enr.QUIC6)(&quic))
}
if !n.ip.IsValid() || n.ip.IsUnspecified() || quic == 0 {
return netip.AddrPort{}, false
}
Expand Down

0 comments on commit 2db0c5c

Please sign in to comment.