DTLS 암호화 활성화
Configure your Relay client to use Datagram Transport Layer Security for encrypted connections.
읽는 시간 1분최근 업데이트: 한 달 전
Relay는 Relay 서버와 주고받는 모든 UDP 커뮤니케이션에 DTLS 암호화를 지원합니다. 호스트 플레이어로 할당을 생성할 때 Relay 서버의
connectionTypedtls
다음 코드 스니핏은
AllocateRelayServerAndGetJoinCodepublic static async Task<(string ipv4address, ushort port, byte[] allocationIdBytes, byte[] connectionData, byte[] key, string joinCode)> AllocateRelayServerAndGetJoinCode(int maxConnections, string region = null){ Allocation allocation; string createJoinCode; try { allocation = await RelayService.Instance.CreateAllocationAsync(maxConnections, region); } catch (Exception e) { Debug.LogError($"Relay create allocation request failed {e.Message}"); throw; } Debug.Log($"server connection data: {allocation.ConnectionData[0]} {allocation.ConnectionData[1]}"); Debug.Log($"server allocation ID: {allocation.AllocationId}"); try { createJoinCode = await RelayService.Instance.GetJoinCodeAsync(allocation.AllocationId); } catch { Debug.LogError("Relay create join code request failed"); throw; } var dtlsEndpoint = allocation.ServerEndpoints.First(e => e.ConnectionType == "dtls"); return (dtlsEndpoint.Host, (ushort)dtlsEndpoint.Port, allocation.AllocationIdBytes, allocation.ConnectionData, allocation.Key, createJoinCode);}