// Copyright Epic Games, Inc. All Rights Reserved. #include #include #include namespace zen::horde { bool HordeConfig::Validate() const { if (ServerUrl.empty()) { ZEN_WARN("Horde server URL is not configured"); return false; } // Relay mode implies AES encryption if (Mode == ConnectionMode::Relay && EncryptionMode != Encryption::AES) { ZEN_WARN("Horde relay mode requires AES encryption, but encryption is set to '{}'", ToString(EncryptionMode)); return false; } return true; } const char* ToString(ConnectionMode Mode) { switch (Mode) { case ConnectionMode::Direct: return "direct"; case ConnectionMode::Tunnel: return "tunnel"; case ConnectionMode::Relay: return "relay"; } return "direct"; } const char* ToString(Encryption Enc) { switch (Enc) { case Encryption::None: return "none"; case Encryption::AES: return "aes"; } return "none"; } bool FromString(ConnectionMode& OutMode, std::string_view Str) { if (StrCaseCompare(Str, "direct") == 0) { OutMode = ConnectionMode::Direct; return true; } if (StrCaseCompare(Str, "tunnel") == 0) { OutMode = ConnectionMode::Tunnel; return true; } if (StrCaseCompare(Str, "relay") == 0) { OutMode = ConnectionMode::Relay; return true; } ZEN_WARN("unrecognized Horde connection mode: '{}'", Str); return false; } bool FromString(Encryption& OutEnc, std::string_view Str) { if (StrCaseCompare(Str, "none") == 0) { OutEnc = Encryption::None; return true; } if (StrCaseCompare(Str, "aes") == 0) { OutEnc = Encryption::AES; return true; } ZEN_WARN("unrecognized Horde encryption mode: '{}'", Str); return false; } } // namespace zen::horde