Merge remote-tracking branch 'origin/dev' into multipath

This commit is contained in:
Joseph Henry 2020-05-14 16:06:55 -07:00
commit 4465952d11
199 changed files with 51069 additions and 9277 deletions

View file

@ -89,6 +89,8 @@ extern "C" {
using json = nlohmann::json;
#include "../controller/EmbeddedNetworkController.hpp"
#include "../controller/PostgreSQL.hpp"
#include "../controller/Redis.hpp"
#include "../osdep/EthernetTap.hpp"
#ifdef __WINDOWS__
#include "../osdep/WindowsEthernetTap.hpp"
@ -533,6 +535,8 @@ public:
volatile bool _run;
Mutex _run_m;
RedisConfig *_rc;
// end member variables ----------------------------------------------------
OneServiceImpl(const char *hp,unsigned int port) :
@ -568,6 +572,7 @@ public:
,_vaultPath("cubbyhole/zerotier")
#endif
,_run(true)
,_rc(NULL)
{
_ports[0] = 0;
_ports[1] = 0;
@ -592,6 +597,7 @@ public:
delete _portMapper;
#endif
delete _controller;
delete _rc;
}
virtual ReasonForTermination run()
@ -732,7 +738,7 @@ public:
OSUtils::rmDashRf((_homePath + ZT_PATH_SEPARATOR_S "iddb.d").c_str());
// Network controller is now enabled by default for desktop and server
_controller = new EmbeddedNetworkController(_node,_homePath.c_str(),_controllerDbPath.c_str(),_ports[0]);
_controller = new EmbeddedNetworkController(_node,_homePath.c_str(),_controllerDbPath.c_str(),_ports[0], _rc);
_node->setNetconfMaster((void *)_controller);
// Join existing networks in networks.d
@ -991,7 +997,17 @@ public:
if (cdbp.length() > 0)
_controllerDbPath = cdbp;
#ifdef ZT_CONTROLLER_USE_LIBPQ
// TODO: Redis config
json &redis = settings["redis"];
if (redis.is_object() && _rc == NULL) {
_rc = new RedisConfig;
_rc->hostname = OSUtils::jsonString(redis["hostname"],"");
_rc->port = redis["port"];
_rc->password = OSUtils::jsonString(redis["password"],"");
_rc->clusterMode = OSUtils::jsonBool(redis["clusterMode"], false);
}
#endif
// Bind to wildcard instead of to specific interfaces (disables full tunnel capability)
json &bind = settings["bind"];