using System; using System.Collections.Generic; using UnityEngine.Scripting; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Unity.Services.Relay.Http; namespace Unity.Services.Relay.Models { /// /// Details of an allocation to a relay server /// ID of the allocation /// Connection endpoints for the assigned relay server /// relayServer param /// Base64-encoded key required for the HMAC signature of the BIND message /// Base64 encoded representation of an encrypted connection data blob describing this allocation. Required for establishing communication with other players. /// Base64 encoded form of AllocationID. When decoded, this is the exact expected byte alignment to be used when crafting relay protocol messages that require AllocationID. eg. PING, CONNECT, RELAY, CLOSE, etc. /// [Preserve] [DataContract(Name = "Allocation")] public class Allocation { /// /// Details of an allocation to a relay server /// /// ID of the allocation /// Connection endpoints for the assigned relay server /// relayServer param /// Base64-encoded key required for the HMAC signature of the BIND message /// Base64 encoded representation of an encrypted connection data blob describing this allocation. Required for establishing communication with other players. /// Base64 encoded form of AllocationID. When decoded, this is the exact expected byte alignment to be used when crafting relay protocol messages that require AllocationID. eg. PING, CONNECT, RELAY, CLOSE, etc. [Preserve] public Allocation(System.Guid allocationId, List serverEndpoints, RelayServer relayServer, byte[] key, byte[] connectionData, byte[] allocationIdBytes) { AllocationId = allocationId; ServerEndpoints = serverEndpoints; RelayServer = relayServer; Key = key; ConnectionData = connectionData; AllocationIdBytes = allocationIdBytes; } /// /// ID of the allocation /// [Preserve] [DataMember(Name = "allocationId", IsRequired = true, EmitDefaultValue = true)] public System.Guid AllocationId{ get; } /// /// Connection endpoints for the assigned relay server /// [Preserve] [DataMember(Name = "serverEndpoints", IsRequired = true, EmitDefaultValue = true)] public List ServerEndpoints{ get; } [Preserve] [DataMember(Name = "relayServer", IsRequired = true, EmitDefaultValue = true)] public RelayServer RelayServer{ get; } /// /// Base64-encoded key required for the HMAC signature of the BIND message /// [Preserve] [DataMember(Name = "key", IsRequired = true, EmitDefaultValue = true)] public byte[] Key{ get; } /// /// Base64 encoded representation of an encrypted connection data blob describing this allocation. Required for establishing communication with other players. /// [Preserve] [DataMember(Name = "connectionData", IsRequired = true, EmitDefaultValue = true)] public byte[] ConnectionData{ get; } /// /// Base64 encoded form of AllocationID. When decoded, this is the exact expected byte alignment to be used when crafting relay protocol messages that require AllocationID. eg. PING, CONNECT, RELAY, CLOSE, etc. /// [Preserve] [DataMember(Name = "allocationIdBytes", IsRequired = true, EmitDefaultValue = true)] public byte[] AllocationIdBytes{ get; } } }