DnsService class

DNS 解析测试服务 / DNS resolution test service.

支持两种解析路径 / Two resolution paths are supported:

  • 系统解析器(InternetAddress.lookup)/ the platform resolver;
  • 指定 DNS 服务器的原始 UDP 查询(自实现报文编解码)/ raw UDP queries against explicit DNS servers, using the built-in codec.

Constructors

DnsService({Duration defaultTimeout = const Duration(seconds: 5)})
构造 DnsService / Creates a DnsService.
const

Properties

defaultTimeout Duration
单次查询默认超时 / Default timeout of a single query.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query({required String domain, required String server, Duration? timeout}) Future<DnsTestResult>
查询单个 DNS 服务器 / Queries a single DNS server.
resolveWithSystemResolver({required String domain, Duration? timeout}) Future<DnsTestResult>
使用系统解析器解析域名 / Resolves a domain through the platform resolver.
testDns({String domain = 'www.google.com', List<String> dnsServers = const <String>['1.1.1.1', '8.8.8.8', '114.114.114.114'], Duration? timeout, bool concurrent = true, bool includeSystemResolver = false}) Future<List<DnsTestResult>>
依次/并发测试多台 DNS 服务器 / Tests multiple DNS servers.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited