fix(share): зашивать потоки и streams-per-cred в freeturn-ссылку
ShareLinkBuilder не заполнял n/spc -> ехали как 0 и выкидывались из JSON; импорт игнорил n. Получатель терял число потоков отправителя.
This commit is contained in:
1 parent
17ba06be8a
commit
089c8291ec
4 files changed
+16
-1
No files matched your search
@@ -5,7 +5,7 @@ data class ClientConfig(
|
||||
val vkLink: String = "",
|
||||
/** Источник TURN-creds (-provider). Пока только "vk". */
|
||||
val provider: String = Provider.VK,
|
||||
val threads: Int = 12,
|
||||
val threads: Int = DEFAULT_THREADS,
|
||||
/** Соответствует флагу `-streams-per-cred` ядра. Дефолт ядра = 10, наш = 12 (= threads). */
|
||||
val streamsPerCred: Int = DEFAULT_STREAMS_PER_CRED,
|
||||
/** TURN-транспорт UDP (-transport udp). false = TCP/TLS (дефолт ядра и наш). */
|
||||
@@ -60,6 +60,7 @@ data class ClientConfig(
|
||||
|
||||
companion object {
|
||||
const val DEFAULT_LOCAL_PORT = "127.0.0.1:9000"
|
||||
const val DEFAULT_THREADS = 12
|
||||
const val DEFAULT_STREAMS_PER_CRED = 12
|
||||
// TURN-релей добавляет overhead - 1280 (минимум IPv6) против фрагментации.
|
||||
const val DEFAULT_WG_MTU = 1280
|
||||
|
||||
@@ -27,6 +27,8 @@ object ShareLinkBuilder {
|
||||
bond = tcpMode && server.client.bond,
|
||||
obfProfile = if (ObfProfile.isValidKey(obfKey)) obfProfile else "",
|
||||
obfKey = if (ObfProfile.isValidKey(obfKey)) obfKey else "",
|
||||
n = server.client.threads,
|
||||
streamsPerCred = server.client.streamsPerCred,
|
||||
clientId = clientId.trim(),
|
||||
name = userName.trim(),
|
||||
wgConf = wgConf?.let(::normalizeConf).orEmpty(),
|
||||
|
||||
@@ -137,6 +137,7 @@ class ImportViewModel(
|
||||
tcpForward = link.mode == "tcp",
|
||||
bond = link.bond,
|
||||
useUdp = link.transport == "udp",
|
||||
threads = link.n.takeIf { it > 0 } ?: ClientConfig.DEFAULT_THREADS,
|
||||
streamsPerCred = link.streamsPerCred.takeIf { it > 0 }
|
||||
?: ClientConfig.DEFAULT_STREAMS_PER_CRED,
|
||||
tunnelTransport = if (wgConf.isNotEmpty()) TunnelTransport.WIREGUARD
|
||||
|
||||
Reference in new issue
Block a user