mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-07 22:28:07 +03:00
feat: update node IP and delay info on connect (#10050)
* feat: update node IP and delay info on connect * Adjust --------- Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -324,20 +324,32 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
SetDefaultServerRequested.Publish(SelectedServer.ID);
|
||||
}
|
||||
|
||||
public async Task TestServerAvailability()
|
||||
public async Task<AvailabilityCheckResult?> TestServerAvailability()
|
||||
{
|
||||
var item = await ConfigHandler.GetDefaultServer(_config);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
await TestServerAvailabilitySub(ResUI.Speedtesting);
|
||||
|
||||
var msg = await Task.Run(ConnectionHandler.RunAvailabilityCheck);
|
||||
var result = await Task.Run(ConnectionHandler.RunAvailabilityCheck);
|
||||
var msg = string.Format(ResUI.TestMeOutput, result.Time, result.Ip);
|
||||
|
||||
var ip = result.GetValidIp();
|
||||
if (ip.IsNotEmpty())
|
||||
{
|
||||
ProfileExManager.Instance.SetTestIpInfo(item.IndexId, ip);
|
||||
}
|
||||
if (result.Time > 0)
|
||||
{
|
||||
ProfileExManager.Instance.SetTestDelay(item.IndexId, result.Time);
|
||||
}
|
||||
|
||||
NoticeManager.Instance.SendMessageEx(msg);
|
||||
await TestServerAvailabilitySub(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task TestServerAvailabilitySub(string msg)
|
||||
|
||||
Reference in New Issue
Block a user