瀏覽代碼

Add connect which defaults port to 443 when using TLS (#1225)

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
George Barnett 4 年之前
父節點
當前提交
40de76e152
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Sources/GRPC/GRPCChannel/GRPCChannelBuilder.swift

+ 5 - 0
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)
+    }
   }
 }