diff options
22 files changed, 111 insertions, 105 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectActionButton.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectActionButton.kt index b778f15774..ae731b4161 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectActionButton.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectActionButton.kt @@ -2,8 +2,8 @@ package net.mullvad.mullvadvpn import android.view.View import android.widget.Button -import net.mullvad.mullvadvpn.model.ActionAfterDisconnect import net.mullvad.mullvadvpn.model.TunnelState +import net.mullvad.talpid.tunnel.ActionAfterDisconnect class ConnectActionButton(val parentView: View) { private val button: Button = parentView.findViewById(R.id.action_button) diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectionStatus.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectionStatus.kt index a56852bc59..17f44a64da 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectionStatus.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ConnectionStatus.kt @@ -3,8 +3,8 @@ package net.mullvad.mullvadvpn import android.content.res.Resources import android.view.View import android.widget.TextView -import net.mullvad.mullvadvpn.model.ActionAfterDisconnect import net.mullvad.mullvadvpn.model.TunnelState +import net.mullvad.talpid.tunnel.ActionAfterDisconnect class ConnectionStatus(val parentView: View, val resources: Resources) { private val spinner: View = parentView.findViewById(R.id.connecting_spinner) diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ForegroundNotificationManager.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ForegroundNotificationManager.kt index d317274f09..c99d8d7a0d 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ForegroundNotificationManager.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ForegroundNotificationManager.kt @@ -12,8 +12,8 @@ import android.content.IntentFilter import android.os.Build import android.support.v4.app.NotificationCompat import net.mullvad.mullvadvpn.dataproxy.ConnectionProxy -import net.mullvad.mullvadvpn.model.ActionAfterDisconnect import net.mullvad.mullvadvpn.model.TunnelState +import net.mullvad.talpid.tunnel.ActionAfterDisconnect val CHANNEL_ID = "vpn_tunnel_status" val FOREGROUND_NOTIFICATION_ID: Int = 1 diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt index 113b416195..9278bb315f 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/LocationInfo.kt @@ -3,10 +3,10 @@ package net.mullvad.mullvadvpn import android.content.Context import android.view.View import android.widget.TextView -import net.mullvad.mullvadvpn.model.Endpoint import net.mullvad.mullvadvpn.model.GeoIpLocation -import net.mullvad.mullvadvpn.model.TransportProtocol import net.mullvad.mullvadvpn.model.TunnelState +import net.mullvad.talpid.net.Endpoint +import net.mullvad.talpid.net.TransportProtocol class LocationInfo(val parentView: View, val context: Context) { private val country: TextView = parentView.findViewById(R.id.country) diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/MullvadVpnService.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/MullvadVpnService.kt index 388e4c0a5d..67fe711a6c 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/MullvadVpnService.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/MullvadVpnService.kt @@ -1,7 +1,6 @@ package net.mullvad.mullvadvpn import android.content.Intent -import android.net.VpnService import android.os.Binder import android.os.IBinder import kotlinx.coroutines.CompletableDeferred @@ -11,9 +10,9 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.async import kotlinx.coroutines.runBlocking import net.mullvad.mullvadvpn.dataproxy.ConnectionProxy -import net.mullvad.mullvadvpn.model.TunConfig +import net.mullvad.talpid.TalpidVpnService -class MullvadVpnService : VpnService() { +class MullvadVpnService : TalpidVpnService() { private val binder = LocalBinder() private val created = CompletableDeferred<Unit>() @@ -50,32 +49,6 @@ class MullvadVpnService : VpnService() { created.cancel() } - fun createTun(config: TunConfig): Int { - val builder = Builder().apply { - for (address in config.addresses) { - addAddress(address, 32) - } - - for (dnsServer in config.dnsServers) { - addDnsServer(dnsServer) - } - - for (route in config.routes) { - addRoute(route.address, route.prefixLength.toInt()) - } - - setMtu(config.mtu) - } - - val vpnInterface = builder.establish() - - return vpnInterface.detachFd() - } - - fun bypass(socket: Int): Boolean { - return protect(socket) - } - inner class LocalBinder : Binder() { val daemon get() = this@MullvadVpnService.daemon diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt index 1a3d7afb43..352fe4dd71 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt @@ -13,12 +13,12 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.launch import net.mullvad.mullvadvpn.dataproxy.AppVersionInfoCache import net.mullvad.mullvadvpn.dataproxy.WwwAuthTokenRetriever -import net.mullvad.mullvadvpn.model.ActionAfterDisconnect -import net.mullvad.mullvadvpn.model.BlockReason import net.mullvad.mullvadvpn.model.KeygenEvent import net.mullvad.mullvadvpn.model.KeygenFailure -import net.mullvad.mullvadvpn.model.ParameterGenerationError import net.mullvad.mullvadvpn.model.TunnelState +import net.mullvad.talpid.tunnel.ActionAfterDisconnect +import net.mullvad.talpid.tunnel.BlockReason +import net.mullvad.talpid.tunnel.ParameterGenerationError class NotificationBanner( val parentView: View, diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt index 89a79ba839..f6561e4da1 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt @@ -10,9 +10,9 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.Job import kotlinx.coroutines.launch -import net.mullvad.mullvadvpn.model.ActionAfterDisconnect import net.mullvad.mullvadvpn.model.TunnelState import net.mullvad.mullvadvpn.relaylist.RelayItem +import net.mullvad.talpid.tunnel.ActionAfterDisconnect class SwitchLocationButton(val parentView: View, val resources: Resources) { private val button: Button = parentView.findViewById(R.id.switch_location) diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/ConnectionProxy.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/ConnectionProxy.kt index c26a5bb5e6..06c594ed1c 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/ConnectionProxy.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/ConnectionProxy.kt @@ -12,9 +12,9 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.launch import net.mullvad.mullvadvpn.MainActivity import net.mullvad.mullvadvpn.MullvadDaemon -import net.mullvad.mullvadvpn.model.ActionAfterDisconnect import net.mullvad.mullvadvpn.model.TunnelState import net.mullvad.mullvadvpn.util.EventNotifier +import net.mullvad.talpid.tunnel.ActionAfterDisconnect val ANTICIPATED_STATE_TIMEOUT_MS = 1500L diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt index e1082d81bc..94444c5d46 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/LocationInfoCache.kt @@ -7,12 +7,12 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.async import kotlinx.coroutines.launch import net.mullvad.mullvadvpn.MullvadDaemon -import net.mullvad.mullvadvpn.model.ActionAfterDisconnect import net.mullvad.mullvadvpn.model.GeoIpLocation import net.mullvad.mullvadvpn.model.TunnelState import net.mullvad.mullvadvpn.relaylist.Relay import net.mullvad.mullvadvpn.relaylist.RelayCity import net.mullvad.mullvadvpn.relaylist.RelayCountry +import net.mullvad.talpid.tunnel.ActionAfterDisconnect class LocationInfoCache( val daemon: Deferred<MullvadDaemon>, diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt index 33a40f7196..040c4997c9 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt @@ -1,5 +1,9 @@ package net.mullvad.mullvadvpn.model +import net.mullvad.talpid.net.TunnelEndpoint +import net.mullvad.talpid.tunnel.ActionAfterDisconnect +import net.mullvad.talpid.tunnel.BlockReason + sealed class TunnelState() { class Disconnected() : TunnelState() class Connecting(val endpoint: TunnelEndpoint?, val location: GeoIpLocation?) : TunnelState() diff --git a/android/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt b/android/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt new file mode 100644 index 0000000000..96de4082cc --- /dev/null +++ b/android/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt @@ -0,0 +1,32 @@ +package net.mullvad.talpid + +import android.net.VpnService +import net.mullvad.talpid.tun_provider.TunConfig + +open class TalpidVpnService : VpnService() { + fun createTun(config: TunConfig): Int { + val builder = Builder().apply { + for (address in config.addresses) { + addAddress(address, 32) + } + + for (dnsServer in config.dnsServers) { + addDnsServer(dnsServer) + } + + for (route in config.routes) { + addRoute(route.address, route.prefixLength.toInt()) + } + + setMtu(config.mtu) + } + + val vpnInterface = builder.establish() + + return vpnInterface.detachFd() + } + + fun bypass(socket: Int): Boolean { + return protect(socket) + } +} diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/Endpoint.kt b/android/src/main/kotlin/net/mullvad/talpid/net/Endpoint.kt index bf1ca2cad4..7baeb66161 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/Endpoint.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/net/Endpoint.kt @@ -1,4 +1,4 @@ -package net.mullvad.mullvadvpn.model +package net.mullvad.talpid.net import java.net.InetSocketAddress diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TransportProtocol.kt b/android/src/main/kotlin/net/mullvad/talpid/net/TransportProtocol.kt index 185461cda7..d4372f54ed 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TransportProtocol.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/net/TransportProtocol.kt @@ -1,4 +1,4 @@ -package net.mullvad.mullvadvpn.model +package net.mullvad.talpid.net sealed class TransportProtocol { class Tcp : TransportProtocol() diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelEndpoint.kt b/android/src/main/kotlin/net/mullvad/talpid/net/TunnelEndpoint.kt index f064218215..138ab57cc6 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelEndpoint.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/net/TunnelEndpoint.kt @@ -1,3 +1,3 @@ -package net.mullvad.mullvadvpn.model +package net.mullvad.talpid.net data class TunnelEndpoint(val endpoint: Endpoint) diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/InetNetwork.kt b/android/src/main/kotlin/net/mullvad/talpid/tun_provider/InetNetwork.kt index eb3030880f..9b133d352b 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/InetNetwork.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/tun_provider/InetNetwork.kt @@ -1,4 +1,4 @@ -package net.mullvad.mullvadvpn.model +package net.mullvad.talpid.tun_provider import java.net.InetAddress diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunConfig.kt b/android/src/main/kotlin/net/mullvad/talpid/tun_provider/TunConfig.kt index 929e03b99a..fe8d0f55c7 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/TunConfig.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/tun_provider/TunConfig.kt @@ -1,4 +1,4 @@ -package net.mullvad.mullvadvpn.model +package net.mullvad.talpid.tun_provider import java.net.InetAddress diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/ActionAfterDisconnect.kt b/android/src/main/kotlin/net/mullvad/talpid/tunnel/ActionAfterDisconnect.kt index f39ba030fc..c352ab06ad 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/ActionAfterDisconnect.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/tunnel/ActionAfterDisconnect.kt @@ -1,4 +1,4 @@ -package net.mullvad.mullvadvpn.model +package net.mullvad.talpid.tunnel sealed class ActionAfterDisconnect { class Nothing : ActionAfterDisconnect() diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/BlockReason.kt b/android/src/main/kotlin/net/mullvad/talpid/tunnel/BlockReason.kt index ae4d392fc2..758e81dfba 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/BlockReason.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/tunnel/BlockReason.kt @@ -1,4 +1,4 @@ -package net.mullvad.mullvadvpn.model +package net.mullvad.talpid.tunnel sealed class BlockReason { class AuthFailed(val reason: String?) : BlockReason() @@ -10,10 +10,3 @@ sealed class BlockReason { class IsOffline : BlockReason() class TapAdapterProblem : BlockReason() } - -sealed class ParameterGenerationError { - class NoMatchingRelay : ParameterGenerationError() - class NoMatchingBridgeRelay : ParameterGenerationError() - class NoWireguardKey : ParameterGenerationError() - class CustomTunnelHostResultionError : ParameterGenerationError() -} diff --git a/android/src/main/kotlin/net/mullvad/talpid/tunnel/ParameterGenerationError.kt b/android/src/main/kotlin/net/mullvad/talpid/tunnel/ParameterGenerationError.kt new file mode 100644 index 0000000000..92547a02b4 --- /dev/null +++ b/android/src/main/kotlin/net/mullvad/talpid/tunnel/ParameterGenerationError.kt @@ -0,0 +1,8 @@ +package net.mullvad.talpid.tunnel + +sealed class ParameterGenerationError { + class NoMatchingRelay : ParameterGenerationError() + class NoMatchingBridgeRelay : ParameterGenerationError() + class NoWireguardKey : ParameterGenerationError() + class CustomTunnelHostResultionError : ParameterGenerationError() +} diff --git a/mullvad-jni/src/into_java.rs b/mullvad-jni/src/into_java.rs index a013f98d30..bc97ac4bc0 100644 --- a/mullvad-jni/src/into_java.rs +++ b/mullvad-jni/src/into_java.rs @@ -189,7 +189,7 @@ impl<'env> IntoJava<'env> for IpNetwork { type JavaType = JObject<'env>; fn into_java(self, env: &JNIEnv<'env>) -> Self::JavaType { - let class = get_class("net/mullvad/mullvadvpn/model/InetNetwork"); + let class = get_class("net/mullvad/talpid/tun_provider/InetNetwork"); let address = env.auto_local(self.ip().into_java(env)); let prefix_length = self.prefix() as jshort; let parameters = [ @@ -261,7 +261,7 @@ impl<'env> IntoJava<'env> for TunConfig { type JavaType = JObject<'env>; fn into_java(self, env: &JNIEnv<'env>) -> Self::JavaType { - let class = get_class("net/mullvad/mullvadvpn/model/TunConfig"); + let class = get_class("net/mullvad/talpid/tun_provider/TunConfig"); let addresses = env.auto_local(self.addresses.into_java(env)); let dns_servers = env.auto_local(self.dns_servers.into_java(env)); let routes = env.auto_local(self.routes.into_java(env)); @@ -287,8 +287,8 @@ impl<'env> IntoJava<'env> for TransportProtocol { fn into_java(self, env: &JNIEnv<'env>) -> Self::JavaType { let class_name = match self { - TransportProtocol::Tcp => "net/mullvad/mullvadvpn/model/TransportProtocol$Tcp", - TransportProtocol::Udp => "net/mullvad/mullvadvpn/model/TransportProtocol$Udp", + TransportProtocol::Tcp => "net/mullvad/talpid/net/TransportProtocol$Tcp", + TransportProtocol::Udp => "net/mullvad/talpid/net/TransportProtocol$Udp", }; let class = get_class(class_name); @@ -301,7 +301,7 @@ impl<'env> IntoJava<'env> for Endpoint { type JavaType = JObject<'env>; fn into_java(self, env: &JNIEnv<'env>) -> Self::JavaType { - let class = get_class("net/mullvad/mullvadvpn/model/Endpoint"); + let class = get_class("net/mullvad/talpid/net/Endpoint"); let address = env.auto_local(self.address.into_java(env)); let protocol = env.auto_local(self.protocol.into_java(env)); let parameters = [ @@ -311,7 +311,7 @@ impl<'env> IntoJava<'env> for Endpoint { env.new_object( &class, - "(Ljava/net/InetSocketAddress;Lnet/mullvad/mullvadvpn/model/TransportProtocol;)V", + "(Ljava/net/InetSocketAddress;Lnet/mullvad/talpid/net/TransportProtocol;)V", ¶meters, ) .expect("Failed to create Endpoint sub-class variant Java object") @@ -322,16 +322,12 @@ impl<'env> IntoJava<'env> for TunnelEndpoint { type JavaType = JObject<'env>; fn into_java(self, env: &JNIEnv<'env>) -> Self::JavaType { - let class = get_class("net/mullvad/mullvadvpn/model/TunnelEndpoint"); + let class = get_class("net/mullvad/talpid/net/TunnelEndpoint"); let endpoint = env.auto_local(self.endpoint.into_java(env)); let parameters = [JValue::Object(endpoint.as_obj())]; - env.new_object( - &class, - "(Lnet/mullvad/mullvadvpn/model/Endpoint;)V", - ¶meters, - ) - .expect("Failed to create TunnelEndpoint sub-class variant Java object") + env.new_object(&class, "(Lnet/mullvad/talpid/net/Endpoint;)V", ¶meters) + .expect("Failed to create TunnelEndpoint sub-class variant Java object") } } @@ -644,7 +640,7 @@ impl<'env> IntoJava<'env> for ActionAfterDisconnect { ActionAfterDisconnect::Reconnect => "Reconnect", }; let class_name = format!( - "net/mullvad/mullvadvpn/model/ActionAfterDisconnect${}", + "net/mullvad/talpid/tunnel/ActionAfterDisconnect${}", variant ); let class = get_class(&class_name); @@ -660,7 +656,7 @@ impl<'env> IntoJava<'env> for BlockReason { fn into_java(self, env: &JNIEnv<'env>) -> Self::JavaType { let variant = match self { BlockReason::AuthFailed(reason) => { - let class = get_class("net/mullvad/mullvadvpn/model/BlockReason$AuthFailed"); + let class = get_class("net/mullvad/talpid/tunnel/BlockReason$AuthFailed"); let reason = env.auto_local(JObject::from(reason.into_java(env))); let parameters = [JValue::Object(reason.as_obj())]; @@ -673,14 +669,13 @@ impl<'env> IntoJava<'env> for BlockReason { BlockReason::SetDnsError => "SetDnsError", BlockReason::StartTunnelError => "StartTunnelError", BlockReason::TunnelParameterError(reason) => { - let class = - get_class("net/mullvad/mullvadvpn/model/BlockReason$ParameterGeneration"); + let class = get_class("net/mullvad/talpid/tunnel/BlockReason$ParameterGeneration"); let reason = env.auto_local(JObject::from(reason.into_java(env))); let parameters = [JValue::Object(reason.as_obj())]; return env .new_object( &class, - "(Lnet/mullvad/mullvadvpn/model/ParameterGenerationError;)V", + "(Lnet/mullvad/talpid/tunnel/ParameterGenerationError;)V", ¶meters, ) .expect("Failed to create BlockReason.ParameterGeneration Java object"); @@ -688,7 +683,7 @@ impl<'env> IntoJava<'env> for BlockReason { BlockReason::IsOffline => "IsOffline", BlockReason::TapAdapterProblem => "TapAdapterProblem", }; - let class_name = format!("net/mullvad/mullvadvpn/model/BlockReason${}", variant); + let class_name = format!("net/mullvad/talpid/tunnel/BlockReason${}", variant); let class = get_class(&class_name); env.new_object(&class, "()V", &[]) @@ -709,7 +704,7 @@ impl<'env> IntoJava<'env> for ParameterGenerationError { } }; let class_name = format!( - "net/mullvad/mullvadvpn/model/ParameterGenerationError${}", + "net/mullvad/talpid/tunnel/ParameterGenerationError${}", class_variant ); let class = get_class(&class_name); @@ -737,7 +732,7 @@ impl<'env> IntoJava<'env> for TunnelState { JValue::Object(location.as_obj()), ]; let signature = - "(Lnet/mullvad/mullvadvpn/model/TunnelEndpoint;Lnet/mullvad/mullvadvpn/model/GeoIpLocation;)V"; + "(Lnet/mullvad/talpid/net/TunnelEndpoint;Lnet/mullvad/mullvadvpn/model/GeoIpLocation;)V"; env.new_object(&class, signature, ¶meters) } @@ -750,7 +745,7 @@ impl<'env> IntoJava<'env> for TunnelState { JValue::Object(location.as_obj()), ]; let signature = - "(Lnet/mullvad/mullvadvpn/model/TunnelEndpoint;Lnet/mullvad/mullvadvpn/model/GeoIpLocation;)V"; + "(Lnet/mullvad/talpid/net/TunnelEndpoint;Lnet/mullvad/mullvadvpn/model/GeoIpLocation;)V"; env.new_object(&class, signature, ¶meters) } @@ -758,7 +753,7 @@ impl<'env> IntoJava<'env> for TunnelState { let class = get_class("net/mullvad/mullvadvpn/model/TunnelState$Disconnecting"); let after_disconnect = env.auto_local(action_after_disconnect.into_java(env)); let parameters = [JValue::Object(after_disconnect.as_obj())]; - let signature = "(Lnet/mullvad/mullvadvpn/model/ActionAfterDisconnect;)V"; + let signature = "(Lnet/mullvad/talpid/tunnel/ActionAfterDisconnect;)V"; env.new_object(&class, signature, ¶meters) } @@ -766,7 +761,7 @@ impl<'env> IntoJava<'env> for TunnelState { let class = get_class("net/mullvad/mullvadvpn/model/TunnelState$Blocked"); let reason = env.auto_local(block_reason.into_java(env)); let parameters = [JValue::Object(reason.as_obj())]; - let signature = "(Lnet/mullvad/mullvadvpn/model/BlockReason;)V"; + let signature = "(Lnet/mullvad/talpid/tunnel/BlockReason;)V"; env.new_object(&class, signature, ¶meters) } diff --git a/mullvad-jni/src/lib.rs b/mullvad-jni/src/lib.rs index 049657bbb9..11c4d8b7e7 100644 --- a/mullvad-jni/src/lib.rs +++ b/mullvad-jni/src/lib.rs @@ -35,27 +35,14 @@ const CLASSES_TO_LOAD: &[&str] = &[ "java/net/InetSocketAddress", "java/util/ArrayList", "net/mullvad/mullvadvpn/model/AccountData", - "net/mullvad/mullvadvpn/model/ActionAfterDisconnect$Block", - "net/mullvad/mullvadvpn/model/ActionAfterDisconnect$Nothing", - "net/mullvad/mullvadvpn/model/ActionAfterDisconnect$Reconnect", - "net/mullvad/mullvadvpn/model/BlockReason$AuthFailed", - "net/mullvad/mullvadvpn/model/BlockReason$Ipv6Unavailable", - "net/mullvad/mullvadvpn/model/BlockReason$SetFirewallPolicyError", - "net/mullvad/mullvadvpn/model/BlockReason$SetDnsError", - "net/mullvad/mullvadvpn/model/BlockReason$StartTunnelError", - "net/mullvad/mullvadvpn/model/BlockReason$ParameterGeneration", - "net/mullvad/mullvadvpn/model/BlockReason$IsOffline", - "net/mullvad/mullvadvpn/model/BlockReason$TapAdapterProblem", "net/mullvad/mullvadvpn/model/AppVersionInfo", "net/mullvad/mullvadvpn/model/Constraint$Any", "net/mullvad/mullvadvpn/model/Constraint$Only", - "net/mullvad/mullvadvpn/model/Endpoint", "net/mullvad/mullvadvpn/model/GeoIpLocation", "net/mullvad/mullvadvpn/model/GetAccountDataResult$Ok", "net/mullvad/mullvadvpn/model/GetAccountDataResult$InvalidAccount", "net/mullvad/mullvadvpn/model/GetAccountDataResult$RpcError", "net/mullvad/mullvadvpn/model/GetAccountDataResult$OtherError", - "net/mullvad/mullvadvpn/model/InetNetwork", "net/mullvad/mullvadvpn/model/KeygenEvent$NewKey", "net/mullvad/mullvadvpn/model/KeygenEvent$Failure", "net/mullvad/mullvadvpn/model/KeygenFailure$TooManyKeys", @@ -63,10 +50,6 @@ const CLASSES_TO_LOAD: &[&str] = &[ "net/mullvad/mullvadvpn/model/LocationConstraint$City", "net/mullvad/mullvadvpn/model/LocationConstraint$Country", "net/mullvad/mullvadvpn/model/LocationConstraint$Hostname", - "net/mullvad/mullvadvpn/model/ParameterGenerationError$NoMatchingRelay", - "net/mullvad/mullvadvpn/model/ParameterGenerationError$NoMatchingBridgeRelay", - "net/mullvad/mullvadvpn/model/ParameterGenerationError$NoWireguardKey", - "net/mullvad/mullvadvpn/model/ParameterGenerationError$CustomTunnelHostResultionError", "net/mullvad/mullvadvpn/model/PublicKey", "net/mullvad/mullvadvpn/model/Relay", "net/mullvad/mullvadvpn/model/RelayList", @@ -77,10 +60,6 @@ const CLASSES_TO_LOAD: &[&str] = &[ "net/mullvad/mullvadvpn/model/RelaySettingsUpdate$CustomTunnelEndpoint", "net/mullvad/mullvadvpn/model/RelaySettingsUpdate$RelayConstraintsUpdate", "net/mullvad/mullvadvpn/model/Settings", - "net/mullvad/mullvadvpn/model/TransportProtocol$Tcp", - "net/mullvad/mullvadvpn/model/TransportProtocol$Udp", - "net/mullvad/mullvadvpn/model/TunConfig", - "net/mullvad/mullvadvpn/model/TunnelEndpoint", "net/mullvad/mullvadvpn/model/TunnelState$Blocked", "net/mullvad/mullvadvpn/model/TunnelState$Connected", "net/mullvad/mullvadvpn/model/TunnelState$Connecting", @@ -88,6 +67,28 @@ const CLASSES_TO_LOAD: &[&str] = &[ "net/mullvad/mullvadvpn/model/TunnelState$Disconnecting", "net/mullvad/mullvadvpn/MullvadDaemon", "net/mullvad/mullvadvpn/MullvadVpnService", + "net/mullvad/talpid/net/Endpoint", + "net/mullvad/talpid/net/TransportProtocol$Tcp", + "net/mullvad/talpid/net/TransportProtocol$Udp", + "net/mullvad/talpid/net/TunnelEndpoint", + "net/mullvad/talpid/tun_provider/InetNetwork", + "net/mullvad/talpid/tun_provider/TunConfig", + "net/mullvad/talpid/tunnel/ActionAfterDisconnect$Block", + "net/mullvad/talpid/tunnel/ActionAfterDisconnect$Nothing", + "net/mullvad/talpid/tunnel/ActionAfterDisconnect$Reconnect", + "net/mullvad/talpid/tunnel/BlockReason$AuthFailed", + "net/mullvad/talpid/tunnel/BlockReason$Ipv6Unavailable", + "net/mullvad/talpid/tunnel/BlockReason$SetFirewallPolicyError", + "net/mullvad/talpid/tunnel/BlockReason$SetDnsError", + "net/mullvad/talpid/tunnel/BlockReason$StartTunnelError", + "net/mullvad/talpid/tunnel/BlockReason$ParameterGeneration", + "net/mullvad/talpid/tunnel/BlockReason$IsOffline", + "net/mullvad/talpid/tunnel/BlockReason$TapAdapterProblem", + "net/mullvad/talpid/tunnel/ParameterGenerationError$NoMatchingRelay", + "net/mullvad/talpid/tunnel/ParameterGenerationError$NoMatchingBridgeRelay", + "net/mullvad/talpid/tunnel/ParameterGenerationError$NoWireguardKey", + "net/mullvad/talpid/tunnel/ParameterGenerationError$CustomTunnelHostResultionError", + "net/mullvad/talpid/TalpidVpnService", ]; lazy_static! { diff --git a/mullvad-jni/src/vpn_service_tun_provider.rs b/mullvad-jni/src/vpn_service_tun_provider.rs index 68021ac8cd..35ca55c300 100644 --- a/mullvad-jni/src/vpn_service_tun_provider.rs +++ b/mullvad-jni/src/vpn_service_tun_provider.rs @@ -25,23 +25,23 @@ pub enum Error { #[error(display = "Failed to allow socket to bypass tunnel")] Bypass, - #[error(display = "Failed to call Java method MullvadVpnService.{}", _0)] + #[error(display = "Failed to call Java method TalpidVpnService.{}", _0)] CallMethod(&'static str, #[error(source)] jni::errors::Error), #[error(display = "Failed to create Java VM handle clone")] CloneJavaVm(#[error(source)] jni::errors::Error), - #[error(display = "Failed to create global reference to MullvadVpnService instance")] + #[error(display = "Failed to create global reference to TalpidVpnService instance")] CreateGlobalReference(#[error(source)] jni::errors::Error), - #[error(display = "Failed to find MullvadVpnService.{} method", _0)] + #[error(display = "Failed to find TalpidVpnService.{} method", _0)] FindMethod(&'static str, #[error(source)] jni::errors::Error), #[error(display = "Failed to get Java VM instance")] GetJvmInstance(#[error(source)] jni::errors::Error), #[error( - display = "Received an invalid result from MullvadVpnService.{}: {}", + display = "Received an invalid result from TalpidVpnService.{}: {}", _0, _1 )] @@ -61,7 +61,7 @@ impl VpnServiceTunProvider { /// Create a new VpnServiceTunProvider interfacing with Android's VpnService. pub fn new(env: &JNIEnv, mullvad_vpn_service: &JObject) -> Result<Self, Error> { let jvm = env.get_java_vm().map_err(Error::GetJvmInstance)?; - let class = get_class("net/mullvad/mullvadvpn/MullvadVpnService"); + let class = get_class("net/mullvad/talpid/TalpidVpnService"); let object = env .new_global_ref(*mullvad_vpn_service) .map_err(Error::CreateGlobalReference)?; @@ -111,7 +111,7 @@ impl VpnServiceTunProvider { .get_method_id( &self.class, "createTun", - "(Lnet/mullvad/mullvadvpn/model/TunConfig;)I", + "(Lnet/mullvad/talpid/tun_provider/TunConfig;)I", ) .map_err(|cause| Error::FindMethod("createTun", cause))?; |
