mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-16 03:56:54 +02:00
Add per-network relays to NetworkConfig.
This commit is contained in:
parent
86c87875a7
commit
8a13cfdace
2 changed files with 14 additions and 0 deletions
|
@ -181,6 +181,18 @@ void NetworkConfig::_fromDictionary(const Dictionary &d)
|
|||
_multicastRates[MulticastGroup(i->first)] = MulticastRate(Utils::hexStrToUInt(params[0].c_str()),Utils::hexStrToUInt(params[1].c_str()),Utils::hexStrToUInt(params[2].c_str()));
|
||||
}
|
||||
|
||||
std::vector<std::string> relaysSplit(Utils::split(d.get(ZT_NETWORKCONFIG_DICT_KEY_RELAYS,"").c_str(),",","",""));
|
||||
for(std::vector<std::string>::const_iterator r(relaysSplit.begin());r!=relaysSplit.end();++r) {
|
||||
std::size_t semi(r->find(';')); // address;ip/port,...
|
||||
if ((semi == ZT_ADDRESS_LENGTH)&&(r->length() > (ZT_ADDRESS_LENGTH + 1))) {
|
||||
std::pair<Address,InetAddress> relay(Address(r->substr(0,semi)),InetAddress(r->substr(semi+1)));
|
||||
if ((relay.first)&&(relay.second))
|
||||
_relays.push_back(relay);
|
||||
}
|
||||
}
|
||||
std::sort(_relays.begin(),_relays.end());
|
||||
std::unique(_relays.begin(),_relays.end());
|
||||
|
||||
_com.fromString(d.get(ZT_NETWORKCONFIG_DICT_KEY_CERTIFICATE_OF_MEMBERSHIP,std::string()));
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ public:
|
|||
inline const std::string &description() const throw() { return _description; }
|
||||
inline const std::vector<InetAddress> &staticIps() const throw() { return _staticIps; }
|
||||
inline const std::vector<Address> &activeBridges() const throw() { return _activeBridges; }
|
||||
inline const std::vector< std::pair<Address,InetAddress> > &relays() const throw() { return _relays; }
|
||||
inline const CertificateOfMembership &com() const throw() { return _com; }
|
||||
inline bool enableBroadcast() const throw() { return _enableBroadcast; }
|
||||
|
||||
|
@ -188,6 +189,7 @@ private:
|
|||
std::string _description;
|
||||
std::vector<InetAddress> _staticIps;
|
||||
std::vector<Address> _activeBridges;
|
||||
std::vector< std::pair<Address,InetAddress> > _relays;
|
||||
std::map<MulticastGroup,MulticastRate> _multicastRates;
|
||||
CertificateOfMembership _com;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue