diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt index cf2cb340..f7d9db93 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt @@ -100,6 +100,7 @@ object AppConfig { const val GeoUrl = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/" const val TgChannelUrl = "https://t.me/github_2dust" const val DelayTestUrl = "https://www.gstatic.com/generate_204" + const val DelayTestUrl2 = "https://www.google.com/generate_204" const val DNS_PROXY = "1.1.1.1" const val DNS_DIRECT = "223.5.5.5" 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 243d8c2e..0f605ead 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 @@ -248,6 +248,14 @@ object V2RayServiceManager { Log.d(ANG_PACKAGE, "measureV2rayDelay: $e") errstr = e.message?.substringAfter("\":") ?: "empty message" } + if (time == -1L) { + try { + time = v2rayPoint.measureDelay(Utils.getDelayTestUrl(true)) + } catch (e: Exception) { + Log.d(ANG_PACKAGE, "measureV2rayDelay: $e") + errstr = e.message?.substringAfter("\":") ?: "empty message" + } + } } val result = if (time == -1L) { service.getString(R.string.connection_test_error, errstr) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt index b16ca78c..3e589f3e 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt @@ -445,5 +445,14 @@ object Utils { val url = settingsStorage.decodeString(AppConfig.PREF_DELAY_TEST_URL) return if (url.isNullOrEmpty()) AppConfig.DelayTestUrl else url } + + fun getDelayTestUrl(second: Boolean = false): String { + return if (second) { + AppConfig.DelayTestUrl2 + } else { + val url = settingsStorage.decodeString(AppConfig.PREF_DELAY_TEST_URL) + if (url.isNullOrEmpty()) AppConfig.DelayTestUrl else url + } + } }