@@ -103,7 +103,7 @@ object AppConfig {
|
|||||||
const val TG_CHANNEL_URL = "https://t.me/github_2dust"
|
const val TG_CHANNEL_URL = "https://t.me/github_2dust"
|
||||||
const val DELAY_TEST_URL = "https://www.gstatic.com/generate_204"
|
const val DELAY_TEST_URL = "https://www.gstatic.com/generate_204"
|
||||||
const val DELAY_TEST_URL2 = "https://www.google.com/generate_204"
|
const val DELAY_TEST_URL2 = "https://www.google.com/generate_204"
|
||||||
const val IP_API_Url = "https://api.ip.sb/geoip"
|
const val IP_API_URL = "https://speed.cloudflare.com/meta"
|
||||||
|
|
||||||
/** DNS server addresses. */
|
/** DNS server addresses. */
|
||||||
const val DNS_PROXY = "1.1.1.1"
|
const val DNS_PROXY = "1.1.1.1"
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package com.v2ray.ang.dto
|
|||||||
|
|
||||||
data class IPAPIInfo(
|
data class IPAPIInfo(
|
||||||
var ip: String? = null,
|
var ip: String? = null,
|
||||||
var city: String? = null,
|
var clientIp: String? = null,
|
||||||
var region: String? = null,
|
var ip_addr: String? = null,
|
||||||
var region_code: String? = null,
|
var query: String? = null,
|
||||||
var country: String? = null,
|
var country: String? = null,
|
||||||
var country_name: String? = null,
|
var country_name: String? = null,
|
||||||
var country_code: String? = null
|
var country_code: String? = null,
|
||||||
|
var countryCode: String? = null
|
||||||
)
|
)
|
||||||
@@ -168,10 +168,13 @@ object SpeedtestManager {
|
|||||||
|
|
||||||
fun getRemoteIPInfo(): String? {
|
fun getRemoteIPInfo(): String? {
|
||||||
val httpPort = SettingsManager.getHttpPort()
|
val httpPort = SettingsManager.getHttpPort()
|
||||||
var content = HttpUtil.getUrlContent(AppConfig.IP_API_Url, 5000, httpPort) ?: return null
|
var content = HttpUtil.getUrlContent(AppConfig.IP_API_URL, 5000, httpPort) ?: return null
|
||||||
|
|
||||||
var ipInfo = JsonUtil.fromJson(content, IPAPIInfo::class.java) ?: return null
|
var ipInfo = JsonUtil.fromJson(content, IPAPIInfo::class.java) ?: return null
|
||||||
return "(${ipInfo.country_code}) ${ipInfo.ip}"
|
var ip = ipInfo.ip ?: ipInfo.clientIp ?: ipInfo.ip_addr ?: ipInfo.query
|
||||||
|
var country = ipInfo.country_code ?: ipInfo.country ?: ipInfo.countryCode
|
||||||
|
|
||||||
|
return "(${country ?: "unknown"}) $ip"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user