Class TurnServerHost
Runs a TurnServer in a .NET host when Enabled is set, with the credentials of the settings and of every ITurnAuthenticator registered in the host, e.g. a homeserver's own secret.
Inherited Members
Namespace: Uniform.Stun.Hosting
Assembly: Uniform.Stun.Hosting.dll
Syntax
public sealed class TurnServerHost : IHostedService, IAsyncDisposable
Remarks
Settings that cannot work are logged as errors and leave the server stopped, without stopping the host: a homeserver keeps serving when its TURN settings are wrong. Error tells why.
Constructors
| Edit this page View SourceTurnServerHost(IOptions<TurnOptions>, IEnumerable<ITurnAuthenticator>, ILoggerFactory, TimeProvider?)
Create the host of the server.
Declaration
public TurnServerHost(IOptions<TurnOptions> options, IEnumerable<ITurnAuthenticator> authenticators, ILoggerFactory loggers, TimeProvider? time = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IOptions<TurnOptions> | options | |
| IEnumerable<ITurnAuthenticator> | authenticators | |
| ILoggerFactory | loggers | |
| TimeProvider | time |
Properties
| Edit this page View SourceError
Why the server did not start although enabled; null otherwise.
Declaration
public string? Error { get; }
Property Value
| Type | Description |
|---|---|
| string |
Server
The running server; null when disabled or not started.
Declaration
public TurnServer? Server { get; }
Property Value
| Type | Description |
|---|---|
| TurnServer |
Methods
| Edit this page View SourceDisposeAsync()
Stop the server.
Declaration
public ValueTask DisposeAsync()
Returns
| Type | Description |
|---|---|
| ValueTask |
StartAsync(CancellationToken)
Start the server when enabled; errors of the settings are logged and kept in Error.
Declaration
public Task StartAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
StopAsync(CancellationToken)
Stop the server.
Declaration
public Task StopAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |