mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-19 05:26:54 +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
|
||||
**/
|
||||
char ssoProvider[64];
|
||||
|
||||
uint32_t tags[ZT_MAX_NETWORK_TAGS][2];
|
||||
unsigned int tagsCount;
|
||||
|
||||
|
||||
} ZT_VirtualNetworkConfig;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1492,6 +1492,16 @@ void Network::_externalConfig(ZT_VirtualNetworkConfig *ec) const
|
|||
ec->portError = _portError;
|
||||
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;
|
||||
for(unsigned int i=0;i<ZT_MAX_ZT_ASSIGNED_ADDRESSES;++i) {
|
||||
if (i < _config.staticIpCount) {
|
||||
|
|
|
@ -542,6 +542,19 @@ static void _networkToJson(nlohmann::json &nj,NetworkState &ns)
|
|||
nj["allowDefault"] = localSettings.allowDefault;
|
||||
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();
|
||||
for(unsigned int i=0;i<ns.config().assignedAddressCount;++i) {
|
||||
aa.push_back(reinterpret_cast<const InetAddress *>(&(ns.config().assignedAddresses[i]))->toString(tmp));
|
||||
|
|
Loading…
Add table
Reference in a new issue