diff --git a/app/src/main/java/com/freeturn/app/domain/server/ServerCommand.kt b/app/src/main/java/com/freeturn/app/domain/server/ServerCommand.kt index e616017..96fc07f 100644 --- a/app/src/main/java/com/freeturn/app/domain/server/ServerCommand.kt +++ b/app/src/main/java/com/freeturn/app/domain/server/ServerCommand.kt @@ -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-релей (дефолт ядра). */ diff --git a/app/src/main/java/com/freeturn/app/domain/server/ServerSetupRepository.kt b/app/src/main/java/com/freeturn/app/domain/server/ServerSetupRepository.kt index 07faf14..6d7613d 100644 --- a/app/src/main/java/com/freeturn/app/domain/server/ServerSetupRepository.kt +++ b/app/src/main/java/com/freeturn/app/domain/server/ServerSetupRepository.kt @@ -60,6 +60,6 @@ class ServerSetupRepository(context: Context, private val ssh: SSHManager) { ) } - suspend fun start(cfg: SshConfig, opts: ServerOptions): Result = + suspend fun start(cfg: SshConfig, opts: ServerStartOptions): Result = control.run(cfg, ServerCommand.Start(opts)).asUnit() } diff --git a/app/src/main/java/com/freeturn/app/domain/ssh/SshRepository.kt b/app/src/main/java/com/freeturn/app/domain/ssh/SshRepository.kt index f6584b6..66a8509 100644 --- a/app/src/main/java/com/freeturn/app/domain/ssh/SshRepository.kt +++ b/app/src/main/java/com/freeturn/app/domain/ssh/SshRepository.kt @@ -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, diff --git a/app/src/main/java/com/freeturn/app/ui/screens/settings/NerdScreen.kt b/app/src/main/java/com/freeturn/app/ui/screens/settings/NerdScreen.kt index 9763170..eb0e67b 100644 --- a/app/src/main/java/com/freeturn/app/ui/screens/settings/NerdScreen.kt +++ b/app/src/main/java/com/freeturn/app/ui/screens/settings/NerdScreen.kt @@ -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, diff --git a/app/src/main/java/com/freeturn/app/viewmodel/server/ServerSetupViewModel.kt b/app/src/main/java/com/freeturn/app/viewmodel/server/ServerSetupViewModel.kt index 0499539..29dc455 100644 --- a/app/src/main/java/com/freeturn/app/viewmodel/server/ServerSetupViewModel.kt +++ b/app/src/main/java/com/freeturn/app/viewmodel/server/ServerSetupViewModel.kt @@ -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,