if LUA
pdns_recursor_LDADD += $(LUA_LIBS)
+rec_control_LDADD += $(LUA_LIBS)
testrunner_LDADD += $(LUA_LIBS)
endif
dnsrecords.cc dnsrecords.hh \
dnswriter.cc dnswriter.hh \
filterpo.cc filterpo.hh \
+ lua-base4.cc lua-base4.hh \
+ iputils.cc iputils.hh \
logger.cc \
logging.cc \
misc.cc \
nsecrecords.cc \
qtype.cc \
rcpgenerator.cc rcpgenerator.hh \
+ rec-lua-conf.cc rec-lua-conf.hh \
rec_channel.cc rec_channel.hh \
rec_control.cc \
settings/cxxsupport.cc \
}
}
+static std::string showLuaYAML(const ::rust::string rfile)
+{
+ std::string msg;
+ if (rfile.empty()) {
+ return msg;
+ }
+
+ const auto file = string(rfile);
+ ProxyMapping proxyMapping;
+ LuaConfigItems lci;
+
+ try {
+ loadRecursorLuaConfig(file, proxyMapping, lci);
+ auto settings = pdns::rust::settings::rec::parse_yaml_string("");
+ pdns::settings::rec::fromLuaConfigToBridgeStruct(lci, proxyMapping, settings);
+ auto yaml = settings.to_yaml_string();
+ msg += "# Start of converted Lua config .yml based on " + file + "\n";
+ msg += std::string(yaml);
+ msg += "# Validation result: ";
+ try {
+ // Parse back and validate
+ settings.validate();
+ msg += "OK";
+ }
+ catch (const rust::Error& err) {
+ msg += err.what();
+ }
+ msg += "\n# End of converted " + file + "\n#\n";
+ }
+ catch (PDNSException& e) {
+ cerr << "Cannot load Lua configuration: " << e.reason << endl;
+ }
+ return msg;
+}
+
static std::string showIncludeYAML(::rust::String& rdirname)
{
std::string msg;
}
msg += "\n# End of converted " + configName + "\n#\n";
+ msg += showLuaYAML(mainsettings.recursor.lua_config_file);
msg += showIncludeYAML(mainsettings.recursor.include_dir);
msg += showForwardFileYAML(mainsettings.recursor.forward_zones_file);
msg += showAllowYAML(mainsettings.incoming.allow_from_file, "incoming", "allow_from_file", pdns::rust::settings::rec::validate_allow_from);