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