/// <summary> /// Get domain IP addresses list /// </summary> /// <param name="domainName">domain name</param> /// <exception cref="ArgumentNullException">if domainName is empty</exception> /// <exception cref="ArgumentException">if domainName is invalid</exception> /// <returns>list of IPAddress</returns> public List <IPAddress> GetDomainIPs(string domainName) { if (string.IsNullOrEmpty(domainName)) { throw new ArgumentNullException("domainName"); } var addresses = _sDnsResolver.ResolveHost(domainName); return(addresses); }
/// <summary> /// Queries a dns resolver for IP addresses of a host. /// </summary> /// <param name="resolver"> The resolver instance, that should be used for queries </param> /// <param name="name"> Host name, that should be queried </param> /// <returns> A list of matching host addresses </returns> public static List <IPAddress> ResolveHost(this IDnsResolver resolver, string name) { return(resolver.ResolveHost(DomainName.Parse(name))); }