use of co.rsk.net.discovery.PeerExplorer in project rskj by rsksmart.
the class DefaultConfig method peerExplorer.
@Bean
public PeerExplorer peerExplorer(RskSystemProperties rskConfig) {
ECKey key = rskConfig.getMyKey();
Node localNode = new Node(key.getNodeId(), rskConfig.getPublicIp(), rskConfig.getPeerPort());
NodeDistanceTable distanceTable = new NodeDistanceTable(KademliaOptions.BINS, KademliaOptions.BUCKET_SIZE, localNode);
long msgTimeOut = rskConfig.peerDiscoveryMessageTimeOut();
long refreshPeriod = rskConfig.peerDiscoveryRefreshPeriod();
List<String> initialBootNodes = rskConfig.peerDiscoveryIPList();
List<Node> activePeers = rskConfig.peerActive();
if (CollectionUtils.isNotEmpty(activePeers)) {
for (Node n : activePeers) {
InetSocketAddress address = n.getAddress();
initialBootNodes.add(address.getHostName() + ":" + address.getPort());
}
}
return new PeerExplorer(initialBootNodes, localNode, distanceTable, key, msgTimeOut, refreshPeriod);
}
Aggregations