// Copyright Epic Games, Inc. All Rights Reserved. #include namespace zen::horde { bool HordeConfig::Validate() const { if (ServerUrl.empty()) { return false; } // Relay mode implies AES encryption if (Mode == ConnectionMode::Relay && EncryptionMode != Encryption::AES) { 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 (Str == "direct") { OutMode = ConnectionMode::Direct; return true; } if (Str == "tunnel") { OutMode = ConnectionMode::Tunnel; return true; } if (Str == "relay") { OutMode = ConnectionMode::Relay; return true; } return false; } bool FromString(Encryption& OutEnc, std::string_view Str) { if (Str == "none") { OutEnc = Encryption::None; return true; } if (Str == "aes") { OutEnc = Encryption::AES; return true; } return false; } } // namespace zen::horde