refactor(server): переименовать ServerOptions -> ServerStartOptions

Разводит с data-классом ServerOpts.
This commit is contained in:
samosvalishe committed 2026-06-14 11:57:28 +03:00
1 parent 5ac680505c
commit 09b86de69f
5 files changed
+9 -9

No files matched your search

@@ -11,7 +11,7 @@ sealed class ServerCommand {
val endpoint: String,
val adopt: Boolean = false
) : ServerCommand()
data class Start(val opts: ServerOptions) : ServerCommand()
data class Start(val opts: ServerStartOptions) : ServerCommand()
data object Stop : ServerCommand()
data class FetchLogs(val lines: Int = 80) : ServerCommand()
@@ -85,7 +85,7 @@ sealed class ServerCommand {
}
}
data class ServerOptions(
data class ServerStartOptions(
val listen: String,
val connect: String,
/** true -> -mode tcp (TCP-форвард). false -> udp-релей (дефолт ядра). */
@@ -60,6 +60,6 @@ class ServerSetupRepository(context: Context, private val ssh: SSHManager) {
)
}
suspend fun start(cfg: SshConfig, opts: ServerOptions): Result<Unit> =
suspend fun start(cfg: SshConfig, opts: ServerStartOptions): Result<Unit> =
control.run(cfg, ServerCommand.Start(opts)).asUnit()
}
@@ -7,7 +7,7 @@ import com.freeturn.app.domain.SshConnectionState
import com.freeturn.app.domain.server.CmdResult
import com.freeturn.app.domain.server.ServerCommand
import com.freeturn.app.domain.server.ServerControl
import com.freeturn.app.domain.server.ServerOptions
import com.freeturn.app.domain.server.ServerStartOptions
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@@ -200,7 +200,7 @@ class SshRepository(
val result = runCmd(
cfg, "Запуск",
ServerCommand.Start(
ServerOptions(
ServerStartOptions(
listen = listen,
connect = connect,
tcpMode = tcpMode,
@@ -41,7 +41,7 @@ import com.freeturn.app.data.CoreArgs
import com.freeturn.app.data.config.ObfProfile
import com.freeturn.app.data.server.Server
import com.freeturn.app.domain.server.ServerCommand
import com.freeturn.app.domain.server.ServerOptions
import com.freeturn.app.domain.server.ServerStartOptions
import com.freeturn.app.data.HapticUtil
import com.freeturn.app.ui.components.SettingsBackButton
import com.freeturn.app.ui.components.SettingsContentMaxWidth
@@ -310,7 +310,7 @@ private fun clientCommandLine(server: Server, privacy: Boolean): String {
/** Командная строка серверного ядра (как уходит по SSH в free-turn-control.sh). */
private fun serverCommandLine(server: Server, privacy: Boolean): String {
val opts = ServerOptions(
val opts = ServerStartOptions(
listen = server.proxyListen,
connect = server.proxyConnect,
tcpMode = server.client.tcpForward,
@@ -12,7 +12,7 @@ import com.freeturn.app.data.config.SshConfig
import com.freeturn.app.data.config.TunnelTransport
import com.freeturn.app.domain.proxy.ProxyOrchestrator
import com.freeturn.app.domain.server.ServerSetupRepository
import com.freeturn.app.domain.server.ServerOptions
import com.freeturn.app.domain.server.ServerStartOptions
import com.freeturn.app.data.HapticUtil
import com.freeturn.app.viewmodel.uiError
import kotlinx.coroutines.Job
@@ -319,7 +319,7 @@ class ServerSetupViewModel(
val obfOn = c.obfProfile != ObfProfile.NONE
repo.start(
cfg,
ServerOptions(
ServerStartOptions(
listen = "0.0.0.0:${c.listenPort}",
connect = "127.0.0.1:$backendPort",
tcpMode = !c.vpnMode && c.backendTcp,