Bootstrap peer start added

This commit is contained in:
ChronosX88 2019-03-05 21:14:21 +04:00
parent 9179cf6fb3
commit b903f9cc63
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -1,19 +1,35 @@
package io.github.chronosx88.dhtBootstrap;
import net.tomp2p.connection.RSASignatureFactory;
import net.tomp2p.dht.PeerBuilderDHT;
import net.tomp2p.dht.PeerDHT;
import net.tomp2p.p2p.PeerBuilder;
import net.tomp2p.peers.Number160;
import net.tomp2p.storage.StorageDisk;
import java.io.File;
import java.io.IOException;
import java.net.Inet4Address;
import java.util.UUID;
public class Main {
//private static JKademliaNode node;
private static PeerDHT peerDHT;
private static Number160 peerID;
public static void main(String[] args) {
/*
//TODO: Save peerID and route table to config
peerID = Number160.createHash(UUID.randomUUID().toString());
try {
KademliaId kadID = new KademliaId("sgCZ+fg49g4N8FU43kW84cNVPTw=");
node = new JKademliaNode("Main Bootstrap Node", new Node(kadID, Inet4Address.getLocalHost(), 7243), 7243, new DefaultConfiguration());
System.out.println(node.getNode().getNodeId().toString());
peerDHT =
new PeerBuilderDHT(new PeerBuilder(peerID).ports(7243).start())
.storage(
new StorageDisk(
peerID,
new File(System.getProperty("user.home") + "/.local/share"),
new RSASignatureFactory()
)
).start();
} catch (IOException e) {
e.printStackTrace();
}
*/
}
}