Files
UnrealEngineUWP/Engine/Source/Programs/Unsync/Private/UnsyncRemote.h
yuriy odonnell 149778ff91 unsync - Always use the specified proxy server for performing authentication instead of auto-selected closest, fix few other minor issues
* Use correct TLS subject after auto-selecting a proxy (previously the root proxy address was used)

[CL 29051065 by yuriy odonnell in ue5-main branch]
2023-10-24 15:07:43 -04:00

69 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "UnsyncCommon.h"
#include "UnsyncError.h"
#include "UnsyncSocket.h"
#include <memory>
#include <string>
namespace unsync {
class FBuffer;
static constexpr uint16 UNSYNC_DEFAULT_PORT = 53841;
enum class EProtocolFlavor {
Unknown,
Unsync,
Jupiter,
};
enum class ETransportProtocol {
Http,
Unsync,
};
EProtocolFlavor ProtocolFlavorFromString(const char* Str);
const char* ToString(EProtocolFlavor Protocol);
struct FRemoteDesc
{
EProtocolFlavor Protocol = EProtocolFlavor::Unknown;
std::string HostAddress;
uint16 HostPort = 0;
std::string RequestPath;
std::string StorageNamespace;
std::string StorageBucket = "unsync"; // TODO: override via command line
std::string HttpHeaders;
bool bTlsEnable = true; // Prefer TLS, if supported by protocol and remote server
bool bTlsVerifyCertificate = true; // Disabling this allows self-signed certificates
bool bTlsVerifySubject = true; // Disabling this is insecure, but may be useful during development
std::string TlsSubjectOverride; // Use host address if empty (default)
std::shared_ptr<FBuffer> TlsCacert; // Custom CA to use for server certificate validation (system root CA is used by default)
const std::string& GetTlsSubject() const { return TlsSubjectOverride.length() ? TlsSubjectOverride : HostAddress; }
bool bAuthenticationRequired = false;
std::string LoginAddress; // Optional address of the server used for login requests. If empty, then HostAddress is used.
const std::string& GetLoginAddress() const { return LoginAddress.length() ? LoginAddress : HostAddress; }
uint32 RecvTimeoutSeconds = 0;
uint32 MaxConnections = 8; // Limit on concurrent connections to this server
bool IsValid() const { return Protocol != EProtocolFlavor::Unknown && !HostAddress.empty() && HostPort != 0; }
static TResult<FRemoteDesc> FromUrl(std::string_view Url);
FTlsClientSettings GetTlsClientSettings() const;
};
} // namespace unsync