mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 20:43:44 +02:00
Merge branch 'dev' into edge
This commit is contained in:
commit
14c8564893
2 changed files with 34 additions and 29 deletions
|
@ -53,7 +53,6 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
||||||
const uint64_t controllerAddressInt = _myId.address().toInt();
|
const uint64_t controllerAddressInt = _myId.address().toInt();
|
||||||
_myId.address().toString(controllerAddress);
|
_myId.address().toString(controllerAddress);
|
||||||
std::string networksSelectorName("com.zerotier.controller.lfdb:"); networksSelectorName.append(controllerAddress); networksSelectorName.append("/network");
|
std::string networksSelectorName("com.zerotier.controller.lfdb:"); networksSelectorName.append(controllerAddress); networksSelectorName.append("/network");
|
||||||
std::string membersSelectorName("com.zerotier.controller.lfdb:"); membersSelectorName.append(controllerAddress); membersSelectorName.append("/member");
|
|
||||||
|
|
||||||
// LF record masking key is the first 32 bytes of SHA512(controller private key) in hex,
|
// LF record masking key is the first 32 bytes of SHA512(controller private key) in hex,
|
||||||
// hiding record values from anything but the controller or someone who has its key.
|
// hiding record values from anything but the controller or someone who has its key.
|
||||||
|
@ -156,7 +155,7 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
||||||
nlohmann::json newrec,selector0,selector1,selectors;
|
nlohmann::json newrec,selector0,selector1,selectors;
|
||||||
selector0["Name"] = networksSelectorName;
|
selector0["Name"] = networksSelectorName;
|
||||||
selector0["Ordinal"] = ns->first;
|
selector0["Ordinal"] = ns->first;
|
||||||
selector1["Name"] = membersSelectorName;
|
selector1["Name"] = "member";
|
||||||
selector1["Ordinal"] = ms->first;
|
selector1["Ordinal"] = ms->first;
|
||||||
selectors.push_back(selector0);
|
selectors.push_back(selector0);
|
||||||
selectors.push_back(selector1);
|
selectors.push_back(selector1);
|
||||||
|
@ -190,16 +189,16 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::ostringstream query;
|
std::ostringstream query;
|
||||||
query
|
query <<
|
||||||
<< '{'
|
"{"
|
||||||
<< "\"Ranges\":[{"
|
"\"Ranges\":[{"
|
||||||
<< "\"Name\":\"" << networksSelectorName << "\","
|
"\"Name\":\"" << networksSelectorName << "\","
|
||||||
<< "\"Range\":[0,18446744073709551615]"
|
"\"Range\":[0,18446744073709551615]"
|
||||||
<< "}],"
|
"}],"
|
||||||
<< "\"TimeRange\":[" << timeRangeStart << ",9223372036854775807],"
|
"\"TimeRange\":[" << timeRangeStart << ",9223372036854775807],"
|
||||||
<< "\"MaskingKey\":\"" << maskingKey << "\","
|
"\"MaskingKey\":\"" << maskingKey << "\","
|
||||||
<< "\"Owners\":[\"" << _lfOwnerPublic << "\"]"
|
"\"Owners\":[\"" << _lfOwnerPublic << "\"]"
|
||||||
<< '}';
|
"}";
|
||||||
auto resp = htcli.Post("/query",query.str(),"application/json");
|
auto resp = htcli.Post("/query",query.str(),"application/json");
|
||||||
if (resp) {
|
if (resp) {
|
||||||
if (resp->status == 200) {
|
if (resp->status == 200) {
|
||||||
|
@ -259,19 +258,19 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::ostringstream query;
|
std::ostringstream query;
|
||||||
query
|
query <<
|
||||||
<< '{'
|
"{"
|
||||||
<< "\"Ranges\":[{"
|
"\"Ranges\":[{"
|
||||||
<< "\"Name\":\"" << networksSelectorName << "\","
|
"\"Name\":\"" << networksSelectorName << "\","
|
||||||
<< "\"Range\":[0,18446744073709551615]"
|
"\"Range\":[0,18446744073709551615]"
|
||||||
<< "},{"
|
"},{"
|
||||||
<< "\"Name\":\"" << membersSelectorName << "\","
|
"\"Name\":\"member\","
|
||||||
<< "\"Range\":[0,18446744073709551615]"
|
"\"Range\":[0,18446744073709551615]"
|
||||||
<< "}],"
|
"}],"
|
||||||
<< "\"TimeRange\":[" << timeRangeStart << ",9223372036854775807],"
|
"\"TimeRange\":[" << timeRangeStart << ",9223372036854775807],"
|
||||||
<< "\"MaskingKey\":\"" << maskingKey << "\","
|
"\"MaskingKey\":\"" << maskingKey << "\","
|
||||||
<< "\"Owners\":[\"" << _lfOwnerPublic << "\"]"
|
"\"Owners\":[\"" << _lfOwnerPublic << "\"]"
|
||||||
<< '}';
|
"}";
|
||||||
auto resp = htcli.Post("/query",query.str(),"application/json");
|
auto resp = htcli.Post("/query",query.str(),"application/json");
|
||||||
if (resp) {
|
if (resp) {
|
||||||
if (resp->status == 200) {
|
if (resp->status == 200) {
|
||||||
|
|
|
@ -30,6 +30,14 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef ZT_SDK
|
||||||
|
|
||||||
|
#include "../controller/EmbeddedNetworkController.hpp"
|
||||||
|
#include "../node/Node.hpp"
|
||||||
|
#include "../include/VirtualTap.hpp"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include "MacEthernetTap.hpp"
|
#include "MacEthernetTap.hpp"
|
||||||
|
@ -56,10 +64,6 @@
|
||||||
#include "BSDEthernetTap.hpp"
|
#include "BSDEthernetTap.hpp"
|
||||||
#endif // __OpenBSD__
|
#endif // __OpenBSD__
|
||||||
|
|
||||||
#ifdef ZT_SDK
|
|
||||||
#include "../controller/EmbeddedNetworkController.hpp"
|
|
||||||
#include "../node/Node.hpp"
|
|
||||||
#include "../include/VirtualTap.hpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
@ -77,7 +81,9 @@ std::shared_ptr<EthernetTap> EthernetTap::newInstance(
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ZT_SDK
|
#ifdef ZT_SDK
|
||||||
|
|
||||||
return std::shared_ptr<EthernetTap>(new VirtualTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg));
|
return std::shared_ptr<EthernetTap>(new VirtualTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg));
|
||||||
|
|
||||||
#else // not ZT_SDK
|
#else // not ZT_SDK
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
Loading…
Add table
Reference in a new issue