|
Electroneum
|
Provides high-level access to DNS resolution. More...
#include <dns_utils.h>

Public Member Functions | |
| ~DNSResolver () | |
| takes care of freeing C pointers and such More... | |
| std::vector< std::string > | get_ipv4 (const std::string &url, bool &dnssec_available, bool &dnssec_valid) |
| gets ipv4 addresses from DNS query of a URL More... | |
| std::vector< std::string > | get_ipv6 (const std::string &url, bool &dnssec_available, bool &dnssec_valid) |
| gets ipv6 addresses from DNS query More... | |
| std::vector< std::string > | get_txt_record (const std::string &url, bool &dnssec_available, bool &dnssec_valid) |
| gets all TXT records from a DNS query for the supplied URL; if no TXT record present returns an empty vector. More... | |
| std::string | get_dns_format_from_oa_address (const std::string &oa_addr) |
| Gets a DNS address from OpenAlias format. More... | |
Static Public Member Functions | |
| static DNSResolver & | instance () |
| Gets the singleton instance of DNSResolver. More... | |
| static DNSResolver | create () |
| Gets a new instance of DNSResolver. More... | |
Private Member Functions | |
| DNSResolver () | |
| Constructs an instance of DNSResolver. More... | |
| std::vector< std::string > | get_record (const std::string &url, int record_type, boost::optional< std::string >(*reader)(const char *, size_t), bool &dnssec_available, bool &dnssec_valid) |
| gets all records of a given type from a DNS query for the supplied URL; if no such record is present returns an empty vector. More... | |
| bool | check_address_syntax (const char *addr) const |
| Checks a string to see if it looks like a URL. More... | |
Private Attributes | |
| DNSResolverData * | m_data |
Provides high-level access to DNS resolution.
This class is designed to provide a high-level abstraction to DNS resolution functionality, including access to TXT records and such. It will also handle DNSSEC validation of the results.
|
private |
Constructs an instance of DNSResolver.
Constructs a class instance and does setup stuff for the backend resolver.
| tools::DNSResolver::~DNSResolver | ( | ) |
takes care of freeing C pointers and such
|
private |
Checks a string to see if it looks like a URL.
| addr | the string to be checked |
|
static |
Gets a new instance of DNSResolver.
| std::string tools::DNSResolver::get_dns_format_from_oa_address | ( | const std::string & | oa_addr | ) |
Gets a DNS address from OpenAlias format.
If the address looks good, but contains one @ symbol, replace that with a . e.g. donate@electroneum.com becomes donate.electroneum.com
| oa_addr | OpenAlias address |
| std::vector< std::string > tools::DNSResolver::get_ipv4 | ( | const std::string & | url, |
| bool & | dnssec_available, | ||
| bool & | dnssec_valid | ||
| ) |
gets ipv4 addresses from DNS query of a URL
returns a vector of all IPv4 "A" records for given URL. If no "A" records found, returns an empty vector.
| url | A string containing a URL to query for |
| dnssec_available |
| std::vector< std::string > tools::DNSResolver::get_ipv6 | ( | const std::string & | url, |
| bool & | dnssec_available, | ||
| bool & | dnssec_valid | ||
| ) |
gets ipv6 addresses from DNS query
returns a vector of all IPv6 "A" records for given URL. If no "A" records found, returns an empty vector.
| url | A string containing a URL to query for |
|
private |
gets all records of a given type from a DNS query for the supplied URL; if no such record is present returns an empty vector.
| url | A string containing a URL to query for |
| record_type | the record type to retrieve (DNS_TYPE_A, etc) |
| reader | a function that converts a record data to a string |
| std::vector< std::string > tools::DNSResolver::get_txt_record | ( | const std::string & | url, |
| bool & | dnssec_available, | ||
| bool & | dnssec_valid | ||
| ) |
gets all TXT records from a DNS query for the supplied URL; if no TXT record present returns an empty vector.
| url | A string containing a URL to query for |
|
static |
Gets the singleton instance of DNSResolver.
|
private |