StellaOps.Router.Transport.Tls
Router TLS transport, client side: connects a microservice to a gateway over TLS, with client certificates. Install Installing Stella Ops packagesRouter downloads and signaturesnet10.01.0.1-20261117T070237Zdotnet add package StellaOps.
Namespaces
| Namespace | Types |
|---|---|
StellaOps. | 12 |
namespace StellaOps.Router.Transport.Tls
| Type | Kind | Description |
|---|---|---|
CertificateLoader | class | Utility class for loading certificates from various sources. |
CertificatePinningOptions | class | Certificate pinning configuration. |
CertificateWatcher | class | Watches certificate files for changes and triggers hot-reload. |
TlsCertificateValidator | class | Strict TLS certificate validator. |
TlsCertificateValidator. | class | Reason codes used in log messages and the rejection counter. |
TlsConnection | class | Represents a TLS-secured connection to a microservice. |
TlsTransportClient | class | TLS transport client implementation for microservices. |
TlsTransportClientServiceCollectionExtensions | class | Extension methods for registering TLS transport services. |
TlsTransportOptions | class | Options for TLS transport configuration. |
TlsTransportPlugin | class | Plugin for the client side of the TLS transport, which a microservice connects with. |
TlsValidationDecision | enum | Decision returned by TlsCertificateValidator.. |
TlsValidationResult | struct | Result of running the validator: an TlsValidationDecisionplus a machine-readable rejection reason for logging and the router_ counter. |
class CertificateLoader
public static class CertificateLoader
Utility class for loading certificates from various sources.
Members
| Member | Kind | Summary |
|---|---|---|
LoadCertificateFromPath( | method | Loads a certificate from a file path. |
LoadClientCertificate( | method | Loads a client certificate from the options. |
LoadServerCertificate( | method | Loads a server certificate from the options. |
method LoadCertificateFromPath(string, string, string) #
LoadCertificateFromPath(string, string, string) #public static X509Certificate2 LoadCertificateFromPath(string certPath, string? keyPath = null, string? password = null)
Loads a certificate from a file path.
Parameters
certPath: The certificate path (PEM or PFX).keyPath: The private key path (optional, for PEM).password: The password (optional, for PFX).
Returns
The loaded certificate.
method LoadClientCertificate(TlsTransportOptions) #
LoadClientCertificate(TlsTransportOptions) #public static X509Certificate2? LoadClientCertificate(TlsTransportOptions options)
Loads a client certificate from the options.
Parameters
options: The TLS transport options.
Returns
The loaded certificate, or null if not configured.
method LoadServerCertificate(TlsTransportOptions) #
LoadServerCertificate(TlsTransportOptions) #public static X509Certificate2 LoadServerCertificate(TlsTransportOptions options)
Loads a server certificate from the options.
Parameters
options: The TLS transport options.
Returns
The loaded certificate.
Exceptions
Invalid: Thrown when no certificate is configured.Operation Exception
class CertificatePinningOptions
public sealed class CertificatePinningOptions
Certificate pinning configuration. Required when TlsTransportOptions.is true — otherwise the validator would accept any self-signed certificate.
At least one of the three pin sets must be non-empty when self-signed acceptance is enabled. Pin matching is any-of: a presented certificate is acceptable when its SHA-256 thumbprint OR its subject DN OR any of its SAN DNS entries matches an entry in the corresponding allowlist.
Recommended posture, in tightening order: 1. CertificatePinningOptions.only (leaf-pinning; rotates require config update) 2. Subject pinning to a private CA (leaf rotation without re-pinning) 3. SAN allowlist (loosest; relies on operator-issued cert names)
Members
| Member | Kind | Summary |
|---|---|---|
CertificatePinningOptions( | constructor | Creates an instance of Certificate. |
AllowedSans | property | Allowed Subject Alternative Name DNS entries. |
AllowedSubjects | property | Allowed subject distinguished names. |
IsEmpty | property | Returns true when no pin entries are configured at all. |
ThumbprintsSha256 | property | Allowed certificate SHA-256 thumbprints, hex-encoded (case-insensitive on input, normalised to upper-case for matching). |
constructor CertificatePinningOptions() #
CertificatePinningOptions() #public CertificatePinningOptions()
Creates an instance of Certificate.
property AllowedSans #
AllowedSans #public IReadOnlyList<string> AllowedSans { get; init; }
Allowed Subject Alternative Name DNS entries. Compared via String against entries extracted from the cert’s SAN extension. Wildcard entries are not expanded — provide the exact value.
property AllowedSubjects #
AllowedSubjects #public IReadOnlyList<string> AllowedSubjects { get; init; }
Allowed subject distinguished names. Compared via String against X509. Use the exact RFC-2253 form emitted by .NET (e.g. CN=service-a, O=stellaops).
property IsEmpty #
IsEmpty #public bool IsEmpty { get; }
Returns true when no pin entries are configured at all.
property ThumbprintsSha256 #
ThumbprintsSha256 #public IReadOnlyList<string> ThumbprintsSha256 { get; init; }
Allowed certificate SHA-256 thumbprints, hex-encoded (case-insensitive on input, normalised to upper-case for matching). Matching uses String after normalisation. An empty/whitespace string is ignored.
class CertificateWatcher
public sealed class CertificateWatcher : IDisposable
Watches certificate files for changes and triggers hot-reload.
Members
| Member | Kind | Summary |
|---|---|---|
CertificateWatcher( | constructor | Initializes a new instance of the CertificateWatcherclass. |
ClientCertificate | property | Gets the current client certificate. |
ServerCertificate | property | Gets the current server certificate. |
OnClientCertificateReloaded | event | Event raised when the client certificate is reloaded. |
OnServerCertificateReloaded | event | Event raised when the server certificate is reloaded. |
Dispose( | method | See IDisposable.. |
constructor CertificateWatcher(TlsTransportOptions, ILogger) #
CertificateWatcher(TlsTransportOptions, ILogger) #public CertificateWatcher(TlsTransportOptions options, ILogger logger)
Initializes a new instance of the CertificateWatcherclass.
property ClientCertificate #
ClientCertificate #public X509Certificate2? ClientCertificate { get; }
Gets the current client certificate.
property ServerCertificate #
ServerCertificate #public X509Certificate2? ServerCertificate { get; }
Gets the current server certificate.
event OnClientCertificateReloaded #
OnClientCertificateReloaded #public event Action<X509Certificate2>? OnClientCertificateReloaded
Event raised when the client certificate is reloaded.
event OnServerCertificateReloaded #
OnServerCertificateReloaded #public event Action<X509Certificate2>? OnServerCertificateReloaded
Event raised when the server certificate is reloaded.
method Dispose() #
Dispose() #public void Dispose()
See IDisposable..
class TlsCertificateValidator
public static class TlsCertificateValidator
Strict TLS certificate validator.
Rules, in order: 1. Errors include Ssl -> reject. 2. Errors include Ssl -> reject unconditionally, regardless of AllowSelfSigned. 3. Errors include Ssl: - When Allow: reject. - When AllowSelfSigned=true: accept only if the chain status is exactly X509 or X509 (no other status flags) AND the certificate matches the configured pin set. 4. No errors -> accept.
Both sides of the TLS transport apply it: the client to the gateway’s server certificate and the server (Stella) to a microservice’s client certificate.
Members
| Member | Kind | Summary |
|---|---|---|
MeterName | constant | Meter name for OpenTelemetry exporters. |
Validate( | method | Runs the validator and emits structured-log + counter side effects on rejection. |
constant MeterName #
MeterName #public const string MeterName = "StellaOps.Router.Transport.Tls"
Meter name for OpenTelemetry exporters.
method Validate(X509Certificate, X509Chain, SslPolicyErrors, TlsTransportOptions, bool, string, ILogger) #
Validate(X509Certificate, X509Chain, SslPolicyErrors, TlsTransportOptions, bool, string, ILogger) #public static TlsValidationResult Validate(X509Certificate? certificate, X509Chain? chain, SslPolicyErrors errors, TlsTransportOptions options, bool requireCertificate, string role, ILogger logger)
Runs the validator and emits structured-log + counter side effects on rejection.
Parameters
certificate: The presented peer certificate, ornull.chain: The chain object built bySslStream.errors: The errors raised by the platform validator.options: The transport options carrying pinning / self-signed config.requireCertificate: Whether absence of a certificate is itself a rejection (server side: mTLS required; client side: always required since the gateway always presents one).role: Either"client_certificate"or"server_certificate"; emitted on the counter and in log messages so server-side and client-side rejections can be distinguished in metrics.logger: Logger for warning-level rejection messages.
class TlsCertificateValidator.Reasons
public static class Reasons
Reason codes used in log messages and the rejection counter.
Members
| Member | Kind | Summary |
|---|---|---|
CertificateRequiredButMissing | constant | A certificate is required and the peer presented none. |
ChainErrorAndSelfSignedDisallowed | constant | The chain does not validate and self-signed certificates are not allowed. |
ChainStatusNotPermitted | constant | The chain status is other than an untrusted root or a partial chain. |
NameMismatch | constant | The certificate name does not match the peer. |
OtherSslPolicyError | constant | Another TLS policy error. |
PinMismatch | constant | The certificate matches no configured pin. |
PinSetEmpty | constant | Self-signed certificates are allowed but no pin is configured. |
RemoteCertificateNotAvailable | constant | The platform reported that the remote certificate is not available. |
constant CertificateRequiredButMissing #
CertificateRequiredButMissing #public const string CertificateRequiredButMissing = "certificate_required_but_missing"
A certificate is required and the peer presented none.
constant ChainErrorAndSelfSignedDisallowed #
ChainErrorAndSelfSignedDisallowed #public const string ChainErrorAndSelfSignedDisallowed = "chain_error_and_self_signed_disallowed"
The chain does not validate and self-signed certificates are not allowed.
constant ChainStatusNotPermitted #
ChainStatusNotPermitted #public const string ChainStatusNotPermitted = "chain_status_not_permitted"
The chain status is other than an untrusted root or a partial chain.
constant NameMismatch #
NameMismatch #public const string NameMismatch = "name_mismatch"
The certificate name does not match the peer.
constant OtherSslPolicyError #
OtherSslPolicyError #public const string OtherSslPolicyError = "other_ssl_policy_error"
Another TLS policy error.
constant PinMismatch #
PinMismatch #public const string PinMismatch = "pin_mismatch"
The certificate matches no configured pin.
constant PinSetEmpty #
PinSetEmpty #public const string PinSetEmpty = "pin_set_empty"
Self-signed certificates are allowed but no pin is configured.
constant RemoteCertificateNotAvailable #
RemoteCertificateNotAvailable #public const string RemoteCertificateNotAvailable = "remote_certificate_not_available"
The platform reported that the remote certificate is not available.
class TlsConnection
public sealed class TlsConnection : IAsyncDisposable
Represents a TLS-secured connection to a microservice.
Members
| Member | Kind | Summary |
|---|---|---|
TlsConnection( | constructor | Initializes a new instance of the TlsConnectionclass. |
ConnectionId | property | Gets the connection ID. |
ConnectionToken | property | Gets the cancellation token for this connection. |
IsConnected | property | Gets a value indicating whether the connection is active. |
PeerIdentity | property | Gets the peer identity extracted from the certificate. |
RemoteCertificate | property | Gets the remote certificate (if mTLS). |
RemoteEndpoint | property | Gets the remote endpoint as a string. |
State | property | Gets the connection state. |
OnDisconnected | event | Event raised when the connection is closed. |
OnFrameReceived | event | Event raised when a frame is received. |
Close( | method | Closes the connection. |
DisposeAsync( | method | See IAsync. |
ReadLoopAsync( | method | Starts the read loop to receive frames. |
WriteFrameAsync( | method | Writes a frame to the connection. |
constructor TlsConnection(string, TcpClient, SslStream, TlsTransportOptions, ILogger) #
TlsConnection(string, TcpClient, SslStream, TlsTransportOptions, ILogger) #public TlsConnection(string connectionId, TcpClient client, SslStream sslStream, TlsTransportOptions options, ILogger logger)
Initializes a new instance of the TlsConnectionclass.
property ConnectionId #
ConnectionId #public string ConnectionId { get; }
Gets the connection ID.
property ConnectionToken #
ConnectionToken #public CancellationToken ConnectionToken { get; }
Gets the cancellation token for this connection.
property IsConnected #
IsConnected #public bool IsConnected { get; }
Gets a value indicating whether the connection is active.
property PeerIdentity #
PeerIdentity #public string? PeerIdentity { get; }
Gets the peer identity extracted from the certificate.
property RemoteCertificate #
RemoteCertificate #public X509Certificate? RemoteCertificate { get; }
Gets the remote certificate (if mTLS).
property RemoteEndpoint #
RemoteEndpoint #public string RemoteEndpoint { get; }
Gets the remote endpoint as a string.
property State #
State #public ConnectionState? State { get; set; }
Gets the connection state.
event OnDisconnected #
OnDisconnected #public event Action<TlsConnection, Exception?>? OnDisconnected
Event raised when the connection is closed.
event OnFrameReceived #
OnFrameReceived #public event Action<TlsConnection, Frame>? OnFrameReceived
Event raised when a frame is received.
method Close() #
Close() #public void Close()
Closes the connection.
method DisposeAsync() #
DisposeAsync() #public ValueTask DisposeAsync()
See IAsync.
method ReadLoopAsync(CancellationToken) #
ReadLoopAsync(CancellationToken) #public Task ReadLoopAsync(CancellationToken cancellationToken)
Starts the read loop to receive frames.
Parameters
cancellationToken: Cancellation token.
method WriteFrameAsync(Frame, CancellationToken) #
WriteFrameAsync(Frame, CancellationToken) #public Task WriteFrameAsync(Frame frame, CancellationToken cancellationToken = default)
Writes a frame to the connection.
Parameters
frame: The frame to write.cancellationToken: Cancellation token.
class TlsTransportClient
public sealed class TlsTransportClient : ITransportClient, IMicroserviceTransport, IAsyncDisposable
TLS transport client implementation for microservices.
Members
constructor TlsTransportClient(IOptions<TlsTransportOptions>, ILogger<TlsTransportClient>) #
TlsTransportClient(IOptions<TlsTransportOptions>, ILogger<TlsTransportClient>) #public TlsTransportClient(IOptions<TlsTransportOptions> options, ILogger<TlsTransportClient> logger)
Initializes a new instance of the TlsTransportClientclass.
event OnCancelReceived #
OnCancelReceived #public event Func<Guid, string?, Task>? OnCancelReceived
Event raised when a CANCEL frame is received.
event OnRequestReceived #
OnRequestReceived #public event Func<Frame, CancellationToken, Task<Frame>>? OnRequestReceived
Event raised when a REQUEST frame is received.
event TransportDied #
TransportDied #public event Action? TransportDied
Raised once when the connection is lost and TlsTransportOptions.reconnects have failed. The service’s connection manager then connects again with its own back-off until the gateway answers or the service stops.
method CancelAllInflight(string) #
CancelAllInflight(string) #public void CancelAllInflight(string reason)
Cancels all in-flight handlers.
method ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, CancellationToken) #
ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, CancellationToken) #public Task ConnectAsync(InstanceDescriptor instance, IReadOnlyList<EndpointDescriptor> endpoints, CancellationToken cancellationToken)
Connects to the gateway.
Parameters
instance: The instance descriptor.endpoints: The endpoints to register.cancellationToken: Cancellation token.
method ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo, CancellationToken) #
ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo, CancellationToken) #public Task ConnectAsync(InstanceDescriptor instance, IReadOnlyList<EndpointDescriptor> endpoints, IReadOnlyDictionary<string, SchemaDefinition>? schemas, ServiceOpenApiInfo? openApiInfo, CancellationToken cancellationToken)
Connects to the gateway and registers the instance, its endpoints, schemas and OpenAPI metadata in the HELLO frame.
Parameters
instance: The instance descriptor.endpoints: The endpoints to register.schemas: Schema definitions referenced by the endpoints.openApiInfo: OpenAPI metadata for the service.cancellationToken: Cancellation token.
method DisconnectAsync() #
DisconnectAsync() #public Task DisconnectAsync()
Disconnects from the gateway.
method DisposeAsync() #
DisposeAsync() #public ValueTask DisposeAsync()
See IAsync.
method SendCancelAsync(ConnectionState, Guid, string) #
SendCancelAsync(ConnectionState, Guid, string) #public Task SendCancelAsync(ConnectionState connection, Guid correlationId, string? reason = null)
Sends a cancellation request.
Parameters
connection: The connection to use.correlationId: The correlation ID of the request to cancel.reason: Optional reason for cancellation.
method SendHeartbeatAsync(HeartbeatPayload, CancellationToken) #
SendHeartbeatAsync(HeartbeatPayload, CancellationToken) #public Task SendHeartbeatAsync(HeartbeatPayload heartbeat, CancellationToken cancellationToken)
Sends a heartbeat.
method SendRequestAsync(ConnectionState, Frame, TimeSpan, CancellationToken) #
SendRequestAsync(ConnectionState, Frame, TimeSpan, CancellationToken) #public Task<Frame> SendRequestAsync(ConnectionState connection, Frame requestFrame, TimeSpan timeout, CancellationToken cancellationToken)
Sends a request and waits for a response.
Parameters
connection: The connection to use.requestFrame: The request frame.timeout: The timeout for the request.cancellationToken: Cancellation token.
Returns
The response frame.
method SendStreamingAsync(ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken) #
SendStreamingAsync(ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken) #public Task SendStreamingAsync(ConnectionState connection, Frame requestHeader, Stream requestBody, Func<ResponseFrame, Stream, Task> readResponse, PayloadLimits limits, CancellationToken cancellationToken)
Sends a request whose body is read from a stream and hands the microservice’s response to readResponse. TransportStreamingDispatch.implements it for transports whose microservice side answers a request with one response frame.
Parameters
connection: The connection to use.requestHeader: The request header frame.requestBody: The request body stream.readResponse: Callback that receives the response head (the status code and headers of the microservice’s response; itsResponseFrame.is empty) and the response body stream.Payload limits: Payload limits to enforce.cancellationToken: Cancellation token.
Remarks
Sends the request body in one request frame (TransportStreamingDispatch.).
class TlsTransportClientServiceCollectionExtensions
public static class TlsTransportClientServiceCollectionExtensions
Extension methods for registering TLS transport services.
Members
| Member | Kind | Summary |
|---|---|---|
AddTlsTransportClient( | extension method | Adds the TLS transport client to the service collection. |
extension method AddTlsTransportClient(IServiceCollection, Action<TlsTransportOptions>) #
AddTlsTransportClient(IServiceCollection, Action<TlsTransportOptions>) #public static IServiceCollection AddTlsTransportClient(this IServiceCollection services, Action<TlsTransportOptions>? configure = null)
Adds the TLS transport client to the service collection.
Parameters
services: The service collection.configure: Configuration action.
Returns
The service collection.
class TlsTransportOptions
public sealed class TlsTransportOptions
Options for TLS transport configuration.
Members
| Member | Kind | Summary |
|---|---|---|
TlsTransportOptions( | constructor | Creates an instance of TlsTransportOptions. |
AllowSelfSigned | property | Gets or sets whether to allow self-signed certificates (dev only). |
BindAddress | property | Gets or sets the bind address for the server. |
CertificatePinning | property | Certificate pinning configuration. |
CheckCertificateRevocation | property | Gets or sets whether to check certificate revocation. |
ClientCertificate | property | Gets or sets the client certificate object. |
ClientCertificateKeyPath | property | Gets or sets the client certificate key path (PEM private key). |
ClientCertificatePassword | property | Gets or sets the client certificate password (for PFX). |
ClientCertificatePath | property | Gets or sets the client certificate path (PEM or PFX). |
ConnectTimeout | property | Gets or sets the connection timeout. |
EnableCertificateHotReload | property | Gets or sets whether to enable certificate hot-reload. |
EnabledProtocols | property | Gets or sets the enabled SSL/TLS protocols. |
ExpectedServerHostname | property | Gets or sets the expected server hostname (for SNI). |
Host | property | Gets or sets the host to connect to (client only). |
KeepAliveInterval | property | Gets or sets the TCP keep-alive interval of the connection’s socket, on the service and on the gateway: after this long without traffic the operating system probes the peer, probes again every interval and closes the connection after three unanswered probes, so a peer that vanished without closing the connection is noticed. |
MaxFrameSize | property | Gets or sets the maximum frame size. |
MaxReconnectAttempts | property | Gets or sets the number of reconnection attempts after a lost connection, with the capped back-off of TlsTransportOptions.. |
MaxReconnectBackoff | property | Gets or sets the maximum reconnection backoff. |
Port | property | Gets or sets the port to listen on, or the gateway port a client connects to. |
ReceiveBufferSize | property | Gets or sets the receive buffer size. |
RequireClientCertificate | property | Gets or sets whether to require client certificates (mTLS). |
SendBufferSize | property | Gets or sets the send buffer size. |
ServerCertificate | property | Gets or sets the server certificate object. |
ServerCertificateKeyPath | property | Gets or sets the server certificate key path (PEM private key). |
ServerCertificatePassword | property | Gets or sets the server certificate password (for PFX). |
ServerCertificatePath | property | Gets or sets the server certificate path (PEM or PFX). |
Validate( | method | Validates the option combination and throws Invalid if the configuration would accept any self-signed certificate (self-signed acceptance without a pin set). |
constructor TlsTransportOptions() #
TlsTransportOptions() #public TlsTransportOptions()
Creates an instance of TlsTransportOptions.
property AllowSelfSigned #
AllowSelfSigned #public bool AllowSelfSigned { get; set; }
Gets or sets whether to allow self-signed certificates (dev only).
property BindAddress #
BindAddress #public IPAddress BindAddress { get; set; }
Gets or sets the bind address for the server.
property CertificatePinning #
CertificatePinning #public CertificatePinningOptions CertificatePinning { get; set; }
Certificate pinning configuration. Required when TlsTransportOptions.is true: without a pin set, that validator would accept any self-signed certificate, so startup fails with a descriptive error when self-signed acceptance has no pin set.
When TlsTransportOptions.is false, pinning is optional but still applied as a defence-in-depth check on top of standard chain validation.
property CheckCertificateRevocation #
CheckCertificateRevocation #public bool CheckCertificateRevocation { get; set; }
Gets or sets whether to check certificate revocation.
property ClientCertificate #
ClientCertificate #public X509Certificate2? ClientCertificate { get; set; }
Gets or sets the client certificate object.
property ClientCertificateKeyPath #
ClientCertificateKeyPath #public string? ClientCertificateKeyPath { get; set; }
Gets or sets the client certificate key path (PEM private key).
property ClientCertificatePassword #
ClientCertificatePassword #public string? ClientCertificatePassword { get; set; }
Gets or sets the client certificate password (for PFX).
property ClientCertificatePath #
ClientCertificatePath #public string? ClientCertificatePath { get; set; }
Gets or sets the client certificate path (PEM or PFX).
property ConnectTimeout #
ConnectTimeout #public TimeSpan ConnectTimeout { get; set; }
Gets or sets the connection timeout.
property EnableCertificateHotReload #
EnableCertificateHotReload #public bool EnableCertificateHotReload { get; set; }
Gets or sets whether to enable certificate hot-reload.
property EnabledProtocols #
EnabledProtocols #public SslProtocols EnabledProtocols { get; set; }
Gets or sets the enabled SSL/TLS protocols.
property ExpectedServerHostname #
ExpectedServerHostname #public string? ExpectedServerHostname { get; set; }
Gets or sets the expected server hostname (for SNI).
property Host #
Host #public string? Host { get; set; }
Gets or sets the host to connect to (client only).
property KeepAliveInterval #
KeepAliveInterval #public TimeSpan KeepAliveInterval { get; set; }
Gets or sets the TCP keep-alive interval of the connection’s socket, on the service and on the gateway: after this long without traffic the operating system probes the peer, probes again every interval and closes the connection after three unanswered probes, so a peer that vanished without closing the connection is noticed. Zero or a negative value turns keep-alive off. Whole seconds, rounded up. Default: 30 seconds.
property MaxFrameSize #
MaxFrameSize #public int MaxFrameSize { get; set; }
Gets or sets the maximum frame size.
property MaxReconnectAttempts #
MaxReconnectAttempts #public int MaxReconnectAttempts { get; set; }
Gets or sets the number of reconnection attempts after a lost connection, with the capped back-off of TlsTransportOptions.. When they all fail, the client raises TlsTransportClient.and the service’s connection manager connects again with its own back-off until the gateway answers or the service stops; the service is never left disconnected. Default: 10.
property MaxReconnectBackoff #
MaxReconnectBackoff #public TimeSpan MaxReconnectBackoff { get; set; }
Gets or sets the maximum reconnection backoff.
property Port #
Port #public int Port { get; set; }
Gets or sets the port to listen on, or the gateway port a client connects to. Default: TransportDefaultPorts.(9443), the gateway options’ default.
property ReceiveBufferSize #
ReceiveBufferSize #public int ReceiveBufferSize { get; set; }
Gets or sets the receive buffer size.
property RequireClientCertificate #
RequireClientCertificate #public bool RequireClientCertificate { get; set; }
Gets or sets whether to require client certificates (mTLS).
property SendBufferSize #
SendBufferSize #public int SendBufferSize { get; set; }
Gets or sets the send buffer size.
property ServerCertificate #
ServerCertificate #public X509Certificate2? ServerCertificate { get; set; }
Gets or sets the server certificate object.
property ServerCertificateKeyPath #
ServerCertificateKeyPath #public string? ServerCertificateKeyPath { get; set; }
Gets or sets the server certificate key path (PEM private key).
property ServerCertificatePassword #
ServerCertificatePassword #public string? ServerCertificatePassword { get; set; }
Gets or sets the server certificate password (for PFX).
property ServerCertificatePath #
ServerCertificatePath #public string? ServerCertificatePath { get; set; }
Gets or sets the server certificate path (PEM or PFX).
method Validate() #
Validate() #public void Validate()
Validates the option combination and throws Invalid if the configuration would accept any self-signed certificate (self-signed acceptance without a pin set). Called by TlsTransportServer (Stella) and TlsTransportClientat startup.
class TlsTransportPlugin
public sealed class TlsTransportPlugin : IRouterTransportPlugin
Plugin for the client side of the TLS transport, which a microservice connects with. The server side is Tls in Stella; both carry the transport name tls.
Members
| Member | Kind | Summary |
|---|---|---|
TlsTransportPlugin( | constructor | Creates an instance of TlsTransportPlugin. |
DisplayName | property | Gets the human-readable display name for this transport. |
Mode | property | Gets the side of the transport this plugin registers: RouterTransportMode., RouterTransportMode., or RouterTransportMode.. |
TransportName | property | Gets the transport name (e.g., “tcp”, “tls”, “udp”, “rabbitmq”, “inmemory”, “messaging”), shared by the client and the server plugin of one transport. |
Register( | method | Registers transport services into the DI container for the side the context asks for. |
RegisterShared( | method | The registration the client and the server plugin of the TLS transport share: the TlsTransportOptionsbinding of the context’s configuration section (Router:Transport:Tls when the context names none). |
constructor TlsTransportPlugin() #
TlsTransportPlugin() #public TlsTransportPlugin()
Creates an instance of TlsTransportPlugin.
property DisplayName #
DisplayName #public string DisplayName { get; }
Gets the human-readable display name for this transport.
property Mode #
Mode #public RouterTransportMode Mode { get; }
Gets the side of the transport this plugin registers: RouterTransportMode., RouterTransportMode., or RouterTransportMode.. IRouterTransportPlugin.refuses a context that asks for a side outside this value (RouterTransportRegistrationContext.).
property TransportName #
TransportName #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.
method Register(RouterTransportRegistrationContext) #
Register(RouterTransportRegistrationContext) #public void Register(RouterTransportRegistrationContext context)
Registers transport services into the DI container for the side the context asks for.
Parameters
context: The registration context containing services, configuration, and transport mode.
Exceptions
Invalid: The context asks for a side this plugin does not provide.Operation Exception
method RegisterShared(RouterTransportRegistrationContext) #
RegisterShared(RouterTransportRegistrationContext) #public static void RegisterShared(RouterTransportRegistrationContext context)
The registration the client and the server plugin of the TLS transport share: the TlsTransportOptionsbinding of the context’s configuration section (Router:Transport:Tls when the context names none). Both plugins call it from TlsTransportPlugin.; a plugin for either side of the transport calls it the same way.
Parameters
context: The registration context of the plugin.
enum TlsValidationDecision
public enum TlsValidationDecision
Decision returned by TlsCertificateValidator..
| Value | Description |
|---|---|
Accept = 0 | Validation passed; the certificate is trusted. |
Reject = 1 | Validation failed; the certificate must be rejected. |
struct TlsValidationResult
public readonly struct TlsValidationResult : IEquatable<TlsValidationResult>
Result of running the validator: an TlsValidationDecisionplus a machine-readable rejection reason for logging and the router_ counter.
Parameters
Decision: Whether the certificate is accepted.Reason: The rejection reason, one ofTlsCertificateValidator.; not set on acceptance.Reasons
Members
| Member | Kind | Summary |
|---|---|---|
TlsValidationResult( | constructor | Result of running the validator: an TlsValidationDecisionplus a machine-readable rejection reason for logging and the router_ counter. |
Decision | property | Whether the certificate is accepted. |
Reason | property | The rejection reason, one of TlsCertificateValidator.; not set on acceptance. |
constructor TlsValidationResult(TlsValidationDecision, string) #
TlsValidationResult(TlsValidationDecision, string) #public TlsValidationResult(TlsValidationDecision Decision, string? Reason)
Result of running the validator: an TlsValidationDecisionplus a machine-readable rejection reason for logging and the router_ counter.
Parameters
Decision: Whether the certificate is accepted.Reason: The rejection reason, one ofTlsCertificateValidator.; not set on acceptance.Reasons
property Decision #
Decision #public TlsValidationDecision Decision { get; init; }
Whether the certificate is accepted.
property Reason #
Reason #public string? Reason { get; init; }
The rejection reason, one of TlsCertificateValidator.; not set on acceptance.