diff --git a/build.gradle b/build.gradle index 2011e42..0256cd4 100644 --- a/build.gradle +++ b/build.gradle @@ -21,13 +21,16 @@ version '0.1' repositories { mavenCentral() + maven { + url 'http://tomp2p.net/dev/mvn/' + } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation fileTree(include: ['*.jar'], dir: 'libs/tomp2p') + implementation 'net.tomp2p:tomp2p-all:5.0-Beta8' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - implementation 'org.slf4j:slf4j-log4j12:+' + implementation 'org.slf4j:slf4j-log4j12:1.7.26' } compileKotlin { diff --git a/libs/tomp2p-all-5.0-Beta8.jar b/libs/tomp2p-all-5.0-Beta8.jar deleted file mode 100644 index f9b158d..0000000 Binary files a/libs/tomp2p-all-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/gcm-server-1.0.2.jar b/libs/tomp2p/gcm-server-1.0.2.jar deleted file mode 100644 index 0554b24..0000000 Binary files a/libs/tomp2p/gcm-server-1.0.2.jar and /dev/null differ diff --git a/libs/tomp2p/json-simple-1.1.jar b/libs/tomp2p/json-simple-1.1.jar deleted file mode 100644 index f395f41..0000000 Binary files a/libs/tomp2p/json-simple-1.1.jar and /dev/null differ diff --git a/libs/tomp2p/netty-buffer-4.0.28.Final.jar b/libs/tomp2p/netty-buffer-4.0.28.Final.jar deleted file mode 100644 index 89265f4..0000000 Binary files a/libs/tomp2p/netty-buffer-4.0.28.Final.jar and /dev/null differ diff --git a/libs/tomp2p/netty-common-4.0.28.Final.jar b/libs/tomp2p/netty-common-4.0.28.Final.jar deleted file mode 100644 index a86716e..0000000 Binary files a/libs/tomp2p/netty-common-4.0.28.Final.jar and /dev/null differ diff --git a/libs/tomp2p/netty-transport-4.0.28.Final.jar b/libs/tomp2p/netty-transport-4.0.28.Final.jar deleted file mode 100644 index 50a9e5f..0000000 Binary files a/libs/tomp2p/netty-transport-4.0.28.Final.jar and /dev/null differ diff --git a/libs/tomp2p/slf4j-api-1.7.5.jar b/libs/tomp2p/slf4j-api-1.7.5.jar deleted file mode 100644 index 8f004d3..0000000 Binary files a/libs/tomp2p/slf4j-api-1.7.5.jar and /dev/null differ diff --git a/libs/tomp2p/tomp2p-all-5.0-Beta8.jar b/libs/tomp2p/tomp2p-all-5.0-Beta8.jar deleted file mode 100644 index f9b158d..0000000 Binary files a/libs/tomp2p/tomp2p-all-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/tomp2p-android-5.0-Beta8.jar b/libs/tomp2p/tomp2p-android-5.0-Beta8.jar deleted file mode 100644 index 3851393..0000000 Binary files a/libs/tomp2p/tomp2p-android-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/tomp2p-core-5.0-Beta8.jar b/libs/tomp2p/tomp2p-core-5.0-Beta8.jar deleted file mode 100644 index 83e3296..0000000 Binary files a/libs/tomp2p/tomp2p-core-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/tomp2p-dht-5.0-Beta8.jar b/libs/tomp2p/tomp2p-dht-5.0-Beta8.jar deleted file mode 100644 index 2649756..0000000 Binary files a/libs/tomp2p/tomp2p-dht-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/tomp2p-nat-5.0-Beta8.jar b/libs/tomp2p/tomp2p-nat-5.0-Beta8.jar deleted file mode 100644 index e424314..0000000 Binary files a/libs/tomp2p/tomp2p-nat-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/tomp2p-replication-5.0-Beta8.jar b/libs/tomp2p/tomp2p-replication-5.0-Beta8.jar deleted file mode 100644 index 0998fe2..0000000 Binary files a/libs/tomp2p/tomp2p-replication-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/tomp2p-tracker-5.0-Beta8.jar b/libs/tomp2p/tomp2p-tracker-5.0-Beta8.jar deleted file mode 100644 index 50a792b..0000000 Binary files a/libs/tomp2p/tomp2p-tracker-5.0-Beta8.jar and /dev/null differ diff --git a/libs/tomp2p/weupnp-0.1.2.jar b/libs/tomp2p/weupnp-0.1.2.jar deleted file mode 100644 index 43daf9f..0000000 Binary files a/libs/tomp2p/weupnp-0.1.2.jar and /dev/null differ diff --git a/src/main/kotlin/io/github/chronosx88/dhtBootstrap/Main.kt b/src/main/kotlin/io/github/chronosx88/dhtBootstrap/Main.kt index 0899dcc..f67190f 100644 --- a/src/main/kotlin/io/github/chronosx88/dhtBootstrap/Main.kt +++ b/src/main/kotlin/io/github/chronosx88/dhtBootstrap/Main.kt @@ -1,5 +1,7 @@ import io.github.chronosx88.dhtBootstrap.StorageBerkeleyDB -import net.tomp2p.connection.DSASignatureFactory +import net.tomp2p.connection.Bindings +import net.tomp2p.connection.ChannelClientConfiguration +import net.tomp2p.connection.RSASignatureFactory import net.tomp2p.dht.PeerBuilderDHT import net.tomp2p.dht.PeerDHT import net.tomp2p.nat.PeerBuilderNAT @@ -12,6 +14,7 @@ import java.io.File import java.io.FileInputStream import java.io.FileWriter import java.io.IOException +import java.net.InetSocketAddress import java.util.* @@ -46,16 +49,20 @@ fun main() { peerID = Number160.createHash(props!!.getProperty("peerID")) try { - peerDHT = PeerBuilderDHT(PeerBuilder(peerID).ports(7243).start()) - .storage( - StorageBerkeleyDB( - peerID!!, - File(DATA_DIR_PATH), - DSASignatureFactory() - ) - ).start() + peerDHT = PeerBuilderDHT( + PeerBuilder(peerID) + .ports(7243) + .channelClientConfiguration(createChannelClientConfig()) + .start() + ).storage( + StorageBerkeleyDB( + peerID!!, + File(DATA_DIR_PATH), + RSASignatureFactory() + ) + ).start() PeerBuilderNAT(peerDHT!!.peer()) - .addRelayServerConfiguration(RelayType.OPENTCP, TCPRelayServerConfig()) + .addRelayServerConfiguration(RelayType.BUFFERED_OPENTCP, TCPRelayServerConfig()) .start() } catch (e: IOException) { e.printStackTrace() @@ -64,3 +71,17 @@ fun main() { val replication = AutoReplication(peerDHT!!.peer()) replication.start() } + +fun createChannelClientConfig() : ChannelClientConfiguration { + val channelClientConfiguration = ChannelClientConfiguration() + channelClientConfiguration.bindings(Bindings()) + channelClientConfiguration.maxPermitsPermanentTCP(250) + channelClientConfiguration.maxPermitsTCP(250) + channelClientConfiguration.maxPermitsUDP(250) + channelClientConfiguration.pipelineFilter(PeerBuilder.DefaultPipelineFilter()) + channelClientConfiguration.signatureFactory(RSASignatureFactory()) + channelClientConfiguration.senderTCP(InetSocketAddress(0).address) + channelClientConfiguration.senderUDP(InetSocketAddress(0).address) + channelClientConfiguration.byteBufPool(false) + return channelClientConfiguration +}