{ "roundrobin", false, "", "Simple round robin over available servers" },
{ "sendCustomTrap", true, "str", "send a custom `SNMP` trap from Lua, containing the `str` string"},
{ "setACL", true, "{netmask, netmask}", "replace the ACL set with these netmasks. Use `setACL({})` to reset the list, meaning no one can use us" },
+ { "setACLFromFile", true, "file", "replace the ACL set with netmasks in this file" },
{ "setAddEDNSToSelfGeneratedResponses", true, "add", "set whether to add EDNS to self-generated responses, provided that the initial query had EDNS" },
{ "setAllowEmptyResponse", true, "allow", "Set to true (defaults to false) to allow empty responses (qdcount=0) with a NoError or NXDomain rcode (default) from backends" },
{ "setAPIWritable", true, "bool, dir", "allow modifications via the API. if `dir` is set, it must be a valid directory where the configuration files will be written by the API" },
g_ACL.setState(nmg);
});
+ luaCtx.writeFunction("setACLFromFile", [](const std::string& file) {
+ setLuaSideEffect();
+ NetmaskGroup nmg;
+
+ ifstream ifs(file);
+ if(!ifs) {
+ throw std::runtime_error("Could not open '"+file+"': "+stringerror());
+ }
+
+ string::size_type pos;
+ string line;
+ while(getline(ifs,line)) {
+ pos=line.find('#');
+ if(pos!=string::npos)
+ line.resize(pos);
+ boost::trim(line);
+ if(line.empty())
+ continue;
+
+ nmg.addMask(line);
+ }
+
+ g_ACL.setState(nmg);
+ });
+
luaCtx.writeFunction("showACL", []() {
setLuaNoSideEffect();
vector<string> vec;