Skip to content

Commit

Permalink
Dial all addrs in kademlia.
Browse files Browse the repository at this point in the history
We could reach a node on the public dht via a local network address.
  • Loading branch information
ianopolous committed Jul 11, 2023
1 parent 6a4671b commit 4a7ae3e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/peergos/protocol/dht/Kademlia.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ private Multiaddr[] getPublic(PeerAddresses target) {
}

private CompletableFuture<? extends KademliaController> dialPeer(PeerAddresses target, Host us) {
Multiaddr[] multiaddrs = getPublic(target);
Multiaddr[] multiaddrs = target.addresses.stream()
.map(a -> Multiaddr.fromString(a.toString()))
.collect(Collectors.toList()).toArray(new Multiaddr[0]);
return dial(us, PeerId.fromBase58(target.peerId.toBase58()), multiaddrs).getController();
}

Expand Down

0 comments on commit 4a7ae3e

Please sign in to comment.