Class TurnServer
An TURN/STUN server.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class TurnServer : StunServer
Constructors
TurnServer(Function1<TurnAuthArgs, TurnAuthResult>)
Initializes a new instance of the Turn
Declaration
public TurnServer(Function1<TurnAuthArgs, TurnAuthResult> authCallback)
Parameters
Type | Name | Description |
---|---|---|
Function1<Turn |
authCallback | The authentication callback. |
Properties
AllocationCount
Gets the number of active allocations.
Declaration
public int AllocationCount { get; }
Property Value
Type | Description |
---|---|
System. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
Label
Gets the label.
Declaration
protected override string Label { get; }
Property Value
Type | Description |
---|---|
System. |
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. |
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. |
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. |
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. |
Nonce
Gets or sets the current nonce.
Declaration
public string Nonce { get; }
Property Value
Type | Description |
---|---|
System. |
Realm
Gets or sets the realm used for this server.
Declaration
public string Realm { get; set; }
Property Value
Type | Description |
---|---|
System. |
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. |
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. |
Transport |
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. |
Datagram |
udpServerSocket | The UDP server socket. |
Stream |
tcpServerSocket | The TCP server socket. |
Server |
localAddress | The local address. |
Transport |
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 |
---|---|---|
Data |
buffer | The buffer. |
Datagram |
udpServerSocket | The UDP server socket. |
Stream |
tcpServerSocket | The TCP server socket. |
Server |
localAddress | The local address. |
Transport |
remoteAddress | The remote address. |
System. |
readLength | Length of the read. |
Returns
Type | Description |
---|---|
System. |
Overrides
Start(ServerAddress[], ServerAddress[], ServerAddress[])
Starts the server.
Declaration
public override bool Start(ServerAddress[] udpAddresses, ServerAddress[] tcpAddresses, ServerAddress[] tlsAddresses)
Parameters
Type | Name | Description |
---|---|---|
Server |
udpAddresses | The UDP addresses to listen on. |
Server |
tcpAddresses | The TCP addresses to listen on. |
Server |
tlsAddresses | The TLS addresses to listen on. |
Returns
Type | Description |
---|---|
System. |
Overrides
Stop()
Stops the server.
Declaration
public override bool Stop()
Returns
Type | Description |
---|---|
System. |