StellaOps.Router.Transport.Tls.Server

Router TLS transport, server side: the listener a gateway accepts microservice connections with, with server certificate reload and client certificate validation.

PackageStellaOps.Router.Transport.Tls.Server
ComponentRouter
LicenceBUSL-1.1 (Router licence)
Package kindLibrary
Target frameworknet10.0

To add the package to a project, see Installing Stella Ops packages.

Namespaces

NamespaceTypes
StellaOps.Router.Transport.Tls.Server3

StellaOps.Router.Transport.Tls.Server namespace

TypeKindDescription
TlsTransportServerclassTLS transport server implementation for the gateway.
TlsTransportServerPluginclassPlugin for the server side of the TLS transport, which a gateway listens with.
TlsTransportServerServiceCollectionExtensionsclassExtension methods for registering the server side of the TLS transport.

TlsTransportServer class

public sealed class TlsTransportServer : IGatewayConnectionTransportServer, IAsyncDisposable

TLS transport server implementation for the gateway.

TlsTransportServer(IOptions<TlsTransportOptions>, ILogger<TlsTransportServer>) constructor

public TlsTransportServer(IOptions<TlsTransportOptions> options, ILogger<TlsTransportServer> logger)

Initializes a new instance of the TlsTransportServerclass.

ConnectionCount property

public int ConnectionCount { get; }

Gets the number of active connections.

TransportType property

public TransportType TransportType { get; }

The transport this server provides.

OnConnection event

public event Action<string, ConnectionState>? OnConnection

Event raised when a connection is established.

OnDisconnection event

public event Action<string>? OnDisconnection

Event raised when a connection is lost.

OnFrame event

public event Action<string, Frame>? OnFrame

Event raised when a frame is received.

CloseConnection(string) method

public bool CloseConnection(string connectionId)

Closes a connection.

Parameters

Returns

true when the connection existed and was closed.

DisposeAsync() method

public ValueTask DisposeAsync()

See IAsyncDisposable.DisposeAsync().

GetConnection(string) method

public TlsConnection? GetConnection(string connectionId)

Gets a connection by ID.

Parameters

Returns

The connection, or null if not found.

GetConnections() method

public IEnumerable<TlsConnection> GetConnections()

Gets all active connections.

SendFrameAsync(string, Frame, CancellationToken) method

public Task SendFrameAsync(string connectionId, Frame frame, CancellationToken cancellationToken = default)

Sends a frame to a connection.

Parameters

StartAsync(CancellationToken) method

public Task StartAsync(CancellationToken cancellationToken)

Starts listening for incoming connections.

Parameters

StopAsync(CancellationToken) method

public Task StopAsync(CancellationToken cancellationToken)

Stops accepting new connections.

Parameters

TlsTransportServerPlugin class

public sealed class TlsTransportServerPlugin : IRouterTransportPlugin

Plugin for the server side of the TLS transport, which a gateway listens with. The client side is TlsTransportPluginin StellaOps.Router.Transport.Tls; both carry the transport name tls.

TlsTransportServerPlugin() constructor

public TlsTransportServerPlugin()

Creates an instance of TlsTransportServerPlugin.

DisplayName property

public string DisplayName { get; }

Gets the human-readable display name for this transport.

Mode property

public RouterTransportMode Mode { get; }

Gets the side of the transport this plugin registers: RouterTransportMode.Client, RouterTransportMode.Server, or RouterTransportMode.Both. IRouterTransportPlugin.Register(RouterTransportRegistrationContext)refuses a context that asks for a side outside this value (RouterTransportRegistrationContext.EnsureSupportedBy(IRouterTransportPlugin)).

TransportName property

public string TransportName { get; }

Gets the transport name (e.g., “tcp”, “tls”, “udp”, “rabbitmq”, “inmemory”, “messaging”), shared by the client and the server plugin of one transport.

Register(RouterTransportRegistrationContext) method

public void Register(RouterTransportRegistrationContext context)

Registers transport services into the DI container for the side the context asks for.

Parameters

Exceptions

TlsTransportServerServiceCollectionExtensions class

public static class TlsTransportServerServiceCollectionExtensions

Extension methods for registering the server side of the TLS transport.

AddTlsTransportServer(IServiceCollection, Action<TlsTransportOptions>) extension method

public static IServiceCollection AddTlsTransportServer(this IServiceCollection services, Action<TlsTransportOptions>? configure = null)

Adds the TLS transport server to the service collection.

Parameters

Returns

The service collection.