fix: временный блок socks 5 hotspot

This commit is contained in:
samosvalishe committed 2026-07-29 03:10:51 +03:00
1 parent e90c5f6770
commit 1460bfb59f
3 files changed
+6 -23

No files matched your search

@@ -1,6 +1,5 @@
package com.freeturn.app.service
import com.freeturn.app.domain.proxy.ProxyServiceState
import com.freeturn.app.domain.proxy.Socks5Server
import android.app.Service
import android.content.Intent
@@ -16,7 +15,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject
/**
@@ -34,7 +32,6 @@ class ProxyService : Service() {
private lateinit var speedMonitor: SpeedMonitor
private val prefs: AppPreferences by inject()
private var socks5Server: Socks5Server? = null
override fun onBind(intent: Intent?): IBinder? = null
@@ -59,20 +56,8 @@ class ProxyService : Service() {
isStopped = { controller.isUserStopped },
onSpeed = { notifier.setSpeed(it) },
)
serviceScope.launch {
prefs.hotspotProxyEnabledFlow.collect { enabled ->
if (enabled) {
if (socks5Server == null) {
socks5Server = Socks5Server()
socks5Server?.start()
}
} else {
socks5Server?.stop()
socks5Server = null
}
}
}
// Socks5Server не поднимаем: свой пакет всегда в ExcludedApplications, исходящие
// сокеты сервера идут мимо туннеля - клиенты хотспота получали бы прямой канал.
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
@@ -127,8 +112,6 @@ class ProxyService : Service() {
notifier.cancelCaptcha()
ProxyServiceState.addLog("Остановка")
controller.destroyProcessAndTunnel()
socks5Server?.stop()
socks5Server = null
serviceScope.cancel()
if (wakeLock?.isHeld == true) wakeLock?.release()
}
@@ -117,7 +117,6 @@ fun AdvancedScreen(
) {
val nerdMode by settingsViewModel.nerdMode.collectAsStateWithLifecycle()
val restartServerOnSwitch by settingsViewModel.restartServerOnSwitch.collectAsStateWithLifecycle()
val hotspotProxyEnabled by settingsViewModel.hotspotProxyEnabled.collectAsStateWithLifecycle()
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
Scaffold(
@@ -160,8 +159,9 @@ fun AdvancedScreen(
title = stringResource(R.string.hotspot_proxy),
subtitle = stringResource(R.string.hotspot_proxy_desc),
iconRes = R.drawable.wifi_tethering_24px,
checked = hotspotProxyEnabled,
onCheckedChange = { settingsViewModel.setHotspotProxyEnabled(it) }
checked = false,
onCheckedChange = {},
enabled = false
)
}
+1 -1
View File
@@ -390,7 +390,7 @@
<string name="nerd_mode">Режим отладки</string>
<string name="nerd_mode_desc">Открывает отладочную информацию: состояние ядра, журнал сервера и подробные логи</string>
<string name="hotspot_proxy">SOCKS5 Hotspot</string>
<string name="hotspot_proxy_desc">Слушать на 0.0.0.0:1080 для раздачи VPN через точку доступа</string>
<string name="hotspot_proxy_desc">Временно недоступно</string>
<string name="restart_server_on_switch">Перезапуск сервера при смене профиля</string>
<string name="restart_server_on_switch_desc">Перезапускать сервер под параметры нового профиля</string>
<string name="nerd_section_title">Отладочная информация</string>