<PackageReference Include="Relativity.Transfer.Client" Version="7.0.11" />

DnsService

public class DnsService : IDnsService
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Net; namespace Relativity.Transfer { public class DnsService : IDnsService { private readonly ConcurrentDictionary<string, List<string>> dnsIpHostEntryLookup = new ConcurrentDictionary<string, List<string>>(); public IList<string> GetAliases(string hostName) { if (string.IsNullOrEmpty(hostName)) throw new ArgumentNullException("hostName"); string key = hostName.ToUpperInvariant(); List<string> value; try { if (!dnsIpHostEntryLookup.TryGetValue(key, out value)) { IPHostEntry hostByName = Dns.GetHostByName(hostName); value = ((hostByName.Aliases == null || hostByName.Aliases.Length == 0) ? new List<string>() : new List<string>(hostByName.Aliases)); dnsIpHostEntryLookup.TryAdd(key, value); } } catch (Exception) { value = new List<string>(); dnsIpHostEntryLookup.TryAdd(key, value); } return value; } public bool IsBaseOf(Uri serverPath, Uri path) { List<Uri> list = CreateUriPaths(serverPath); List<Uri> list2 = CreateUriPaths(path); foreach (Uri item in list) { foreach (Uri item2 in list2) { if (item.Equals((object)item2) || item.IsBaseOf(item2)) return true; } } return false; } private List<Uri> CreateUriPaths(Uri path) { IList<string> aliases = GetAliases(path.Host); List<Uri> list = new List<Uri> { path }; if (aliases.Count > 0) { string components = path.GetComponents(UriComponents.Path, UriFormat.Unescaped); list.AddRange(from alias in aliases where string.Compare(alias, path.Host, StringComparison.OrdinalIgnoreCase) != 0 select new UriBuilder { Host = alias, Path = components, Scheme = "file" } into builder select builder.Uri); } return list; } } }