Deleted patched TomP2P (unnecessary), some tweaks in ChannelClientConfig

This commit is contained in:
ChronosX88 2019-04-10 18:20:25 +04:00
parent 2e048e6642
commit 9326565280
17 changed files with 36 additions and 12 deletions

View File

@ -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 {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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
}