Skip to content

DnsService Class ​

Definition ​

Provides DNS resolution using a from-scratch resolver that queries name servers directly over UDP with automatic TCP fallback. A name server may be specified explicitly; when one is omitted the servers configured on the local operating system are used.

  • Namespace: JASE.Network
  • Assembly: JASE.Network.dll

Fields ​

NameDescription
DefaultPortThe default UDP and TCP port used for DNS queries.

Methods ​

NameDescription
Task<IReadOnlyList<CaaRecord>> GetCertificationAuthorityRecordsAsync(string domain, CancellationToken cancellationToken = null)Returns the certification authority authorization (CAA) records for a domain name.
Task<IReadOnlyList<MxRecord>> GetMailExchangersAsync(string domain, CancellationToken cancellationToken = null)Returns the mail exchange (MX) records for a domain name, ordered by ascending preference.
Task<IReadOnlyList<NsRecord>> GetNameServersAsync(string domain, CancellationToken cancellationToken = null)Returns the authoritative name server (NS) records for a domain name.
Task<IReadOnlyList<SrvRecord>> GetServiceRecordsAsync(string serviceName, CancellationToken cancellationToken = null)Returns the service locator (SRV) records for a service name, such as _sip._tcp.example.com.
Task<SoaRecord> GetStartOfAuthorityAsync(string domain, CancellationToken cancellationToken = null)Returns the start of authority (SOA) record for a domain name, if present.
IReadOnlyList<IPAddress> GetSystemDnsServers()Returns the DNS server addresses configured on the local operating system.
Task<IReadOnlyList<TxtRecord>> GetTextRecordsAsync(string domain, CancellationToken cancellationToken = null)Returns the text (TXT) records for a domain name.
Task<DnsQueryResult> QueryAsync(string name, DnsRecordType recordType, CancellationToken cancellationToken = null)Performs a DNS query using the DNS servers configured on the local operating system.
Task<DnsQueryResult> QueryAsync(string name, DnsRecordType recordType, IPAddress server, CancellationToken cancellationToken = null)Performs a DNS query against a specific name server address using DefaultPort.
Task<DnsQueryResult> QueryAsync(string name, DnsRecordType recordType, IPEndPoint server, CancellationToken cancellationToken = null)Performs a DNS query against a specific name server endpoint.
Task<DnsQueryResult> QueryAsync(string name, DnsRecordType recordType, string server, CancellationToken cancellationToken = null)Performs a DNS query against a specific name server.
Task<IReadOnlyList<IPAddress>> ResolveAsync(string host, CancellationToken cancellationToken = null)Resolves a host name to its IPv4 and IPv6 addresses.
Task<IReadOnlyList<IPAddress>> ResolveIpV4Async(string host, CancellationToken cancellationToken = null)Resolves a host name to its IPv4 (A) addresses.
Task<IReadOnlyList<IPAddress>> ResolveIpV6Async(string host, CancellationToken cancellationToken = null)Resolves a host name to its IPv6 (AAAA) addresses.
Task<IReadOnlyList<string>> ReverseAsync(IPAddress address, CancellationToken cancellationToken = null)Performs a reverse DNS lookup for an IP address.
Task<IReadOnlyList<string>> ReverseAsync(string address, CancellationToken cancellationToken = null)Performs a reverse DNS lookup for an IP address in string form.

Remarks ​

This is a stub resolver: it asks a configured recursive name server to perform resolution rather than walking the DNS hierarchy from the root. It does not perform DNSSEC validation.

A server-reported response code (such as NameError for a non-existent name) is returned on the DnsQueryResult rather than thrown. Transport-level failures across all candidate servers throw DnsQueryFailedException.