Class TurnServer
An TURN/STUN server.
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class TurnServer : StunServer, IEquatable<NSObject>, INSObjectProtocol, INativeObject, IDisposable
Constructors
TurnServer(Function1<TurnAuthArgs, TurnAuthResult>)
Initializes a new instance of the TurnServer class.
Declaration
public TurnServer(Function1<TurnAuthArgs, TurnAuthResult> authCallback)
Parameters
Type | Name | Description |
---|---|---|
Function1<TurnAuthArgs, TurnAuthResult> | authCallback | The authentication callback. |
Properties
AllocationCount
Gets the number of active allocations.
Declaration
public int AllocationCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
AllocationPortMax
Gets or sets the maximum allowed port to be used when allocating sockets. The default value is 65535.
Declaration
public int AllocationPortMax { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
AllocationPortMin
Gets or sets the minimum allowed port to be used when allocating sockets. The default value is 49152.
Declaration
public int AllocationPortMin { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
DefaultAllocateLifetime
Gets or sets the default lifetime for new allocations in seconds. Defaults to 600 (10 minutes).
Declaration
public long DefaultAllocateLifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
DefaultRefreshLifetime
Gets or sets the default lifetime for refreshed allocations in seconds. Defaults to 600 (10 minutes).
Declaration
public long DefaultRefreshLifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
DisableBypass
Gets or sets a value indicating whether to disable the in-memory bypass of the network when communicating between two relay candidates.
Declaration
public bool DisableBypass { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ForbiddenPeerCidrs
Gets or sets the list of forbidden peer CIDRs. Addresses matching this list are banned from receiving relayed data packets.
Declaration
public string[] ForbiddenPeerCidrs { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
ForceDefaultAllocateLifetime
Gets or sets whether the server should force the default lifetime for new allocations (true) or allow clients to request their own lifetime within the min/max range (false). Defaults to false.
Declaration
public bool ForceDefaultAllocateLifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ForceDefaultRefreshLifetime
Gets or sets whether the server should force the default lifetime for refreshed allocations (true) or allow clients to request their own lifetime within the min/max range (false). Defaults to false.
Declaration
public bool ForceDefaultRefreshLifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Label
Gets the label.
Declaration
protected override string Label { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
MaxAllocateLifetime
Gets or sets the maximum lifetime for new allocations in seconds. Defaults to 3600 (1 hour).
Declaration
public long MaxAllocateLifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
MaxRefreshLifetime
Gets or sets the maximum lifetime for refreshed allocations in seconds. Defaults to 3600 (1 hour).
Declaration
public long MaxRefreshLifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
MinAllocateLifetime
Gets the minimum lifetime for new allocations in seconds. Equal to 600 (10 minutes).
Declaration
public long MinAllocateLifetime { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
MinRefreshLifetime
Gets the minimum lifetime for refreshed allocations in seconds. Equal to 600 (10 minutes).
Declaration
public long MinRefreshLifetime { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Nonce
Gets or sets the current nonce.
Declaration
public string Nonce { get; }
Property Value
Type | Description |
---|---|
System.String |
Realm
Gets or sets the realm used for this server.
Declaration
public string Realm { get; set; }
Property Value
Type | Description |
---|---|
System.String |
StaleNonceSecurity
Gets or sets whether the server should enforce stale-nonce security by sending a 438 Stale Nonce in response to allocate requests with a stale or non-existent nonce.
Declaration
public bool StaleNonceSecurity { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
CreateExceptionResponse(Message, TransportAddress, Error)
Creates an exception response.
Declaration
protected override Message CreateExceptionResponse(Message request, TransportAddress remoteAddress, Error error)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
TransportAddress | remoteAddress | The remote address. |
Error | error | The error. |
Returns
Type | Description |
---|---|
Message |
Overrides
Process(Message, DatagramSocket, StreamSocket, ServerAddress, TransportAddress)
Processes the specified request.
Declaration
protected override Message Process(Message request, DatagramSocket udpServerSocket, StreamSocket tcpServerSocket, ServerAddress localAddress, TransportAddress remoteAddress)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
DatagramSocket | udpServerSocket | The UDP server socket. |
StreamSocket | tcpServerSocket | The TCP server socket. |
ServerAddress | localAddress | The local address. |
TransportAddress | remoteAddress | The remote address. |
Returns
Type | Description |
---|---|
Message |
Overrides
ProcessBuffer(DataBuffer, DatagramSocket, StreamSocket, ServerAddress, TransportAddress, out Int32)
Processes the buffer.
Declaration
protected override bool ProcessBuffer(DataBuffer buffer, DatagramSocket udpServerSocket, StreamSocket tcpServerSocket, ServerAddress localAddress, TransportAddress remoteAddress, out int readLength)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer. |
DatagramSocket | udpServerSocket | The UDP server socket. |
StreamSocket | tcpServerSocket | The TCP server socket. |
ServerAddress | localAddress | The local address. |
TransportAddress | remoteAddress | The remote address. |
System.Int32 | readLength | Length of the read. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Start(ServerAddress[], ServerAddress[], ServerAddress[])
Starts the server.
Declaration
public override bool Start(ServerAddress[] udpAddresses, ServerAddress[] tcpAddresses, ServerAddress[] tlsAddresses)
Parameters
Type | Name | Description |
---|---|---|
ServerAddress[] | udpAddresses | The UDP addresses to listen on. |
ServerAddress[] | tcpAddresses | The TCP addresses to listen on. |
ServerAddress[] | tlsAddresses | The TLS addresses to listen on. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Stop()
Stops the server.
Declaration
public override bool Stop()
Returns
Type | Description |
---|---|
System.Boolean |