Code
·
25 lines
·
919 bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25using System.Reflection;
namespace MailSharp.DNS;
public partial class Resolver
{
public static string Version =>
Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty;
private uint uniqueId = (uint)new Random().Next();
private bool useCache = true;
private bool recursion = true;
private int retries = 3;
private int timeoutSeconds = 1;
private TransportType transportType = TransportType.Udp;
public int TimeOut { get => timeoutSeconds; set => timeoutSeconds = value; }
public int Retries { get => retries; set => retries = value >= 1 ? value : retries; }
public bool Recursion { get => recursion; set => recursion = value; }
public TransportType TransportType { get => transportType; set => transportType = value; }
public bool UseCache { get => useCache; set { useCache = value; if (!value) recordCache.Clear(); } }
public void ClearCache() => recordCache.Clear();
}