}
}
catch(std::exception& e) {
- g_outputBuffer="Error: "+string(e.what())+"\n";
+ g_outputBuffer="Error: "+string(e.what())+"\n";
+ errlog("Error while trying to listen on %s: %s\n", addr, string(e.what()));
}
});
});
g_lua.writeFunction("addDOHLocal", [client](const std::string& addr, boost::variant<std::string, std::vector<std::pair<int,std::string>>> certFiles, boost::variant<std::string, std::vector<std::pair<int,std::string>>> keyFiles, boost::optional<boost::variant<std::string, vector<pair<int, std::string> > > > urls, boost::optional<localbind_t> vars) {
+#ifdef HAVE_DNS_OVER_HTTPS
if (client) {
return;
}
-#ifdef HAVE_DNS_OVER_HTTPS
setLuaSideEffect();
if (g_configurationDone) {
g_outputBuffer="addDOHLocal cannot be used at runtime!\n";
cs->dohFrontend = frontend;
g_frontends.push_back(std::move(cs));
#else
- g_outputBuffer="DNS over HTTPS support is not present!\n";
+ throw std::runtime_error("addDOHLocal() called but DNS over HTTPS support is not present!");
#endif
});
}
catch(const std::exception& e) {
g_outputBuffer="Error while trying to get DOH frontend with index " + std::to_string(index) + ": "+string(e.what())+"\n";
- errlog("Error while trying to get get DOH frontend with index %zu: %s\n", index, string(e.what()));
+ errlog("Error while trying to get DOH frontend with index %zu: %s\n", index, string(e.what()));
}
#else
g_outputBuffer="DNS over HTTPS support is not present!\n";
});
g_lua.writeFunction("addTLSLocal", [client](const std::string& addr, boost::variant<std::string, std::vector<std::pair<int,std::string>>> certFiles, boost::variant<std::string, std::vector<std::pair<int,std::string>>> keyFiles, boost::optional<localbind_t> vars) {
+#ifdef HAVE_DNS_OVER_TLS
if (client)
return;
-#ifdef HAVE_DNS_OVER_TLS
setLuaSideEffect();
if (g_configurationDone) {
g_outputBuffer="addTLSLocal cannot be used at runtime!\n";
g_outputBuffer="Error: "+string(e.what())+"\n";
}
#else
- g_outputBuffer="DNS over TLS support is not present!\n";
+ throw std::runtime_error("addTLSLocal() called but DNS over TLS support is not present!");
#endif
});