diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/module/TunnelModule.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/module/TunnelModule.kt index bb9eb27..7ed1465 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/module/TunnelModule.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/module/TunnelModule.kt @@ -4,7 +4,9 @@ import android.content.Context import com.wireguard.android.backend.Backend import com.wireguard.android.backend.GoBackend import com.wireguard.android.backend.RootTunnelActionHandler +import com.wireguard.android.backend.WgQuickBackend import com.wireguard.android.util.RootShell +import com.wireguard.android.util.ToolsInstaller import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService import com.zaneschepke.wireguardautotunnel.service.tunnel.WireGuardTunnel @@ -43,8 +45,8 @@ class TunnelModule { @Provides @Singleton @Kernel - fun provideKernelBackend(@ApplicationContext context: Context, rootShell: org.amnezia.awg.util.RootShell): org.amnezia.awg.backend.Backend { - return org.amnezia.awg.backend.AwgQuickBackend(context, rootShell, org.amnezia.awg.util.ToolsInstaller(context, rootShell)) + fun provideKernelBackend(@ApplicationContext context: Context, rootShell: RootShell): Backend { + return WgQuickBackend(context, rootShell, ToolsInstaller(context, rootShell), RootTunnelActionHandler(rootShell)) } @Provides @@ -57,15 +59,13 @@ class TunnelModule { @Singleton fun provideVpnService( amneziaBackend: Provider, - @Userspace userspaceBackend: Provider, - @Kernel kernelBackend: Provider, + @Kernel kernelBackend: Provider, appDataRepository: AppDataRepository, @ApplicationScope applicationScope: CoroutineScope, @IoDispatcher ioDispatcher: CoroutineDispatcher, ): TunnelService { return WireGuardTunnel( amneziaBackend, - userspaceBackend, kernelBackend, appDataRepository, applicationScope, diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/tunnel/WireGuardTunnel.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/tunnel/WireGuardTunnel.kt index c510ad1..faa6208 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/tunnel/WireGuardTunnel.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/tunnel/WireGuardTunnel.kt @@ -32,8 +32,7 @@ class WireGuardTunnel @Inject constructor( private val amneziaBackend: Provider, - @Userspace private val userspaceBackend: Provider, - @Kernel private val kernelBackend: Provider, + @Kernel private val kernelBackend: Provider, private val appDataRepository: AppDataRepository, @ApplicationScope private val applicationScope: CoroutineScope, @IoDispatcher private val ioDispatcher: CoroutineDispatcher, @@ -78,8 +77,7 @@ constructor( private suspend fun backend(): Any { val settings = appDataRepository.settings.getSettings() if (settings.isKernelEnabled) return kernelBackend.get() - if (settings.isAmneziaEnabled) return amneziaBackend.get() - return userspaceBackend.get() + return amneziaBackend.get() } override suspend fun startTunnel(tunnelConfig: TunnelConfig): Result { diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt index ce573e9..b49a58e 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt @@ -491,20 +491,6 @@ fun SettingsScreen( title = stringResource(id = R.string.backend), padding = screenPadding, ) - ConfigurationToggle( - stringResource(R.string.use_amnezia), - enabled = - !( - uiState.settings.isAutoTunnelEnabled || - uiState.settings.isAlwaysOnVpnEnabled || - (uiState.vpnState.status == TunnelState.UP) || uiState.settings.isKernelEnabled - ), - checked = uiState.settings.isAmneziaEnabled, - padding = screenPadding, - onCheckChanged = { - viewModel.onToggleAmnezia() - }, - ) ConfigurationToggle( stringResource(R.string.use_kernel), enabled = diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 66f5548..15ae102 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ espressoCore = "3.6.1" hiltAndroid = "2.52" hiltNavigationCompose = "1.2.0" junit = "4.13.2" -kotlinx-serialization-json = "1.7.2" +kotlinx-serialization-json = "1.7.3" lifecycle-runtime-compose = "2.8.6" material3 = "1.3.0" navigationCompose = "2.8.1"