mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-31 22:40:48 +00:00
Simple status output on root of HTTP tree
This commit is contained in:
parent
8328b6f657
commit
795b6d13d1
@ -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<std::mutex> l0(peersByIdentity_l);
|
||||
std::lock_guard<std::mutex> 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user