-
Notifications
You must be signed in to change notification settings - Fork 856
Expand file tree
/
Copy pathDNSClientResult.cs
More file actions
69 lines (61 loc) · 2.49 KB
/
Copy pathDNSClientResult.cs
File metadata and controls
69 lines (61 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
namespace NETworkManager.Utilities;
/// <summary>
/// Base class for the result from a <see cref="DNSClient" /> query.
/// </summary>
public abstract class DNSClientResult
{
/// <summary>
/// Create an instance of <see cref="DNSClientResult" />.
/// </summary>
public DNSClientResult()
{
}
/// <summary>
/// Create an instance of <see cref="DNSClientResult" /> with parameters.
/// </summary>
/// <param name="dnsServer">DNS server which was used for resolving the query.</param>
public DNSClientResult(string dnsServer)
{
DNSServer = dnsServer;
}
/// <summary>
/// Create an instance of <see cref="DNSClientResult" /> with parameters if an error has occurred.
/// </summary>
/// <param name="hasError">Indicates if an error has occurred.</param>
/// <param name="errorMessage">Error message when an error has occurred.</param>
public DNSClientResult(bool hasError, string errorMessage)
{
HasError = hasError;
ErrorMessage = errorMessage;
}
/// <summary>
/// Create an instance of <see cref="DNSClientResult" /> with parameters if an error has occurred.
/// </summary>
/// <param name="hasError">Indicates if an error has occurred.</param>
/// <param name="errorMessage">Error message when an error has occurred.</param>
/// <param name="dnsServer">DNS server which was used for resolving the query.</param>
public DNSClientResult(bool hasError, string errorMessage, string dnsServer) : this(dnsServer)
{
HasError = hasError;
ErrorMessage = errorMessage;
}
/// <summary>
/// DNS server which was used for resolving the query.
/// </summary>
public string DNSServer { get; set; }
/// <summary>
/// Indicates if an error has occurred.
/// </summary>
public bool HasError { get; set; }
/// <summary>
/// Error message when an error has occurred.
/// </summary>
public string ErrorMessage { get; set; }
/// <summary>
/// Indicates that <see cref="HasError" /> is set because no matching record was found (NXDOMAIN,
/// or SERVFAIL/REFUSED on a reverse lookup for a private/RFC1918/ULA IP range), rather than a real
/// failure like a timeout, an unreachable server, or SERVFAIL/REFUSED for any other query. This is
/// a normal outcome (e.g. no PTR record configured) and not a sign of a broken DNS setup.
/// </summary>
public bool IsNotFound { get; set; }
}