API Reference
DnsPropagationAnalysis
Provides DNS propagation checks across many public servers.
Inheritance
- Object
- DnsPropagationAnalysis
Remarks
The analysis compares DNS answers from multiple resolvers to detect discrepancies during record updates.
Constructors
public DnsPropagationAnalysis() #Initializes a new instance of the class.
Methods
public Void AddServer(PublicDnsEntry entry) #VoidAdds the specified DNS server to the list of known servers if it is not already present.
Parameters
- entry DomainDetective.PublicDnsEntry
- The server entry to add.
public static Dictionary<String, List<DnsComparisonEntry>> CompareResults(IEnumerable<DnsPropagationResult> results) #Dictionary<String, List<DnsComparisonEntry>>Compares results from multiple servers and groups them by the set of records returned.
Parameters
- results System.Collections.Generic.IEnumerable{DomainDetective.DnsPropagationResult}
- The results to compare.
Returns
A dictionary keyed by the record returned and listing the servers along with their country and location.
public Void DisableServer(String ipAddress) #VoidDisables a server so it is not used in queries.
Parameters
- ipAddress System.String
- IP address of the server.
public Void EnableServer(String ipAddress) #VoidEnables a previously disabled server.
Parameters
- ipAddress System.String
- IP address of the server.
public IEnumerable<PublicDnsEntry> FilterServers(Nullable<CountryId> country = null, Nullable<LocationId> location = null, Nullable<Int32> take = null) #IEnumerable<PublicDnsEntry>Filters the configured servers optionally by country or location.
Parameters
- country System.Nullable{DomainDetective.CountryId} = null
- Country filter.
- location System.Nullable{DomainDetective.LocationId} = null
- Location filter.
- take System.Nullable{System.Int32} = null
- If specified, randomly selects this many servers.
Returns
The filtered server list.
public IEnumerable<PublicDnsEntry> FilterServers(DnsServerQuery query) #IEnumerable<PublicDnsEntry>Filters servers using a DnsServerQuery builder.
Parameters
- query DomainDetective.DnsServerQuery
- Query builder specifying filters.
Returns
The filtered server list.
public static List<DnsComparisonDetail> GetComparisonDetails(IEnumerable<DnsPropagationResult> results) #List<DnsComparisonDetail>Flattens comparison results into DnsComparisonDetail objects.
Parameters
- results System.Collections.Generic.IEnumerable{DomainDetective.DnsPropagationResult}
- The results to analyze.
Returns
List of details for each server and record set.
public IEnumerable<String> GetSnapshotChanges(String domain, DnsRecordType recordType, IEnumerable<DnsPropagationResult> results) #IEnumerable<String>Returns line level differences between results and the latest snapshot.
Parameters
- domain System.String
- Queried domain name.
- recordType DnsClientX.DnsRecordType
- DNS record type.
- results System.Collections.Generic.IEnumerable{DomainDetective.DnsPropagationResult}
- Current query results.
Returns
List of diff lines.
public Void LoadBuiltinServers(Boolean clearExisting = true) #VoidLoads DNS servers from the embedded resource.
Parameters
- clearExisting System.Boolean = true
- Whether to clear existing entries.
public Void LoadServers(String filePath, Boolean clearExisting = false) #VoidLoads DNS server definitions from a JSON file.
Parameters
- filePath System.String
- Path to the JSON file.
- clearExisting System.Boolean = false
- Whether to clear any existing servers before loading.
public async Task<List<DnsPropagationResult>> QueryAsync(String domain, DnsRecordType recordType, IEnumerable<PublicDnsEntry> servers, CancellationToken cancellationToken = null, IProgress<Double> progress = null, Int32 maxParallelism = 0, Boolean includeGeo = false) #Task<List<DnsPropagationResult>>Asynchronously queries each provided server for the specified domain and record type.
Parameters
- domain System.String
- Domain name to query.
- recordType DnsClientX.DnsRecordType
- DNS record type.
- servers System.Collections.Generic.IEnumerable{DomainDetective.PublicDnsEntry}
- Servers to query.
- cancellationToken System.Threading.CancellationToken = null
- Token used to cancel the operation.
- progress System.IProgress{System.Double} = null
- Optional progress reporter (0..100).
- maxParallelism System.Int32 = 0
- Maximum concurrent queries (0 uses number of servers).
- includeGeo System.Boolean = false
- When true, performs GeoIP lookups for returned IPs.
Returns
A list of query results.
public Void RemoveServer(String ipAddress) #VoidRemoves a DNS server from the list using its IP address.
Parameters
- ipAddress System.String
- IP address of the server.
public Void SaveSnapshot(String domain, DnsRecordType recordType, IEnumerable<DnsPropagationResult> results) #VoidSaves the provided results to a timestamped snapshot file.
Parameters
- domain System.String
- Queried domain name.
- recordType DnsClientX.DnsRecordType
- DNS record type.
- results System.Collections.Generic.IEnumerable{DomainDetective.DnsPropagationResult}
- Results to persist.
public List<PublicDnsEntry> SelectServers(Dictionary<String, Int32> countryCounts) #List<PublicDnsEntry>Selects a combined list of servers from multiple countries.
Parameters
- countryCounts System.Collections.Generic.Dictionary{System.String,System.Int32}
- Dictionary mapping country code or name to the number of servers to take.
Returns
List of selected servers.
Examples
Select two servers from Poland and one from Germany.
var servers = analysis.SelectServers(new Dictionary<string, int> { ["PL"] = 2, ["DE"] = 1 });
public async Task ValidateServerAsnsAsync(InternalLogger logger = null, CancellationToken ct = null) #TaskValidates server asns async.
Parameters
- logger DomainDetective.InternalLogger = null
- ct System.Threading.CancellationToken = null
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public IReadOnlyList<PublicDnsEntry> Servers { get; } #Gets the collection of configured DNS servers.
DnsQueryOverride #Override DNS queries for testing.
GeoLookupOverride #Override geolocation lookup for testing.
BgpLookupOverride #Override BGP lookup for testing.
public GeoIpAnalysis GeoIp { get; } #GeoIP database used for lookups.
public String SnapshotDirectory { get; set; } #Directory used to store snapshot files.
Fields
_rnd #Thread-safe random number generator used for selecting a subset of servers.