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 { /// /// Endpoint connection details for a relay server /// Canonical connection type /// IP network (udp, tcp) /// Is the delivery of data guaranteed /// Is the endpoint secured /// Host name or address of the relay server /// Port number /// [Preserve] [DataContract(Name = "RelayServerEndpoint")] public class RelayServerEndpoint { /// /// Endpoint connection details for a relay server /// /// Canonical connection type /// IP network (udp, tcp) /// Is the delivery of data guaranteed /// Is the endpoint secured /// Host name or address of the relay server /// Port number [Preserve] public RelayServerEndpoint(string connectionType, NetworkOptions network, bool reliable, bool secure, string host, int port) { ConnectionType = connectionType; Network = network; Reliable = reliable; Secure = secure; Host = host; Port = port; } /// /// Canonical connection type /// [Preserve] [DataMember(Name = "connectionType", IsRequired = true, EmitDefaultValue = true)] public string ConnectionType{ get; } /// /// IP network (udp, tcp) /// [Preserve] [JsonConverter(typeof(StringEnumConverter))] [DataMember(Name = "network", IsRequired = true, EmitDefaultValue = true)] public NetworkOptions Network{ get; } /// /// Is the delivery of data guaranteed /// [Preserve] [DataMember(Name = "reliable", IsRequired = true, EmitDefaultValue = true)] public bool Reliable{ get; } /// /// Is the endpoint secured /// [Preserve] [DataMember(Name = "secure", IsRequired = true, EmitDefaultValue = true)] public bool Secure{ get; } /// /// Host name or address of the relay server /// [Preserve] [DataMember(Name = "host", IsRequired = true, EmitDefaultValue = true)] public string Host{ get; } /// /// Port number /// [Preserve] [DataMember(Name = "port", IsRequired = true, EmitDefaultValue = true)] public int Port{ get; } /// /// IP network (udp, tcp) /// /// IP network (udp, tcp) [Preserve] [JsonConverter(typeof(StringEnumConverter))] public enum NetworkOptions { /// /// Enum Udp for value: udp /// [EnumMember(Value = "udp")] Udp = 1, /// /// Enum Tcp for value: tcp /// [EnumMember(Value = "tcp")] Tcp = 2 } } }