Brian Hatfield 7 лет назад
Родитель
Сommit
7340be3d10

+ 2 - 2
Sources/CgRPC/shim/cgrpc.h

@@ -172,8 +172,8 @@ cgrpc_channel *cgrpc_channel_create_secure(const char *address,
                                            int num_args);
 
 cgrpc_channel *cgrpc_channel_create_google(const char *address,
-                                          grpc_arg *args,
-                                          int num_args);
+                                           grpc_arg *args,
+                                           int num_args);
 
 void cgrpc_channel_destroy(cgrpc_channel *channel);
 cgrpc_call *cgrpc_channel_create_call(cgrpc_channel *channel,

+ 8 - 8
Sources/CgRPC/shim/channel.c

@@ -66,17 +66,17 @@ cgrpc_channel *cgrpc_channel_create_secure(const char *address,
 cgrpc_channel *cgrpc_channel_create_google(const char *address,
                                            grpc_arg *args,
                                            int num_args) {
-    cgrpc_channel *c = (cgrpc_channel *) malloc(sizeof (cgrpc_channel));
+  cgrpc_channel *c = (cgrpc_channel *) malloc(sizeof (cgrpc_channel));
 
-    grpc_channel_args channel_args;
-    channel_args.args = args;
-    channel_args.num_args = num_args;
+  grpc_channel_args channel_args;
+  channel_args.args = args;
+  channel_args.num_args = num_args;
 
-    grpc_channel_credentials *google_creds = grpc_google_default_credentials_create();
+  grpc_channel_credentials *google_creds = grpc_google_default_credentials_create();
 
-    c->channel = grpc_secure_channel_create(google_creds, address, &channel_args, NULL);
-    c->completion_queue = grpc_completion_queue_create_for_next(NULL);
-    return c;
+  c->channel = grpc_secure_channel_create(google_creds, address, &channel_args, NULL);
+  c->completion_queue = grpc_completion_queue_create_for_next(NULL);
+  return c;
 }
 
 

+ 6 - 5
Sources/SwiftGRPC/Runtime/ServiceClient.swift

@@ -61,20 +61,21 @@ open class ServiceClientBase: ServiceClient {
     metadata = Metadata()
   }
 
-  /// Create a client with Google credentials.
-  /// - Parameter googleApi: the name of the Google API service (e.g. "cloudkms" in "cloudkms.googleapis.com")
+  /// Create a client with Google credentials suitable for connecting to a Google-provided API.
+  /// gRPC protobuf defnitions for use with this method are here: https://github.com/googleapis/googleapis
+  /// - Parameter googleAPI: the name of the Google API service (e.g. "cloudkms" in "cloudkms.googleapis.com")
   /// - Parameter arguments: list of channel configuration options
   ///
-  /// Note: cgRPC's `grpc_google_default_credentials_create` doesn't accept a root pem argument.
+  /// Note: CgRPC's `grpc_google_default_credentials_create` doesn't accept a root pem argument.
   /// To override: `export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=/path/to/your/root/cert.pem`
-  required public init(googleApi: String, arguments: [Channel.Argument] = []) {
+  required public init(googleAPI: String, arguments: [Channel.Argument] = []) {
     gRPC.initialize()
 
     // Force the address of the Google API to account for the security concern mentioned in
     // Sources/CgRPC/include/grpc/grpc_security.h:
     //    WARNING: Do NOT use this credentials to connect to a non-google service as
     //    this could result in an oauth2 token leak.
-    let address = googleApi + ".googleapis.com"
+    let address = googleAPI + ".googleapis.com"
     channel = Channel(googleAddress: address, arguments: arguments)
     metadata = Metadata()
   }