Added configuration option for external port
This commit is contained in:
parent
537ef30e88
commit
9d2424bd13
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -107,3 +107,5 @@ log/**
|
||||||
cache/**
|
cache/**
|
||||||
|
|
||||||
dev
|
dev
|
||||||
|
|
||||||
|
settings.json
|
|
@ -2,6 +2,8 @@
|
||||||
"client_secret": "nosenpaithisisoursecret",
|
"client_secret": "nosenpaithisisoursecret",
|
||||||
"client_hostname": "0.0.0.0", // "0.0.0.0" is the default and binds to everything
|
"client_hostname": "0.0.0.0", // "0.0.0.0" is the default and binds to everything
|
||||||
"client_port": 443, // 443 is recommended if possible
|
"client_port": 443, // 443 is recommended if possible
|
||||||
|
"client_external_port": 0, //443 is recommended; This port will be send to mdah-backend.
|
||||||
|
//You need to forward this to the client_port in your router; This is optional
|
||||||
"threads": 16,
|
"threads": 16,
|
||||||
"graceful_shutdown_wait_seconds": 60, // Time from graceful shutdown start to force quit
|
"graceful_shutdown_wait_seconds": 60, // Time from graceful shutdown start to force quit
|
||||||
// This rounds down to 15-second increments
|
// This rounds down to 15-second increments
|
||||||
|
|
|
@ -60,7 +60,13 @@ class ServerHandler(private val settings: ClientSettings) {
|
||||||
private fun getPingParams(tlsCreatedAt: String? = null): Map<String, Any> =
|
private fun getPingParams(tlsCreatedAt: String? = null): Map<String, Any> =
|
||||||
mapOf<String, Any>(
|
mapOf<String, Any>(
|
||||||
"secret" to settings.clientSecret,
|
"secret" to settings.clientSecret,
|
||||||
"port" to settings.clientPort,
|
"port" to let {
|
||||||
|
if (settings.clientExternalPort != 0) {
|
||||||
|
settings.clientExternalPort
|
||||||
|
} else {
|
||||||
|
settings.clientPort
|
||||||
|
}
|
||||||
|
},
|
||||||
"disk_space" to settings.maxCacheSizeInMebibytes * 1024 * 1024,
|
"disk_space" to settings.maxCacheSizeInMebibytes * 1024 * 1024,
|
||||||
"network_speed" to settings.maxKilobitsPerSecond * 1000 / 8,
|
"network_speed" to settings.maxKilobitsPerSecond * 1000 / 8,
|
||||||
"build_version" to Constants.CLIENT_BUILD
|
"build_version" to Constants.CLIENT_BUILD
|
||||||
|
@ -107,5 +113,6 @@ class ServerHandler(private val settings: ClientSettings) {
|
||||||
private val STRING_ANY_MAP_LENS = Body.auto<Map<String, Any>>().toLens()
|
private val STRING_ANY_MAP_LENS = Body.auto<Map<String, Any>>().toLens()
|
||||||
private val SERVER_SETTINGS_LENS = Body.auto<ServerSettings>().toLens()
|
private val SERVER_SETTINGS_LENS = Body.auto<ServerSettings>().toLens()
|
||||||
private const val SERVER_ADDRESS = "https://api.mangadex.network/"
|
private const val SERVER_ADDRESS = "https://api.mangadex.network/"
|
||||||
|
//private const val SERVER_ADDRESS = "https://mangadex-test.net/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ data class ClientSettings(
|
||||||
val maxKilobitsPerSecond: Long = 0,
|
val maxKilobitsPerSecond: Long = 0,
|
||||||
val clientHostname: String = "0.0.0.0",
|
val clientHostname: String = "0.0.0.0",
|
||||||
val clientPort: Int = 443,
|
val clientPort: Int = 443,
|
||||||
|
val clientExternalPort: Int = 0,
|
||||||
@field:Secret val clientSecret: String = "PASTE-YOUR-SECRET-HERE",
|
@field:Secret val clientSecret: String = "PASTE-YOUR-SECRET-HERE",
|
||||||
val threads: Int = 4,
|
val threads: Int = 4,
|
||||||
val gracefulShutdownWaitSeconds: Int = 60,
|
val gracefulShutdownWaitSeconds: Int = 60,
|
||||||
|
|
Loading…
Reference in a new issue