1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
This commit is contained in:
Jeff Becker 2020-05-14 12:33:37 -04:00
parent 3753dfbddb
commit ebed21c392
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05

View file

@ -228,22 +228,20 @@ namespace llarp
DnsConfig::defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params)
{
(void)params;
conf.defineOption<std::string>(
"dns", "upstream", false, true, std::nullopt, [=](std::string arg) {
IpAddress addr{arg};
const auto maybePort = addr.getPort();
if (not maybePort.has_value())
addr.setPort(53);
m_upstreamDNS.push_back(std::move(addr));
});
conf.defineOption<std::string>("dns", "bind", false, std::nullopt, [=](std::string arg) {
static auto parseDNSAddr = [](auto arg) {
IpAddress addr{arg};
const auto maybePort = addr.getPort();
if (not maybePort.has_value())
addr.setPort(53);
m_bind = std::move(addr);
return addr;
};
conf.defineOption<std::string>(
"dns", "upstream", false, true, std::nullopt, [=](std::string arg) {
m_upstreamDNS.push_back(parseDNSAddr(std::move(arg)));
});
conf.defineOption<std::string>("dns", "bind", false, std::nullopt, [=](std::string arg) {
m_bind = parseDNSAddr(std::move(arg));
});
}