|
|
@@ -48,7 +48,7 @@ public class Channel {
|
|
|
var argumentValues = argumentWrappers.map { $0.wrapped }
|
|
|
|
|
|
if secure {
|
|
|
- underlyingChannel = cgrpc_channel_create_secure(address, roots_pem(), &argumentValues, Int32(arguments.count))
|
|
|
+ underlyingChannel = cgrpc_channel_create_secure(address, roots_pem(), nil, nil, &argumentValues, Int32(arguments.count))
|
|
|
} else {
|
|
|
underlyingChannel = cgrpc_channel_create(address, &argumentValues, Int32(arguments.count))
|
|
|
}
|
|
|
@@ -60,14 +60,16 @@ public class Channel {
|
|
|
///
|
|
|
/// - Parameter address: the address of the server to be called
|
|
|
/// - Parameter certificates: a PEM representation of certificates to use
|
|
|
+ /// - Parameter clientCertificates: a PEM representation of the client certificates to use
|
|
|
+ /// - Parameter clientKey: a PEM representation of the client key to use
|
|
|
/// - Parameter arguments: list of channel configuration options
|
|
|
- public init(address: String, certificates: String, arguments: [Argument] = []) {
|
|
|
+ public init(address: String, certificates: String, clientCertificates: String? = nil, clientKey: String? = nil, arguments: [Argument] = []) {
|
|
|
gRPC.initialize()
|
|
|
host = address
|
|
|
let argumentWrappers = arguments.map { $0.toCArg() }
|
|
|
var argumentValues = argumentWrappers.map { $0.wrapped }
|
|
|
|
|
|
- underlyingChannel = cgrpc_channel_create_secure(address, certificates, &argumentValues, Int32(arguments.count))
|
|
|
+ underlyingChannel = cgrpc_channel_create_secure(address, certificates, clientCertificates, clientKey, &argumentValues, Int32(arguments.count))
|
|
|
completionQueue = CompletionQueue(underlyingCompletionQueue: cgrpc_channel_completion_queue(underlyingChannel), name: "Client")
|
|
|
completionQueue.run() // start a loop that watches the channel's completion queue
|
|
|
}
|