|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
DNS客户端类 更多...
#include <dns_client.hpp>
类 | |
| struct | config |
| DNS客户端配置 更多... | |
Public 成员函数 | |
| dns_client () | |
| 默认构造函数 | |
| dns_client (config cfg, bool use_tcp=false) | |
| 构造函数 | |
| void | set_config (config cfg) noexcept |
| 设置客户端配置 | |
| void | set_timeout (const milliseconds timeout) noexcept |
| 设置超时时间 | |
| void | set_use_tcp (const bool use_tcp) noexcept |
| 设置是否使用TCP | |
| void | set_cache_ttl (const seconds ttl) noexcept |
| 设置缓存TTL | |
| void | set_recursion_desired (const bool rd) |
| 设置是否期望递归查询(RD) | |
| void | set_edns_udp_payload (const uint16_t payload_size) noexcept |
| 设置EDNS0 UDP载荷大小 | |
| void | set_dnssec_ok (const bool ok) noexcept |
| 设置是否请求DNSSEC(DO) | |
| void | clear_cache () noexcept |
| 清空缓存 | |
| dns_query_result | query (string_view domain, dns_record::raw type=dns_record::A, dns_class qclass=dns_class::INTERNET) |
| 执行DNS查询 | |
| future< dns_query_result > | query_async (const string &domain, dns_record::raw type=dns_record::A, dns_class qclass=dns_class::INTERNET) |
| 异步DNS查询 | |
| vector< string > | resolve_a (string_view domain) |
| 解析A记录(IPv4地址) | |
| vector< string > | resolve_aaaa (string_view domain) |
| 解析AAAA记录(IPv6地址) | |
| vector< string > | resolve_cname (string_view domain) |
| 解析CNAME记录(别名) | |
| vector< string > | resolve_mx (string_view domain) |
| 解析MX记录(邮件交换器) | |
| vector< string > | resolve_txt (string_view domain) |
| 解析TXT记录(文本记录) | |
| vector< dns_srv_record > | resolve_srv (string_view domain) |
| 解析SRV记录(服务定位器) | |
| optional< dns_soa_record > | resolve_soa (string_view domain) |
| 解析SOA记录(授权区域起始) | |
| string | reverse_query (string_view ip) |
| 反向查询(从IP获取域名) | |
| vector< dns_query_result > | batch_query (const vector< string > &domains, dns_record::raw type=dns_record::A) |
| 批量查询 | |
静态 Public 成员函数 | |
| static byte_vector | build_query (string_view domain, dns_record::raw type=dns_record::A, dns_class qclass=dns_class::INTERNET, bool rd=true, bool edns_enable=true, bool dnssec_ok=false, uint16_t edns_payload=edns::DEFAULT_UDP_PAYLOAD) |
| 构建DNS查询消息 | |
| static dns_query_result | parse_response (const byte_vector &response, uint16_t expected_id=0) |
| 解析DNS响应消息 | |
DNS客户端类
提供DNS查询服务的完整实现,支持缓存、超时控制和多种查询类型。
主要功能:
在文件 dns_client.hpp 第 46 行定义.
|
inline |
默认构造函数
使用默认配置创建DNS客户端。
在文件 dns_client.hpp 第 102 行定义.
引用了 dns_client().
被这些函数引用 dns_client() , 以及 dns_client().
|
explicit |
| vector< dns_query_result > dns_client::batch_query | ( | const vector< string > & | domains, |
| dns_record::raw | type = dns_record::A ) |
|
static |
构建DNS查询消息
| domain | 域名 |
| type | 记录类型 |
| qclass | 查询类 |
| rd | 是否期望递归 |
| edns_enable | 是否启用EDNS0 |
| dnssec_ok | 是否请求DNSSEC |
| edns_payload | EDNS0 UDP载荷大小 |
引用了 dns_record::A, edns::DEFAULT_UDP_PAYLOAD , 以及 INTERNET.
|
static |
| dns_query_result dns_client::query | ( | string_view | domain, |
| dns_record::raw | type = dns_record::A, | ||
| dns_class | qclass = dns_class::INTERNET ) |
执行DNS查询
| domain | 域名 |
| type | 记录类型(默认A记录) |
| qclass | 查询类(默认INTERNET) |
| dns_exception | 查询失败时抛出 |
引用了 dns_record::A , 以及 INTERNET.
| future< dns_query_result > dns_client::query_async | ( | const string & | domain, |
| dns_record::raw | type = dns_record::A, | ||
| dns_class | qclass = dns_class::INTERNET ) |
| vector< string > dns_client::resolve_a | ( | string_view | domain | ) |
解析A记录(IPv4地址)
| domain | 域名 |
| vector< string > dns_client::resolve_aaaa | ( | string_view | domain | ) |
解析AAAA记录(IPv6地址)
| domain | 域名 |
| vector< string > dns_client::resolve_cname | ( | string_view | domain | ) |
解析CNAME记录(别名)
| domain | 域名 |
| vector< string > dns_client::resolve_mx | ( | string_view | domain | ) |
解析MX记录(邮件交换器)
| domain | 域名 |
| optional< dns_soa_record > dns_client::resolve_soa | ( | string_view | domain | ) |
解析SOA记录(授权区域起始)
| domain | 域名 |
| vector< dns_srv_record > dns_client::resolve_srv | ( | string_view | domain | ) |
解析SRV记录(服务定位器)
| domain | 域名 |
| vector< string > dns_client::resolve_txt | ( | string_view | domain | ) |
解析TXT记录(文本记录)
| domain | 域名 |
| string dns_client::reverse_query | ( | string_view | ip | ) |
反向查询(从IP获取域名)
| ip | IPv4地址 |
| dns_exception | IP地址无效时抛出 |
执行PTR记录查询,将IP地址转换为域名。 支持IPv4地址,IPv6支持有限。
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |