mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2026-04-09 14:52:10 -07:00
Publish CTL_NONCE_UPDATE to PubSub when nonces are created or reused in getSSOAuthInfo(), with the network's frontend as a message attribute so only the correct CV frontend receives it. Listen for ZT1_AUTH_UPDATE messages and update sso_expiry.authentication_expiry_time accordingly, with a network existence check before applying. - Add sso_send_topic/sso_recv_topic to PubSubConfig - Add PubSubWriter::publishSSONonceUpdate() with frontend param - Add PubSubSSOListener class for inbound auth updates - Rename CV1_AUTH_UPDATE to ZT1_AUTH_UPDATE in sso.proto - Fix pre-existing connection pool leak in getSSOAuthInfo() catch block
52 lines
No EOL
1.3 KiB
C++
52 lines
No EOL
1.3 KiB
C++
#ifndef ZT_CONTROLLER_PUBSUBWRITER_HPP
|
|
#define ZT_CONTROLLER_PUBSUBWRITER_HPP
|
|
|
|
#include <google/cloud/pubsub/publisher.h>
|
|
#include <memory>
|
|
#include <nlohmann/json.hpp>
|
|
#include <string>
|
|
|
|
namespace ZeroTier {
|
|
|
|
class PubSubWriter {
|
|
public:
|
|
PubSubWriter(std::string project, std::string topic, std::string controller_id);
|
|
virtual ~PubSubWriter();
|
|
|
|
bool publishNetworkChange(
|
|
const nlohmann::json& oldNetwork,
|
|
const nlohmann::json& newNetwork,
|
|
const std::string& frontend);
|
|
|
|
bool
|
|
publishMemberChange(const nlohmann::json& oldMember, const nlohmann::json& newMember, const std::string& frontend);
|
|
|
|
bool publishStatusChange(
|
|
std::string frontend,
|
|
std::string network_id,
|
|
std::string node_id,
|
|
std::string os,
|
|
std::string arch,
|
|
std::string version,
|
|
int64_t last_seen);
|
|
|
|
bool publishSSONonceUpdate(
|
|
const std::string& nonce,
|
|
uint64_t nonceExpiration,
|
|
const std::string& networkId,
|
|
const std::string& deviceId,
|
|
const std::string& frontend);
|
|
|
|
protected:
|
|
bool publishMessage(const std::string& payload, const std::string& frontend, const std::string& orderingKey);
|
|
|
|
private:
|
|
std::string _controller_id;
|
|
std::string _project;
|
|
std::string _topic;
|
|
std::shared_ptr<google::cloud::pubsub::Publisher> _publisher;
|
|
};
|
|
|
|
} // namespace ZeroTier
|
|
|
|
#endif // ZT_CONTROLLER_PUBSUBWRITER_HPP
|