mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
Merge pull request #541
5131b26
Replace tabs and remove trailing whitespace (warptangent)0d40de4
Optionally restrict DNS queries to TCP (warptangent)
This commit is contained in:
commit
f7d41d6e28
@ -183,12 +183,33 @@ struct DNSResolverData
|
||||
|
||||
DNSResolver::DNSResolver() : m_data(new DNSResolverData())
|
||||
{
|
||||
int use_dns_public = 0;
|
||||
const char* dns_public_addr = "8.8.4.4";
|
||||
if (auto res = getenv("DNS_PUBLIC"))
|
||||
{
|
||||
std::string dns_public(res);
|
||||
// TODO: could allow parsing of IP and protocol: e.g. DNS_PUBLIC=tcp:8.8.8.8
|
||||
if (dns_public == "tcp")
|
||||
{
|
||||
LOG_PRINT_L0("Using public DNS server: " << dns_public_addr << " (TCP)");
|
||||
use_dns_public = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// init libunbound context
|
||||
m_data->m_ub_context = ub_ctx_create();
|
||||
|
||||
if (use_dns_public)
|
||||
{
|
||||
ub_ctx_set_fwd(m_data->m_ub_context, dns_public_addr);
|
||||
ub_ctx_set_option(m_data->m_ub_context, "do-udp:", "no");
|
||||
ub_ctx_set_option(m_data->m_ub_context, "do-tcp:", "yes");
|
||||
}
|
||||
else {
|
||||
// look for "/etc/resolv.conf" and "/etc/hosts" or platform equivalent
|
||||
ub_ctx_resolvconf(m_data->m_ub_context, NULL);
|
||||
ub_ctx_hosts(m_data->m_ub_context, NULL);
|
||||
}
|
||||
|
||||
#ifdef DEVELOPER_LIBUNBOUND_OLD
|
||||
#pragma message "Using the work around for old libunbound"
|
||||
|
Loading…
Reference in New Issue
Block a user