Add required support for GameLift TLS certificate (#7564)

* Add required support for GameLift TLS certificate
* Update based on feedback
This commit is contained in:
Vincent Liu
2022-02-17 13:44:44 -08:00
committed by GitHub
parent bc2589f3e8
commit 2589cb20e5
12 changed files with 227 additions and 43 deletions
@@ -44,14 +44,23 @@ namespace AWSGameLift
{
Multiplayer::SessionConnectionConfig sessionConnectionConfig;
auto createPlayerSessionResult = createPlayerSessionOutcome.GetResult();
// TODO: AWSNativeSDK needs to be updated to support this attribute, and it is a must have for TLS certificate enabled fleet
//sessionConnectionConfig.m_dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str();
sessionConnectionConfig.m_ipAddress = createPlayerSessionResult.GetPlayerSession().GetIpAddress().c_str();
AZStd::string_view dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str();
AZStd::string_view ipAddress = createPlayerSessionResult.GetPlayerSession().GetIpAddress().c_str();
// When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP address.
if (dnsName.ends_with(AWSGameLiftTLSEnabledDNSSuffix))
{
sessionConnectionConfig.m_dnsName = dnsName;
}
else
{
sessionConnectionConfig.m_ipAddress = ipAddress;
}
sessionConnectionConfig.m_playerSessionId = createPlayerSessionResult.GetPlayerSession().GetPlayerSessionId().c_str();
sessionConnectionConfig.m_port = static_cast<uint16_t>(createPlayerSessionResult.GetPlayerSession().GetPort());
AZ_TracePrintf(AWSGameLiftJoinSessionActivityName,
"Built SessionConnectionConfig with IpAddress=%s, PlayerSessionId=%s and Port=%d",
"Built SessionConnectionConfig with DnsName=%s, IpAddress=%s, PlayerSessionId=%s and Port=%d",
sessionConnectionConfig.m_dnsName.c_str(),
sessionConnectionConfig.m_ipAddress.c_str(),
sessionConnectionConfig.m_playerSessionId.c_str(),
sessionConnectionConfig.m_port);