summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-01-27 13:27:52 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-01-27 13:27:52 -0800
commit64774d0d4f552b2864abd969c6bc69c0ced3b2e1 (patch)
tree4bf3409fb359c6b0703e5c8ef7f54d8b0a601905 /service
parentb88f5737337a978e9d610f6f24e8cd35078b184a (diff)
downloadinfinitytier-64774d0d4f552b2864abd969c6bc69c0ced3b2e1.tar.gz
infinitytier-64774d0d4f552b2864abd969c6bc69c0ced3b2e1.zip
Replace piecemeal designation of upstreams with the concept of moons, which is simpler and easier to use and inherits all the cool live update stuff of worlds (now called planets) and global roots.
Diffstat (limited to 'service')
-rw-r--r--service/OneService.cpp22
-rw-r--r--service/README.md1
2 files changed, 10 insertions, 13 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 2932c605..6d9effa1 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -422,7 +422,7 @@ public:
try {
std::string authToken;
{
- std::string authTokenPath(_homePath + ZT_PATH_SEPARATOR_S + "authtoken.secret");
+ std::string authTokenPath(_homePath + ZT_PATH_SEPARATOR_S "authtoken.secret");
if (!OSUtils::readFile(authTokenPath.c_str(),authToken)) {
unsigned char foo[24];
Utils::getSecureRandom(foo,sizeof(foo));
@@ -442,7 +442,8 @@ public:
authToken = _trimString(authToken);
// Clean up any legacy files if present
- OSUtils::rm((_homePath + ZT_PATH_SEPARATOR_S + "peers.save").c_str());
+ OSUtils::rm((_homePath + ZT_PATH_SEPARATOR_S "peers.save").c_str());
+ OSUtils::rm((_homePath + ZT_PATH_SEPARATOR_S "world").c_str());
{
struct ZT_Node_Callbacks cb;
@@ -465,7 +466,7 @@ public:
unsigned int trustedPathCount = 0;
// Old style "trustedpaths" flat file -- will eventually go away
- FILE *trustpaths = fopen((_homePath + ZT_PATH_SEPARATOR_S + "trustedpaths").c_str(),"r");
+ FILE *trustpaths = fopen((_homePath + ZT_PATH_SEPARATOR_S "trustedpaths").c_str(),"r");
if (trustpaths) {
char buf[1024];
while ((fgets(buf,sizeof(buf),trustpaths))&&(trustedPathCount < ZT_MAX_TRUSTED_PATHS)) {
@@ -493,7 +494,7 @@ public:
// Read local config file
Mutex::Lock _l2(_localConfig_m);
std::string lcbuf;
- if (OSUtils::readFile((_homePath + ZT_PATH_SEPARATOR_S + "local.conf").c_str(),lcbuf)) {
+ if (OSUtils::readFile((_homePath + ZT_PATH_SEPARATOR_S "local.conf").c_str(),lcbuf)) {
try {
_localConfig = OSUtils::jsonParse(lcbuf);
if (!_localConfig.is_object()) {
@@ -581,7 +582,7 @@ public:
// Write file containing primary port to be read by CLIs, etc.
char portstr[64];
Utils::snprintf(portstr,sizeof(portstr),"%u",_ports[0]);
- OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "zerotier-one.port").c_str(),std::string(portstr));
+ OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S "zerotier-one.port").c_str(),std::string(portstr));
// Attempt to bind to a secondary port chosen from our ZeroTier address.
// This exists because there are buggy NATs out there that fail if more
@@ -641,8 +642,8 @@ public:
_node->setNetconfMaster((void *)_controller);
#ifdef ZT_ENABLE_CLUSTER
- if (OSUtils::fileExists((_homePath + ZT_PATH_SEPARATOR_S + "cluster").c_str())) {
- _clusterDefinition = new ClusterDefinition(_node->address(),(_homePath + ZT_PATH_SEPARATOR_S + "cluster").c_str());
+ if (OSUtils::fileExists((_homePath + ZT_PATH_SEPARATOR_S "cluster").c_str())) {
+ _clusterDefinition = new ClusterDefinition(_node->address(),(_homePath + ZT_PATH_SEPARATOR_S "cluster").c_str());
if (_clusterDefinition->size() > 0) {
std::vector<ClusterDefinition::MemberDefinition> members(_clusterDefinition->members());
for(std::vector<ClusterDefinition::MemberDefinition>::iterator m(members.begin());m!=members.end();++m) {
@@ -689,12 +690,12 @@ public:
}
#endif
- _controlPlane = new ControlPlane(this,_node,(_homePath + ZT_PATH_SEPARATOR_S + "ui").c_str());
+ _controlPlane = new ControlPlane(this,_node,(_homePath + ZT_PATH_SEPARATOR_S "ui").c_str());
_controlPlane->addAuthToken(authToken.c_str());
_controlPlane->setController(_controller);
{ // Remember networks from previous session
- std::vector<std::string> networksDotD(OSUtils::listDirectory((_homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str()));
+ std::vector<std::string> networksDotD(OSUtils::listDirectory((_homePath + ZT_PATH_SEPARATOR_S "networks.d").c_str()));
for(std::vector<std::string>::iterator f(networksDotD.begin());f!=networksDotD.end();++f) {
std::size_t dot = f->find_last_of('.');
if ((dot == 16)&&(f->substr(16) == ".conf"))
@@ -919,9 +920,6 @@ public:
if ((nstr.length() == ZT_ADDRESS_LENGTH_HEX)&&(v.value().is_object())) {
const Address ztaddr(nstr.c_str());
if (ztaddr) {
- const std::string rstr(OSUtils::jsonString(v.value()["role"],""));
- _node->setRole(ztaddr.toInt(),((rstr == "upstream")||(rstr == "UPSTREAM")) ? ZT_PEER_ROLE_UPSTREAM : ZT_PEER_ROLE_LEAF);
-
const uint64_t ztaddr2 = ztaddr.toInt();
std::vector<InetAddress> &v4h = _v4Hints[ztaddr2];
std::vector<InetAddress> &v6h = _v6Hints[ztaddr2];
diff --git a/service/README.md b/service/README.md
index d2398643..5d54b923 100644
--- a/service/README.md
+++ b/service/README.md
@@ -19,7 +19,6 @@ Settings available in `local.conf` (this is not valid JSON, and JSON does not al
},
"virtual": { /* Settings applied to ZeroTier virtual network devices (VL1) */
"##########": { /* 10-digit ZeroTier address */
- "role": "upstream"|"leaf", /* If upstream, define this as a trusted "federated root" (default is leaf) */
"try": [ "IP/port"/*,...*/ ], /* Hints on where to reach this peer if no upstreams/roots are online */
"blacklist": [ "NETWORK/bits"/*,...*/ ] /* Blacklist a physical path for only this peer. */
}