updated DNSResolver/things that use it for DNSSEC
Note: DNSResolver does not yet *use* DNSSEC, but rather this commit is preparation for including DNSSEC validation. The function in src/wallet/wallet2.cpp that uses DNSResolver still needs its parameters updated accordingly.
This commit is contained in:
@@ -37,13 +37,15 @@ TEST(DNSResolver, IPv4Success)
|
||||
{
|
||||
tools::DNSResolver resolver;
|
||||
|
||||
auto ips = resolver.get_ipv4("example.com");
|
||||
bool avail, valid;
|
||||
|
||||
auto ips = resolver.get_ipv4("example.com", avail, valid);
|
||||
|
||||
ASSERT_EQ(1, ips.size());
|
||||
|
||||
ASSERT_STREQ("93.184.216.119", ips[0].c_str());
|
||||
|
||||
ips = tools::DNSResolver::instance().get_ipv4("example.com");
|
||||
ips = tools::DNSResolver::instance().get_ipv4("example.com", avail, valid);
|
||||
|
||||
ASSERT_EQ(1, ips.size());
|
||||
|
||||
@@ -55,11 +57,13 @@ TEST(DNSResolver, IPv4Failure)
|
||||
// guaranteed by IANA/ICANN/RFC to be invalid
|
||||
tools::DNSResolver resolver;
|
||||
|
||||
auto ips = resolver.get_ipv4("example.invalid");
|
||||
bool avail, valid;
|
||||
|
||||
auto ips = resolver.get_ipv4("example.invalid", avail, valid);
|
||||
|
||||
ASSERT_EQ(0, ips.size());
|
||||
|
||||
ips = tools::DNSResolver::instance().get_ipv4("example.invalid");
|
||||
ips = tools::DNSResolver::instance().get_ipv4("example.invalid", avail, valid);
|
||||
|
||||
ASSERT_EQ(0, ips.size());
|
||||
}
|
||||
@@ -68,13 +72,15 @@ TEST(DNSResolver, IPv6Success)
|
||||
{
|
||||
tools::DNSResolver resolver;
|
||||
|
||||
auto ips = resolver.get_ipv6("example.com");
|
||||
bool avail, valid;
|
||||
|
||||
auto ips = resolver.get_ipv6("example.com", avail, valid);
|
||||
|
||||
ASSERT_EQ(1, ips.size());
|
||||
|
||||
ASSERT_STREQ("2606:2800:220:6d:26bf:1447:1097:aa7", ips[0].c_str());
|
||||
|
||||
ips = tools::DNSResolver::instance().get_ipv6("example.com");
|
||||
ips = tools::DNSResolver::instance().get_ipv6("example.com", avail, valid);
|
||||
|
||||
ASSERT_EQ(1, ips.size());
|
||||
|
||||
@@ -86,11 +92,13 @@ TEST(DNSResolver, IPv6Failure)
|
||||
// guaranteed by IANA/ICANN/RFC to be invalid
|
||||
tools::DNSResolver resolver;
|
||||
|
||||
auto ips = resolver.get_ipv6("example.invalid");
|
||||
bool avail, valid;
|
||||
|
||||
auto ips = resolver.get_ipv6("example.invalid", avail, valid);
|
||||
|
||||
ASSERT_EQ(0, ips.size());
|
||||
|
||||
ips = tools::DNSResolver::instance().get_ipv6("example.invalid");
|
||||
ips = tools::DNSResolver::instance().get_ipv6("example.invalid", avail, valid);
|
||||
|
||||
ASSERT_EQ(0, ips.size());
|
||||
}
|
||||
@@ -98,7 +106,7 @@ TEST(DNSResolver, IPv6Failure)
|
||||
TEST(DNSResolver, GetTXTRecord)
|
||||
{
|
||||
|
||||
std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc");
|
||||
std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc", avail, valid);
|
||||
|
||||
EXPECT_NE(0, records.size());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user