mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-18 20:47:53 +00:00
docs, and make RethinkDB controller DB driver upsert into the Controller DB and also update the hostname field.
This commit is contained in:
parent
ada611d597
commit
8d9464c414
@ -1,6 +1,19 @@
|
||||
ZeroTier Release Notes
|
||||
======
|
||||
|
||||
# 2017-12-XX -- Version 1.2.6
|
||||
|
||||
* Network Hypervisor
|
||||
* We've made some improvements to dead path detection and path selection. These also include changes under the hood to prepare for multi-path trunking and faster fail-over support.
|
||||
* Platform-Specific Changes
|
||||
* MacOS
|
||||
* Installer now loads the kernel extension right away so that High Sierra users will see the prompt to authorize it. This is done in the "Security & Privacy" preference pane and must be done driectly on the console (not via remote desktop).
|
||||
* Windows
|
||||
* The Windows installer should now install the driver without requiring a special prompt in most cases. This should make it easier for our packages to be accepted into and updated in the Chocolatey repository and should make it easier to perform remote installs.
|
||||
* The Windows official packages are now signed with an EV certificate (with hardware key) from DigiCert.
|
||||
* The Windows UI now contains a preview of features to more deeply integrate it with ZeroTier Central. You can enter a ZeroTier Central API key and join networks, etc. from the UI itself. We'll be expanding this in the future and possibly changing it, so this is just a test to see how users respond.
|
||||
* The `zerotier-idtool` command should now work on Windows.
|
||||
|
||||
# 2017-04-20 -- Version 1.2.4
|
||||
|
||||
* Managed routes are now only bifurcated for the default route. This is a change in behavior, though few people will probably notice. Bifurcating all managed routes was causing more trouble than it was worth for most users.
|
||||
|
@ -27,9 +27,10 @@ using json = nlohmann::json;
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
DB::DB(EmbeddedNetworkController *const nc,const Address &myAddress,const char *path) :
|
||||
DB::DB(EmbeddedNetworkController *const nc,const Identity &myId,const char *path) :
|
||||
_controller(nc),
|
||||
_myAddress(myAddress),
|
||||
_myId(myId),
|
||||
_myAddress(myId.address()),
|
||||
_path((path) ? path : "")
|
||||
{
|
||||
char tmp[32];
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define ZT_CONTROLLER_DB_HPP
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Address.hpp"
|
||||
#include "../node/Identity.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
#include "../osdep/BlockingQueue.hpp"
|
||||
@ -58,7 +58,7 @@ public:
|
||||
int64_t mostRecentDeauthTime;
|
||||
};
|
||||
|
||||
DB(EmbeddedNetworkController *const nc,const Address &myAddress,const char *path);
|
||||
DB(EmbeddedNetworkController *const nc,const Identity &myId,const char *path);
|
||||
virtual ~DB();
|
||||
|
||||
virtual bool waitForReady() = 0;
|
||||
@ -104,6 +104,7 @@ protected:
|
||||
void _fillSummaryInfo(const std::shared_ptr<_Network> &nw,NetworkSummaryInfo &info);
|
||||
|
||||
EmbeddedNetworkController *const _controller;
|
||||
const Identity _myId;
|
||||
const Address _myAddress;
|
||||
const std::string _path;
|
||||
std::string _myAddressStr;
|
||||
|
@ -477,10 +477,10 @@ void EmbeddedNetworkController::init(const Identity &signingId,Sender *sender)
|
||||
_signingIdAddressString = signingId.address().toString(tmp);
|
||||
#ifdef ZT_CONTROLLER_USE_RETHINKDB
|
||||
if ((_path.length() > 10)&&(_path.substr(0,10) == "rethinkdb:"))
|
||||
_db.reset(new RethinkDB(this,_signingId.address(),_path.c_str()));
|
||||
_db.reset(new RethinkDB(this,_signingId,_path.c_str()));
|
||||
else // else use FileDB after endif
|
||||
#endif
|
||||
_db.reset(new FileDB(this,_signingId.address(),_path.c_str()));
|
||||
_db.reset(new FileDB(this,_signingId,_path.c_str()));
|
||||
_db->waitForReady();
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
namespace ZeroTier
|
||||
{
|
||||
|
||||
FileDB::FileDB(EmbeddedNetworkController *const nc,const Address &myAddress,const char *path) :
|
||||
DB(nc,myAddress,path),
|
||||
FileDB::FileDB(EmbeddedNetworkController *const nc,const Identity &myId,const char *path) :
|
||||
DB(nc,myId,path),
|
||||
_networksPath(_path + ZT_PATH_SEPARATOR_S + "network")
|
||||
{
|
||||
OSUtils::mkdir(_path.c_str());
|
||||
|
@ -27,7 +27,7 @@ namespace ZeroTier
|
||||
class FileDB : public DB
|
||||
{
|
||||
public:
|
||||
FileDB(EmbeddedNetworkController *const nc,const Address &myAddress,const char *path);
|
||||
FileDB(EmbeddedNetworkController *const nc,const Identity &myId,const char *path);
|
||||
virtual ~FileDB();
|
||||
|
||||
virtual bool waitForReady();
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#ifdef ZT_CONTROLLER_USE_RETHINKDB
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "RethinkDB.hpp"
|
||||
#include "EmbeddedNetworkController.hpp"
|
||||
|
||||
@ -34,8 +36,8 @@ using json = nlohmann::json;
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Address &myAddress,const char *path) :
|
||||
DB(nc,myAddress,path),
|
||||
RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Identity &myId,const char *path) :
|
||||
DB(nc,myId,path),
|
||||
_ready(2), // two tables need to be synchronized before we're ready, so this is ready when it reaches 0
|
||||
_run(1),
|
||||
_waitNoticePrinted(false)
|
||||
@ -317,16 +319,44 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Address &myAddres
|
||||
|
||||
_heartbeatThread = std::thread([this]() {
|
||||
try {
|
||||
char tmp[1024];
|
||||
R::Object controllerRecord;
|
||||
std::unique_ptr<R::Connection> rdb;
|
||||
|
||||
{
|
||||
char publicId[1024];
|
||||
char secretId[1024];
|
||||
char hostname[1024];
|
||||
this->_myId.toString(publicId,false);
|
||||
this->_myId.toString(secretId,true);
|
||||
if (gethostname(hostname,sizeof(hostname)) != 0) {
|
||||
hostname[0] = (char)0;
|
||||
} else {
|
||||
for(int i=0;i<sizeof(hostname);++i) {
|
||||
if ((hostname[i] == '.')||(hostname[i] == 0)) {
|
||||
hostname[i] = (char)0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
controllerRecord["id"] = this->_myAddressStr.c_str();
|
||||
controllerRecord["publicIdentity"] = publicId;
|
||||
controllerRecord["secretIdentity"] = secretId;
|
||||
if (hostname[0])
|
||||
controllerRecord["clusterHost"] = hostname;
|
||||
controllerRecord["vMajor"] = ZEROTIER_ONE_VERSION_MAJOR;
|
||||
controllerRecord["vMinor"] = ZEROTIER_ONE_VERSION_MINOR;
|
||||
controllerRecord["vRev"] = ZEROTIER_ONE_VERSION_REVISION;
|
||||
controllerRecord["vBuild"] = ZEROTIER_ONE_VERSION_BUILD;
|
||||
}
|
||||
|
||||
while (_run == 1) {
|
||||
try {
|
||||
if (!rdb)
|
||||
rdb = R::connect(this->_host,this->_port,this->_auth);
|
||||
if (rdb) {
|
||||
OSUtils::ztsnprintf(tmp,sizeof(tmp),"{\"id\":\"%s\",\"lastAlive\":%lld,\"version\":\"%d.%d.%d\"}",this->_myAddressStr.c_str(),(long long)OSUtils::now(),ZEROTIER_ONE_VERSION_MAJOR,ZEROTIER_ONE_VERSION_MINOR,ZEROTIER_ONE_VERSION_REVISION);
|
||||
controllerRecord["lastAlive"] = OSUtils::now();
|
||||
//printf("HEARTBEAT: %s" ZT_EOL_S,tmp);
|
||||
R::db(this->_db).table("Controller").update(R::Datum::from_json(tmp)).run(*rdb);
|
||||
R::db(this->_db).table("Controller",R::optargs("read_mode","outdated")).insert(controllerRecord,R::optargs("conflict","update")).run(*rdb);
|
||||
}
|
||||
} catch ( ... ) {
|
||||
rdb.reset();
|
||||
|
@ -37,7 +37,7 @@ namespace ZeroTier
|
||||
class RethinkDB : public DB
|
||||
{
|
||||
public:
|
||||
RethinkDB(EmbeddedNetworkController *const nc,const Address &myAddress,const char *path);
|
||||
RethinkDB(EmbeddedNetworkController *const nc,const Identity &myId,const char *path);
|
||||
virtual ~RethinkDB();
|
||||
|
||||
virtual bool waitForReady();
|
||||
|
Loading…
Reference in New Issue
Block a user