org.tron.p2p.discover.NodeManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of libp2p Show documentation
Show all versions of libp2p Show documentation
libp2p is a p2p network SDK implemented in java language.
The newest version!
package org.tron.p2p.discover;
import java.util.List;
import org.tron.p2p.discover.protocol.kad.KadService;
import org.tron.p2p.discover.socket.DiscoverServer;
public class NodeManager {
private static DiscoverService discoverService;
private static DiscoverServer discoverServer;
public static void init() {
discoverServer = new DiscoverServer();
discoverService = new KadService();
discoverService.init();
discoverServer.init(discoverService);
}
public static void close() {
if (discoverService != null) {
discoverService.close();
}
if (discoverServer != null) {
discoverServer.close();
}
}
public static List getConnectableNodes() {
return discoverService.getConnectableNodes();
}
public static List getTableNodes() {
return discoverService.getTableNodes();
}
public static List getAllNodes() {
return discoverService.getAllNodes();
}
}