Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow TLS enabled connections when providing an established channel #526

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,22 @@ extension PostgresConnection {
/// - Parameters:
/// - channel: The `NIOCore/Channel` to use. The channel must already be active and connected to an
/// endpoint (i.e. `NIOCore/Channel/isActive` must be `true`).
/// - tls: The TLS mode to use. Defaults to ``TLS-swift.struct/disable``.
/// - tls: The TLS mode to use.
public init(establishedChannel channel: Channel, tls: PostgresConnection.Configuration.TLS, username: String, password: String?, database: String?) {
self.init(endpointInfo: .configureChannel(channel), tls: tls, username: username, password: password, database: database)
}

/// Create a configuration for establishing a connection to a Postgres server over a preestablished
/// `NIOCore/Channel`.
///
/// This is provided for calling code which wants to manage the underlying connection transport on its
/// own, such as when tunneling a connection through SSH.
///
/// - Parameters:
/// - channel: The `NIOCore/Channel` to use. The channel must already be active and connected to an
/// endpoint (i.e. `NIOCore/Channel/isActive` must be `true`).
public init(establishedChannel channel: Channel, username: String, password: String?, database: String?) {
self.init(endpointInfo: .configureChannel(channel), tls: .disable, username: username, password: password, database: database)
self.init(establishedChannel: channel, tls: .disable, username: username, password: password, database: database)
}

// MARK: - Implementation details
Expand Down
Loading