Address issues with IPv6 and QUIC protocol addresses.
This commit is contained in:
parent
a9e53a4a84
commit
2f0580faf3
|
@ -132,6 +132,9 @@ proc getLastSeenAddress(node: BeaconNode, id: PeerId): string =
|
||||||
var temp: seq[tuple[address: MultiAddress, position: int]]
|
var temp: seq[tuple[address: MultiAddress, position: int]]
|
||||||
for address in addresses:
|
for address in addresses:
|
||||||
let res =
|
let res =
|
||||||
|
if TCP.matchPartial(address):
|
||||||
|
# TODO (cheatfate): We match TCP here because `nim-libp2p` do not have
|
||||||
|
# QUIC support yet. So we give TCP addresses priority.
|
||||||
if IP4.matchPartial(address):
|
if IP4.matchPartial(address):
|
||||||
let address4 = address.getProtocolArgument(multiCodec("ip4")).valueOr:
|
let address4 = address.getProtocolArgument(multiCodec("ip4")).valueOr:
|
||||||
continue
|
continue
|
||||||
|
@ -148,7 +151,7 @@ proc getLastSeenAddress(node: BeaconNode, id: PeerId): string =
|
||||||
else:
|
else:
|
||||||
(address, 11)
|
(address, 11)
|
||||||
elif IP6.matchPartial(address):
|
elif IP6.matchPartial(address):
|
||||||
let address6 = address.getProtocolArgument(multiCodec("ip4")).valueOr:
|
let address6 = address.getProtocolArgument(multiCodec("ip6")).valueOr:
|
||||||
continue
|
continue
|
||||||
var ta6 = TransportAddress(family: AddressFamily.IPv4)
|
var ta6 = TransportAddress(family: AddressFamily.IPv4)
|
||||||
ta6.address_v6[0 .. 15] = address6[0 .. 15]
|
ta6.address_v6[0 .. 15] = address6[0 .. 15]
|
||||||
|
@ -164,6 +167,10 @@ proc getLastSeenAddress(node: BeaconNode, id: PeerId): string =
|
||||||
(address, 10)
|
(address, 10)
|
||||||
else:
|
else:
|
||||||
(address, 3)
|
(address, 3)
|
||||||
|
else:
|
||||||
|
# TODO (chatfate): As soon as QUIC protocol will be implemented in
|
||||||
|
# `nim-libp2p` - TCP prioritization should be dropped
|
||||||
|
(address, 3)
|
||||||
temp.add(res)
|
temp.add(res)
|
||||||
|
|
||||||
if len(temp) > 0:
|
if len(temp) > 0:
|
||||||
|
|
Loading…
Reference in New Issue