2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class RCon : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RCon();
|
|
|
|
|
|
|
|
private:
|
|
|
|
class Container
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int timestamp;
|
|
|
|
std::string output;
|
2022-10-19 10:28:53 -04:00
|
|
|
std::string command;
|
2017-01-19 16:23:59 -05:00
|
|
|
std::string challenge;
|
|
|
|
Network::Address address;
|
|
|
|
};
|
|
|
|
|
2022-10-19 10:28:53 -04:00
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
2022-12-16 16:48:52 -05:00
|
|
|
static std::unordered_map<std::uint32_t, int> RateLimit;
|
|
|
|
|
2022-10-19 10:28:53 -04:00
|
|
|
static Container RconContainer;
|
|
|
|
static Utils::Cryptography::ECC::Key RconKey;
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
static std::string Password;
|
2022-03-03 11:37:18 -05:00
|
|
|
|
|
|
|
static Dvar::Var RconPassword;
|
|
|
|
static Dvar::Var RconLogRequests;
|
2022-10-19 10:28:53 -04:00
|
|
|
|
|
|
|
static void AddCommands();
|
2022-12-16 16:48:52 -05:00
|
|
|
|
|
|
|
static bool RateLimitCheck(const Network::Address& address, int time);
|
|
|
|
static void RateLimitCleanup(int time);
|
2017-01-19 16:23:59 -05:00
|
|
|
};
|
|
|
|
}
|