mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 20:43:44 +02:00
Pipe member tags to network member json
This commit is contained in:
parent
9ae8b0b3b6
commit
f187a6c34f
3 changed files with 28 additions and 0 deletions
|
@ -1251,6 +1251,11 @@ typedef struct
|
||||||
* sso provider
|
* sso provider
|
||||||
**/
|
**/
|
||||||
char ssoProvider[64];
|
char ssoProvider[64];
|
||||||
|
|
||||||
|
uint32_t tags[ZT_MAX_NETWORK_TAGS][2];
|
||||||
|
unsigned int tagsCount;
|
||||||
|
|
||||||
|
|
||||||
} ZT_VirtualNetworkConfig;
|
} ZT_VirtualNetworkConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1492,6 +1492,16 @@ void Network::_externalConfig(ZT_VirtualNetworkConfig *ec) const
|
||||||
ec->portError = _portError;
|
ec->portError = _portError;
|
||||||
ec->netconfRevision = (_config) ? (unsigned long)_config.revision : 0;
|
ec->netconfRevision = (_config) ? (unsigned long)_config.revision : 0;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i<ZT_MAX_NETWORK_TAGS; i++) {
|
||||||
|
if (_config.tags[i].id()) {
|
||||||
|
ec->tags[i][0] = _config.tags[i].id();
|
||||||
|
ec->tags[i][1] = _config.tags[i].value();
|
||||||
|
} else {
|
||||||
|
ec->tagsCount = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ec->assignedAddressCount = 0;
|
ec->assignedAddressCount = 0;
|
||||||
for(unsigned int i=0;i<ZT_MAX_ZT_ASSIGNED_ADDRESSES;++i) {
|
for(unsigned int i=0;i<ZT_MAX_ZT_ASSIGNED_ADDRESSES;++i) {
|
||||||
if (i < _config.staticIpCount) {
|
if (i < _config.staticIpCount) {
|
||||||
|
|
|
@ -542,6 +542,19 @@ static void _networkToJson(nlohmann::json &nj,NetworkState &ns)
|
||||||
nj["allowDefault"] = localSettings.allowDefault;
|
nj["allowDefault"] = localSettings.allowDefault;
|
||||||
nj["allowDNS"] = localSettings.allowDNS;
|
nj["allowDNS"] = localSettings.allowDNS;
|
||||||
|
|
||||||
|
nlohmann::json tags = nlohmann::json::array();
|
||||||
|
for(unsigned int i=0;i<ns.config().tagsCount;++i) {
|
||||||
|
if (ns.config().tags[i]) {
|
||||||
|
nlohmann::json tag = nlohmann::json::array();
|
||||||
|
tag = ns.config().tags[i];
|
||||||
|
tags[i] = tag;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nj["tags"] = tags;
|
||||||
|
|
||||||
|
|
||||||
nlohmann::json aa = nlohmann::json::array();
|
nlohmann::json aa = nlohmann::json::array();
|
||||||
for(unsigned int i=0;i<ns.config().assignedAddressCount;++i) {
|
for(unsigned int i=0;i<ns.config().assignedAddressCount;++i) {
|
||||||
aa.push_back(reinterpret_cast<const InetAddress *>(&(ns.config().assignedAddresses[i]))->toString(tmp));
|
aa.push_back(reinterpret_cast<const InetAddress *>(&(ns.config().assignedAddresses[i]))->toString(tmp));
|
||||||
|
|
Loading…
Add table
Reference in a new issue