Path: redb-route/redb.Route.Tcp/TcpConnectionFactory.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Tcp/TcpConnectionFactory.cs ---- using redb.Route.Abstractions; using redb.Route.Core; namespace redb.Route.Tcp; /// /// Named connection factory for TCP. Register it in the route registry and reference it by name /// from the endpoint URI (connectionFactory=my-tcp) so the TLS certificate password never /// has to appear in the URI, and therefore can never reach logs, telemetry, or the dashboard. /// /// The listen/target address stays in the endpoint path — a factory carries TLS material and /// timeouts only and can never silently redirect a route. /// /// public sealed class TcpConnectionFactory { /// Serve/connect over TLS. public bool Ssl { get; set; } /// Path to the PFX certificate. public string? SslCertPath { get; set; } /// Password for the PFX certificate. [Sensitive] public string? SslCertPassword { get; set; } /// Expected TLS target host name (SNI / certificate validation). public string? SslTargetHost { get; set; } /// Producer only: accept any server certificate, including a self-signed one. public bool TrustAllCertificates { get; set; } /// Producer only: PFX client certificate for a server that requires mTLS. public string? ClientCertPath { get; set; } /// Password for . [Sensitive] public string? ClientCertPassword { get; set; } /// Connect timeout in milliseconds. public int ConnectTimeout { get; set; } = 10_000; /// /// Copies this factory's TLS and timeout settings onto the endpoint options, but only for /// parameters the endpoint URI did not set explicitly — an inline URI value always wins. /// internal void ApplyTo(TcpEndpointOptions options, EndpointUri uri) { var supplied = uri.RawParameters; if (!supplied.ContainsKey(nameof(options.Ssl))) options.Ssl = Ssl; if (!supplied.ContainsKey(nameof(options.SslCertPath))) options.SslCertPath = SslCertPath; if (!supplied.ContainsKey(nameof(options.SslCertPassword))) options.SslCertPassword = SslCertPassword; if (!supplied.ContainsKey(nameof(options.SslTargetHost))) options.SslTargetHost = SslTargetHost; if (!supplied.ContainsKey(nameof(options.TrustAllCertificates))) options.TrustAllCertificates = TrustAllCertificates; if (!supplied.ContainsKey(nameof(options.ClientCertPath))) options.ClientCertPath = ClientCertPath; if (!supplied.ContainsKey(nameof(options.ClientCertPassword))) options.ClientCertPassword = ClientCertPassword; if (!supplied.ContainsKey(nameof(options.ConnectTimeout))) options.ConnectTimeout = ConnectTimeout; } }