mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2026-03-22 06:20:43 -07:00
Allow controllers to advertise which central version (cv1, cv2, or all) they are assigned to handle via a new configurable field. The value is persisted to the database on each heartbeat and validated at startup against the DB CHECK constraint.
64 lines
No EOL
1.2 KiB
C++
64 lines
No EOL
1.2 KiB
C++
#ifndef CONTROLLER_CONFIG_HPP
|
|
#define CONTROLLER_CONFIG_HPP
|
|
|
|
#include "Redis.hpp"
|
|
|
|
#include <string>
|
|
|
|
namespace ZeroTier {
|
|
|
|
struct PubSubConfig {
|
|
std::string project_id;
|
|
std::string member_change_recv_topic;
|
|
std::string member_change_send_topic;
|
|
std::string network_change_recv_topic;
|
|
std::string network_change_send_topic;
|
|
std::string sso_send_topic;
|
|
std::string sso_recv_topic;
|
|
};
|
|
|
|
struct BigTableConfig {
|
|
std::string project_id;
|
|
std::string instance_id;
|
|
std::string table_id;
|
|
};
|
|
|
|
struct ControllerConfig {
|
|
bool ssoEnabled;
|
|
std::string listenMode;
|
|
std::string statusMode;
|
|
std::string assignedCentralVersion;
|
|
RedisConfig* redisConfig;
|
|
PubSubConfig* pubSubConfig;
|
|
BigTableConfig* bigTableConfig;
|
|
|
|
ControllerConfig()
|
|
: ssoEnabled(false)
|
|
, listenMode("")
|
|
, statusMode("")
|
|
, assignedCentralVersion("all")
|
|
, redisConfig(nullptr)
|
|
, pubSubConfig(nullptr)
|
|
, bigTableConfig(nullptr)
|
|
{
|
|
}
|
|
|
|
~ControllerConfig()
|
|
{
|
|
if (redisConfig) {
|
|
delete redisConfig;
|
|
redisConfig = nullptr;
|
|
}
|
|
if (pubSubConfig) {
|
|
delete pubSubConfig;
|
|
pubSubConfig = nullptr;
|
|
}
|
|
if (bigTableConfig) {
|
|
delete bigTableConfig;
|
|
bigTableConfig = nullptr;
|
|
}
|
|
}
|
|
};
|
|
|
|
} // namespace ZeroTier
|
|
#endif // CONTROLLER_CONFIG_HPP
|