错误码
每个域名系统查询都可以返回以下错误代码之一:
dns.NODATA: 域名系统服务器返回没有数据的答案。dns.FORMERR: 域名系统服务器声称查询格式错误。dns.SERVFAIL: 域名系统服务器返回一般故障。dns.NOTFOUND: 未找到域名。dns.NOTIMP: 域名系统服务器没有执行请求的操作。dns.REFUSED: 域名系统服务器拒绝查询。dns.BADQUERY: 域名系统查询格式错误。dns.BADNAME: 主机名格式错误。dns.BADFAMILY: 不支持的地址族。dns.BADRESP: DNS 回复格式错误。dns.CONNREFUSED: 无法联系域名系统服务器。dns.TIMEOUT: 联系域名系统服务器时超时。dns.EOF: 文件结束。dns.FILE: 读取文件时出错。dns.NOMEM: 内存不足。dns.DESTRUCTION: 渠道正在被销毁。dns.BADSTR: 格式错误的字符串。dns.BADFLAGS: 指定了非法标志。dns.NONAME: 给定的主机名不是数字。dns.BADHINTS: 指定了非法提示标志。dns.NOTINITIALIZED: c-ares 库初始化尚未执行。dns.LOADIPHLPAPI: 加载iphlpapi.dll时出错。dns.ADDRGETNETWORKPARAMS: 找不到GetNetworkParams函数。dns.CANCELLED: 域名系统查询已取消。
dnsPromises API 也导出上述错误代码,例如,dnsPromises.NODATA。
Each DNS query can return one of the following error codes:
dns.NODATA: DNS server returned an answer with no data.dns.FORMERR: DNS server claims query was misformatted.dns.SERVFAIL: DNS server returned general failure.dns.NOTFOUND: Domain name not found.dns.NOTIMP: DNS server does not implement the requested operation.dns.REFUSED: DNS server refused query.dns.BADQUERY: Misformatted DNS query.dns.BADNAME: Misformatted host name.dns.BADFAMILY: Unsupported address family.dns.BADRESP: Misformatted DNS reply.dns.CONNREFUSED: Could not contact DNS servers.dns.TIMEOUT: Timeout while contacting DNS servers.dns.EOF: End of file.dns.FILE: Error reading file.dns.NOMEM: Out of memory.dns.DESTRUCTION: Channel is being destroyed.dns.BADSTR: Misformatted string.dns.BADFLAGS: Illegal flags specified.dns.NONAME: Given host name is not numeric.dns.BADHINTS: Illegal hints flags specified.dns.NOTINITIALIZED: c-ares library initialization not yet performed.dns.LOADIPHLPAPI: Error loadingiphlpapi.dll.dns.ADDRGETNETWORKPARAMS: Could not findGetNetworkParamsfunction.dns.CANCELLED: DNS query cancelled.
The dnsPromises API also exports the above error codes, e.g., dnsPromises.NODATA.