You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$"IP address for \"{query}\" could not be resolved and the DNS server did not return an error. Try to check your DNS server with: dig @{result.NameServer.Address}{query}",
106
-
$"{result.NameServer}");
110
+
$"{result.NameServer}")
111
+
{IsNotFound=true};
107
112
}
108
113
catch(DnsResponseExceptionex)
109
114
{
@@ -131,8 +136,12 @@ public async Task<DNSClientResultIPAddress> ResolveAaaaAsync(string query)
$"IP address for \"{query}\" could not be resolved and the DNS server did not return an error. Try to check your DNS server with: dig @{result.NameServer.Address}{query}",
144
-
$"{result.NameServer}");
153
+
$"{result.NameServer}")
154
+
{IsNotFound=true};
145
155
}
146
156
catch(DnsResponseExceptionex)
147
157
{
@@ -169,8 +179,12 @@ public async Task<DNSClientResultString> ResolveCnameAsync(string query)
$"CNAME for \"{query}\" could not be resolved and the DNS server did not return an error. Try to check your DNS server with: dig @{result.NameServer.Address}{query}",
182
-
$"{result.NameServer}");
196
+
$"{result.NameServer}")
197
+
{IsNotFound=true};
183
198
}
184
199
catch(DnsResponseExceptionex)
185
200
{
@@ -207,8 +222,17 @@ public async Task<DNSClientResultString> ResolvePtrAsync(IPAddress ipAddress)
$"PTR for \"{ipAddress}\" could not be resolved and the DNS server did not return an error. Try to check your DNS server with: dig @{result.NameServer.Address} -x {ipAddress}",
220
-
$"{result.NameServer}");
244
+
$"{result.NameServer}")
245
+
{IsNotFound=true};
221
246
}
222
247
catch(DnsResponseExceptionex)
223
248
{
@@ -229,4 +254,27 @@ public async Task<DNSClientResultString> ResolvePtrAsync(IPAddress ipAddress)
229
254
returnnewDNSClientResultString(true,ex.Message);
230
255
}
231
256
}
257
+
258
+
/// <summary>
259
+
/// Determines whether a DNS response code means "no record" rather than a real failure.
260
+
/// NXDOMAIN is always a clean "does not exist". SERVFAIL and REFUSED are only treated as
261
+
/// "no record" when <paramref name="treatServerErrorsAsNotFound" /> is set, since outside of
262
+
/// that case they usually indicate the resolver actually failed or refused the query rather
263
+
/// than a confirmed absence of the record.
264
+
/// </summary>
265
+
/// <param name="responseCode">The DNS response code to check.</param>
266
+
/// <param name="treatServerErrorsAsNotFound">
267
+
/// Whether SERVFAIL/REFUSED should also count as "no record" - true for reverse (PTR) lookups
268
+
/// on private/RFC1918/ULA IP ranges, where many resolvers return them instead of a clean
0 commit comments