iw4x-client/src/Components/Modules/RCon.hpp
2022-12-16 22:48:52 +01:00

48 lines
992 B
C++

#pragma once
namespace Components
{
class RCon : public Component
{
public:
RCon();
private:
class Container
{
public:
int timestamp;
std::string output;
std::string command;
std::string challenge;
Network::Address address;
};
class CryptoKey
{
public:
static const Utils::Cryptography::ECC::Key& Get();
private:
static bool LoadKey(Utils::Cryptography::ECC::Key& key);
static Utils::Cryptography::ECC::Key GenerateKey();
static Utils::Cryptography::ECC::Key LoadOrGenerateKey();
static Utils::Cryptography::ECC::Key GetKeyInternal();
};
static std::unordered_map<std::uint32_t, int> RateLimit;
static Container RconContainer;
static Utils::Cryptography::ECC::Key RconKey;
static std::string Password;
static Dvar::Var RconPassword;
static Dvar::Var RconLogRequests;
static void AddCommands();
static bool RateLimitCheck(const Network::Address& address, int time);
static void RateLimitCleanup(int time);
};
}