Kawe Mazidjatari 48bc69b028 Initial implementation of bulk ban checking
Initial implementation of the bulk ban check system. This implementation takes a snapshot of the currently connected clients, sends it up to the master server, and the master server returns anything within this list that is marked 'banned'. The server would then kick the player from the server. This commit also removes the global banned list cache, as the bulk checking system offers a lot more freedom regarding banning specific players and have it sync across all available servers.
2023-04-28 23:47:58 +02:00

32 lines
1.4 KiB
C++

#pragma once
#include "thirdparty/curl/include/curl/curl.h"
#include "bansystem.h"
#include "serverlisting.h"
class CPylon
{
public:
vector<NetGameServer_t> GetServerList(string& outMessage) const;
bool GetServerByToken(NetGameServer_t& slOutServer, string& outMessage, const string& svToken) const;
bool PostServerHost(string& outMessage, string& svOutToken, const NetGameServer_t& netGameServer) const;
bool GetBannedList(const BannedVec_t& inBannedVec, BannedVec_t& outBannedVec) const;
bool CheckForBan(const string& ipAddress, const uint64_t nucleusId, string& outReason) const;
void ExtractError(const nlohmann::json& resultBody, string& outMessage, CURLINFO status, const char* errorText = nullptr) const;
void ExtractError(const string& response, string& outMessage, CURLINFO status, const char* messageText = nullptr) const;
void LogBody(const nlohmann::json& responseJson) const;
bool SendRequest(const char* endpoint, const nlohmann::json& requestJson, nlohmann::json& responseJson, string& outMessage, CURLINFO& status, const char* errorText = nullptr) const;
bool QueryServer(const char* endpoint, const char* request, string& outResponse, string& outMessage, CURLINFO& outStatus) const;
#ifdef DEDICATED
bool KeepAlive(const NetGameServer_t& netGameServer);
private:
string m_Token;
string m_ErrorMsg;
#endif // DEDICATED
};
extern CPylon* g_pMasterServer;