Struct RelayServerData
Connection information about the relay server.
Inherited Members
Namespace: Unity.Networking.Transport.Relay
Syntax
public struct RelayServerData
Constructors
RelayServerData(String, UInt16, Byte[], Byte[], Byte[], Byte[], Boolean)
Create a new Relay server data structure.
Declaration
public RelayServerData(string host, ushort port, byte[] allocationId, byte[] connectionData, byte[] hostConnectionData, byte[] key, bool isSecure)
Parameters
| Type | Name | Description |
|---|---|---|
| String | host | IP address or hostname of the Relay server. |
| UInt16 | port | Port of the Relay server. |
| Byte[] | allocationId | ID of the Relay allocation. |
| Byte[] | connectionData | Connection data of the allocation. |
| Byte[] | hostConnectionData | Connection data of the host (same as previous for hosts). |
| Byte[] | key | HMAC signature of the allocation. |
| Boolean | isSecure | Whether the Relay connection is to be secured or not. |
Remarks
If a hostname is provided as the "host" parameter, this constructor will perform a DNS
resolution to map it to an IP address. If the hostname is not in the OS cache, this
operation can possibly block for a long time (between 20 and 120 milliseconds). If this
is a concern, perform the DNS resolution asynchronously and pass in the resulting IP
address directly (for example with System.Net.Dns.GetHostEntryAsync").
RelayServerData(ref NetworkEndpoint, UInt16, ref RelayAllocationId, ref RelayConnectionData, ref RelayConnectionData, ref RelayHMACKey, Boolean)
Create a new Relay server data structure (low-level constructor).
Declaration
public RelayServerData(ref NetworkEndpoint endpoint, ushort nonce, ref RelayAllocationId allocationId, ref RelayConnectionData connectionData, ref RelayConnectionData hostConnectionData, ref RelayHMACKey key, bool isSecure)
Parameters
| Type | Name | Description |
|---|---|---|
| NetworkEndpoint | endpoint | Endpoint of the Relay server. |
| UInt16 | nonce | Nonce used in connection handshake (preferably random). |
| RelayAllocationId | allocationId | ID of the Relay allocation. |
| RelayConnectionData | connectionData | Connection data of the allocation. |
| RelayConnectionData | hostConnectionData | Connection data of the host (use default for hosts). |
| RelayHMACKey | key | HMAC signature of the allocation. |
| Boolean | isSecure | Whether the Relay connection is to be secured or not. |
Fields
AllocationId
Allocation ID for the server connection.
Declaration
public RelayAllocationId AllocationId
Field Value
| Type | Description |
|---|---|
| RelayAllocationId | Allocation ID. |
ConnectionData
Connection data of the allocation.
Declaration
public RelayConnectionData ConnectionData
Field Value
| Type | Description |
|---|---|
| RelayConnectionData | Connection data structure. |
Endpoint
Endpoint the relay server can be reached on.
Declaration
public NetworkEndpoint Endpoint
Field Value
| Type | Description |
|---|---|
| NetworkEndpoint | Server endpoint (IP address and port). |
HMACKey
HMAC key used to authentify the connection.
Declaration
public RelayHMACKey HMACKey
Field Value
| Type | Description |
|---|---|
| RelayHMACKey | HMAC key. |
HostConnectionData
Connection data of the host.
Declaration
public RelayConnectionData HostConnectionData
Field Value
| Type | Description |
|---|---|
| RelayConnectionData | Connection data structure. |
IsSecure
Whether the connection is using a secure protocol or not.
Declaration
public readonly byte IsSecure
Field Value
| Type | Description |
|---|---|
| Byte | True if using DTLS or WSS, false if using UDP. |
Nonce
Nonce that will be used in the connection handshake.
Declaration
public ushort Nonce
Field Value
| Type | Description |
|---|---|
| UInt16 | HMAC key nonce. |
Methods
IncrementNonce()
Increment the nonce and recompute the HMAC.
Declaration
public void IncrementNonce()