diff options
author | Grant Limberg <grant.limberg@zerotier.com> | 2019-03-05 15:11:50 -0800 |
---|---|---|
committer | Grant Limberg <grant.limberg@zerotier.com> | 2019-03-05 15:11:50 -0800 |
commit | fcb4221f97a7545ac741b184c53c10c3ac2c06b3 (patch) | |
tree | 2ce08a4b2447a620c1225d19401f34dbd8929d18 /service | |
parent | 1f13374a4f24c5398d4f1978b217db39aefdffad (diff) | |
download | infinitytier-fcb4221f97a7545ac741b184c53c10c3ac2c06b3.tar.gz infinitytier-fcb4221f97a7545ac741b184c53c10c3ac2c06b3.zip |
rabbitMQ implementation
Diffstat (limited to 'service')
-rw-r--r-- | service/OneService.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index b6673198..0fd31c64 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -99,6 +99,7 @@ extern "C" { using json = nlohmann::json; #include "../controller/EmbeddedNetworkController.hpp" +#include "../controller/RabbitMQ.hpp" #ifdef ZT_USE_TEST_TAP @@ -569,6 +570,8 @@ public: volatile bool _run; Mutex _run_m; + MQConfig *_mqc; + // end member variables ---------------------------------------------------- OneServiceImpl(const char *hp,unsigned int port) : @@ -604,6 +607,7 @@ public: ,_vaultPath("cubbyhole/zerotier") #endif ,_run(true) + ,_mqc(NULL) { _ports[0] = 0; _ports[1] = 0; @@ -678,6 +682,7 @@ public: delete _portMapper; #endif delete _controller; + delete _mqc; } virtual ReasonForTermination run() @@ -809,7 +814,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,_controllerDbPath.c_str(),_ports[0]); + _controller = new EmbeddedNetworkController(_node,_controllerDbPath.c_str(),_ports[0], _mqc); _node->setNetconfMaster((void *)_controller); // Join existing networks in networks.d @@ -1073,6 +1078,16 @@ public: if (cdbp.length() > 0) _controllerDbPath = cdbp; + json &rmq = settings["rabbitmq"]; + if (rmq.is_object() && _mqc == NULL) { + fprintf(stderr, "Reading RabbitMQ Config\n"); + _mqc = new MQConfig; + _mqc->port = rmq["port"]; + _mqc->host = OSUtils::jsonString(rmq["host"], "").c_str(); + _mqc->username = OSUtils::jsonString(rmq["username"], "").c_str(); + _mqc->password = OSUtils::jsonString(rmq["password"], "").c_str(); + } + // Bind to wildcard instead of to specific interfaces (disables full tunnel capability) json &bind = settings["bind"]; if (bind.is_array()) { |