コード例 #1
0
        /// <summary>
        /// Queries the corresponding Internet Registry about an IP Address.
        /// </summary>
        /// <param name="Address">IP Address to query</param>
        /// <returns>WHOIS Information, if available, null if not.</returns>
        public static async Task <string> Query(IPAddress Address)
        {
            switch (Address.AddressFamily)
            {
            case AddressFamily.InterNetwork:
                byte[] Bytes = Address.GetAddressBytes();
                byte   b     = Bytes[0];

                if (b >= ipv4ToWhoIsService.Length)
                {
                    return(null);
                }

                WhoIsIpv4ServiceEnum Service = ipv4ToWhoIsService[b];
                string InternetRegistry      = ipv4WhoIsServices[(int)Service];

                using (WhoIsClient Client = new WhoIsClient())
                {
                    return(await Client.DoQuery(InternetRegistry, Address.ToString()));
                }

            default:
                return(null);
            }
        }
コード例 #2
0
 /// <summary>
 /// Queries an Internet Registry about an entity.
 /// </summary>
 /// <param name="InternetRegistry">Domain name of Internet Registry to query.</param>
 /// <param name="Entity">Entity to be queried.</param>
 /// <returns>WHOIS Information</returns>
 public static async Task <string> Query(string InternetRegistry, string Entity)
 {
     using (WhoIsClient Client = new WhoIsClient())
     {
         return(await Client.DoQuery(InternetRegistry, Entity));
     }
 }