aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeffrey Ryan <jeffreyryan@tutanota.com>2022-11-21 15:54:23 -0600
committerJeffrey Ryan <jeffreyryan@tutanota.com>2022-11-21 15:54:23 -0600
commit8687da6276e1353e4dc68ab1ef32197223495202 (patch)
treefa560b21b8bbd867af6acc8f0f81a917b5086a4b /tests
parentMerge pull request #8593 (diff)
downloadmonero-8687da6276e1353e4dc68ab1ef32197223495202.tar.xz
common: DNSResolver can handle hostnames without dot characters
Unrelated, but similar code-wise to #8643. There is a check in `DNSResolver` which automatically fails to resolve hostnames which do not contain the `.` character. This PR removes that check.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/dns_resolver.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp
index a6b733592..d56cbe45b 100644
--- a/tests/unit_tests/dns_resolver.cpp
+++ b/tests/unit_tests/dns_resolver.cpp
@@ -158,6 +158,17 @@ TEST(DNSResolver, GetTXTRecord)
EXPECT_STREQ("donate.getmonero.org", addr.c_str());
}
+TEST(DNSResolver, Localhost)
+{
+ tools::DNSResolver resolver = tools::DNSResolver::create();
+
+ bool avail, valid;
+ std::vector<std::string> ips = resolver.get_ipv4("localhost", avail, valid);
+
+ ASSERT_EQ(1, ips.size());
+ ASSERT_EQ("127.0.0.1", ips[0]);
+}
+
bool is_equal(const char *s, const std::vector<std::string> &v) { return v.size() == 1 && v[0] == s; }
TEST(DNS_PUBLIC, empty) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("").empty()); }