Испаравил баг с трекингом страниц

This commit is contained in:
HK committed 2026-06-11 13:35:44 +09:00
1 parent b9ef6dbe1c
commit 8326e5a065
5 files changed
+61 -33

No files matched your search

+7 -15
View File
@@ -7,23 +7,15 @@ namespace CartriX.Api.Classes
public class NetworkHelper
{
public static async Task<string> GetIPFromHostnameAsync(string hostname)
{
try
{
IPAddress[] addresses = Dns.GetHostAddresses(hostname);
{
IPAddress? ipv4 = Dns.GetHostAddresses(hostname)
.FirstOrDefault(a => a.AddressFamily == AddressFamily.InterNetwork);
if (addresses.Length > 0)
{
return addresses[0].ToString();
}
if (ipv4 == null)
throw new Exception("IPv4 адрес не найден.");
return "IP адрес не найден";
}
catch (Exception ex)
{
return $"Ошибка: {ex.Message}";
}
}
return ipv4.ToString();
}
public static async Task<bool> PingHostAsync(string ipAddress)
{
try