From 6ebf6c28b3c8154010a399c08e1354c3ebf1e83e Mon Sep 17 00:00:00 2001 From: George Barnett Date: Thu, 15 Jul 2021 09:41:53 +0100 Subject: [PATCH] Add connect which defaults port to 443 when using TLS Motivation: Port 443 is commonly used for HTTPS. When we're using TLS we should default to this unless otherwise specified. Modifications: - Add a `connect(host:)` to the TLS builder for `ClientConnection` which defaults to port 443. Result: - Resolves #981 --- Sources/GRPC/GRPCChannel/GRPCChannelBuilder.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/GRPC/GRPCChannel/GRPCChannelBuilder.swift b/Sources/GRPC/GRPCChannel/GRPCChannelBuilder.swift index 33f076ca0..865e8df3c 100644 --- a/Sources/GRPC/GRPCChannel/GRPCChannelBuilder.swift +++ b/Sources/GRPC/GRPCChannel/GRPCChannelBuilder.swift @@ -150,6 +150,11 @@ extension ClientConnection.Builder { self.tls = tlsConfiguration super.init(group: group) } + + /// Connect to `host` on port 443. + public func connect(host: String) -> ClientConnection { + return self.connect(host: host, port: 443) + } } }