From 795b6d13d178fe805b61bcda449d1b86c0d5febd Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 30 Aug 2019 09:29:06 -0700 Subject: [PATCH] Simple status output on root of HTTP tree --- root/root.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/root/root.cpp b/root/root.cpp index 5b9af2544..623ce2666 100644 --- a/root/root.cpp +++ b/root/root.cpp @@ -721,6 +721,16 @@ int main(int argc,char **argv) httplib::Server apiServ; threads.push_back(std::thread([&apiServ,httpPort]() { + apiServ.Get("/",[](const httplib::Request &req,httplib::Response &res) { + std::ostringstream o; + std::lock_guard l0(peersByIdentity_l); + std::lock_guard l1(peersByPhysAddr_l); + o << "ZeroTier Root Server " << ZEROTIER_ONE_VERSION_MAJOR << '.' << ZEROTIER_ONE_VERSION_MINOR << '.' << ZEROTIER_ONE_VERSION_REVISION << ZT_EOL_S; + o << "(c)2019 ZeroTier, Inc." ZT_EOL_S "Licensed under the ZeroTier BSL 1.1" ZT_EOL_S ZT_EOL_S; + o << "Peers Online: " << peersByIdentity.size() << ZT_EOL_S; + o << "Physical Addresses: " << peersByPhysAddr.size() << ZT_EOL_S; + res.set_content(o.str(),"text/plain"); + }); apiServ.Get("/peer",[](const httplib::Request &req,httplib::Response &res) { char tmp[256]; std::ostringstream o;