From: bert hubert Date: Sat, 5 Dec 2015 19:50:03 +0000 (+0100) Subject: report acl and local addresses over web-api X-Git-Tag: dnsdist-1.0.0-alpha1~123 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da5d49992fc1648f695fef70d2c96af3637e0d16;p=pdns report acl and local addresses over web-api --- diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index 2e09fa37e..0a38d2a27 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -158,13 +158,31 @@ static void connectionThread(int sock, ComboAddress remote, string password) {"action", a.second->toString()} }; rules.push_back(rule); } + + + string acl; + + vector vec; + g_ACL.getCopy().toStringVector(&vec); + + for(const auto& s : vec) { + if(!acl.empty()) acl += ", "; + acl+=s; + } + string localaddresses; + for(const auto& loc : g_locals) { + if(!localaddresses.empty()) localaddresses += ", "; + localaddresses += loc.first.toStringWithPort(); + } Json my_json = Json::object { { "daemon_type", "dnsdist" }, { "version", VERSION}, { "servers", servers}, { "rules", rules}, + { "acl", acl}, + { "local", localaddresses} }; resp.headers["Content-Type"] = "application/json"; resp.body=my_json.dump();