diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt index 2910d1d5..86a09153 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt @@ -51,7 +51,7 @@ object V2RayServiceManager { set(value) { field = value Seq.setContext(value?.get()?.getService()?.applicationContext) - Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()))//, Utils.getDeviceIdForXUDPBaseKey()) + Libv2ray.initV2Env(Utils.userAssetPath(value?.get()?.getService()), Utils.getDeviceIdForXUDPBaseKey()) } var currentConfig: ServerConfig? = null diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayTestService.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayTestService.kt index c48eeead..6d6dc0aa 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayTestService.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayTestService.kt @@ -24,7 +24,7 @@ class V2RayTestService : Service() { override fun onCreate() { super.onCreate() Seq.setContext(this) - Libv2ray.initV2Env(Utils.userAssetPath(this)) //Utils.getDeviceIdForXUDPBaseKey()) + Libv2ray.initV2Env(Utils.userAssetPath(this), Utils.getDeviceIdForXUDPBaseKey()) } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt index 7400f936..8a132d22 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt @@ -138,12 +138,16 @@ class V2RayVpnService : VpnService(), ServiceControl { } } +// if (settingsStorage?.decodeBool(AppConfig.PREF_LOCAL_DNS_ENABLED) == true) { +// builder.addDnsServer(PRIVATE_VLAN4_ROUTER) +// } else { Utils.getVpnDnsServers() .forEach { if (Utils.isPureIpAddress(it)) { builder.addDnsServer(it) } } +// } builder.setSession(V2RayServiceManager.currentConfig?.remarks.orEmpty()) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/RoutingEditActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/RoutingEditActivity.kt index a2f23254..da155427 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/RoutingEditActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/RoutingEditActivity.kt @@ -2,12 +2,10 @@ package com.v2ray.ang.ui import android.os.Bundle import android.text.TextUtils -import android.util.Log import android.view.Menu import android.view.MenuItem import androidx.appcompat.app.AlertDialog import androidx.lifecycle.lifecycleScope -import com.google.gson.Gson import com.v2ray.ang.R import com.v2ray.ang.databinding.ActivityRoutingEditBinding import com.v2ray.ang.dto.RulesetItem @@ -61,9 +59,9 @@ class RoutingEditActivity : BaseActivity() { val rulesetItem = SettingsManager.getRoutingRuleset(position) ?: RulesetItem() rulesetItem.remarks = binding.etRemarks.text.toString() - binding.etDomain.text.toString().let { rulesetItem.domain = if (it.isEmpty()) null else it.split(',') } - binding.etIp.text.toString().let { rulesetItem.ip = if (it.isEmpty()) null else it.split(',') } - binding.etProtocol.text.toString().let { rulesetItem.protocol = if (it.isEmpty()) null else it.split(',') } + binding.etDomain.text.toString().let { rulesetItem.domain = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } } + binding.etIp.text.toString().let { rulesetItem.ip = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } } + binding.etProtocol.text.toString().let { rulesetItem.protocol = if (it.isEmpty()) null else it.split(",").map { itt -> itt.trim() }.filter { itt -> itt.isNotEmpty() } } binding.etPort.text.toString().let { rulesetItem.port = it.ifEmpty { null } } binding.etNetwork.text.toString().let { rulesetItem.network = it.ifEmpty { null } } rulesetItem.outboundTag = outbound_tag[binding.spOutboundTag.selectedItemPosition]