diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index d0b03774..cb2382d4 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -20,6 +20,7 @@ public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases"; public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/"; public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-{0}/{1}.srs"; + public const string IPAPIUrl = "https://ipapi.co/json"; public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw="; public const string ConfigFileName = "guiNConfig.json"; diff --git a/v2rayN/ServiceLib/Models/IPAPIInfo.cs b/v2rayN/ServiceLib/Models/IPAPIInfo.cs new file mode 100644 index 00000000..07259d95 --- /dev/null +++ b/v2rayN/ServiceLib/Models/IPAPIInfo.cs @@ -0,0 +1,13 @@ +namespace ServiceLib.Models +{ + internal class IPAPIInfo + { + public string? ip { get; set; } + public string? city { get; set; } + public string? region { get; set; } + public string? region_code { get; set; } + public string? country { get; set; } + public string? country_name { get; set; } + public string? country_code { get; set; } + } +} \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index a439d7c0..ea43a4ef 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -3644,7 +3644,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 The ping of current service: {0} ms 的本地化字符串。 + /// 查找类似 The delay : {0} ms, {1} 的本地化字符串。 /// public static string TestMeOutput { get { diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 937d107f..f940823c 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -302,7 +302,7 @@ اسکن URL وارد کردن با موفقیت - پینگ سرویس فعلی: {0} ms + پینگ سرویس فعلی: {0} ms, {1} موفقیت عملیات diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index af6a2c9e..95a85755 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -302,7 +302,7 @@ Scan import the shared link successfully - The ping of current service: {0} ms + The delay : {0} ms, {1} Operation success diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 8758825c..4637717e 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -302,7 +302,7 @@ Сканирование URL-адреса импорта успешна. - Задержка текущего сервера: {0} мс + Задержка текущего сервера: {0} мс, {1} Операция успешна diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index c281a4ad..61c72dc5 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -302,7 +302,7 @@ 扫描导入分享链接成功 - 当前服务的真连接延迟: {0} ms + 当前延迟: {0} ms,{1} 操作成功 diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 2d18ce2e..3d6e9777 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -301,7 +301,7 @@ 掃描匯入分享链接成功 - 目前服務的真連線延遲: {0} ms + 目前延遲: {0} ms,{1} 操作成功 diff --git a/v2rayN/ServiceLib/Services/UpdateService.cs b/v2rayN/ServiceLib/Services/UpdateService.cs index 4eafc5c4..6474db7c 100644 --- a/v2rayN/ServiceLib/Services/UpdateService.cs +++ b/v2rayN/ServiceLib/Services/UpdateService.cs @@ -244,8 +244,17 @@ namespace ServiceLib.Services public async Task RunAvailabilityCheck(Action updateFunc) { - var time = await new DownloadService().RunAvailabilityCheck(null); - updateFunc?.Invoke(false, string.Format(ResUI.TestMeOutput, time)); + var downloadHandle = new DownloadService(); + var time = await downloadHandle.RunAvailabilityCheck(null); + var ip = Global.None; + if (time > 0) + { + var result = await downloadHandle.TryDownloadString(Global.IPAPIUrl, true, "ipapi"); + var ipInfo = JsonUtils.Deserialize(result); + ip = $"({ipInfo?.country}) {ipInfo?.ip}"; + } + + updateFunc?.Invoke(false, string.Format(ResUI.TestMeOutput, time, ip)); } #region CheckUpdate private