Resolver is the main class to do DNS query lookups
Beispiel #1
0
        /// <summary>
        /// Checks if a domain exists in the DNS server's cache
        /// </summary>
        /// <params>
        /// <param name="dnsIp">DNS server's IP address</param>
        /// <param name="query">Query to be executed</param>
        /// </params>
        /// <returns>True if it exists</returns>
        private bool ExistsInDnsServerCache(string dnsIp, string query)
        {
            var r = new Heijden.DNS.Resolver(dnsIp)
            {
                Recursion = false
            };

            if (r.Query(query, Heijden.DNS.QType.A, Heijden.DNS.QClass.IN).Answers.Count > 0)
            {
                Found?.Invoke(query, null);
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 public Address()
 {
     _resolver = new Resolver("8.8.8.8") {UseCache = true, TimeOut = 5, TransportType = TransportType.Tcp};
     Log.Debug("Default DNS Servers: {DnsServers}", _resolver.DnsServer);
     _resolver.OnVerbose += _resolver_OnVerbose;
 }
Beispiel #3
0
 private void _resolver_OnVerbose(object sender, Resolver.VerboseEventArgs e)
 {
     Log.Debug("DNS Resolver Verbose Message: {Message}", e.Message);
 }